My old SSD failed to keep my capacity demandsm though it is still very healthy. (89% remaining in SMART report)
With the price of TLC SSDs dropping below my old SSD’s price while doubling storage capacity, I have been tempted to upgrade my existing one. Eventually, the urge was triggered by the Black Friday sale!
Partitioning and Formatting
Enough talking, let’s get our hands dirty.
I like the simplcity of
fdisk /dev/nvme0n1 # nvme0n1p1: efi # nvme0n1p2: swap 32GB nvme01p3: /
Next, we need to create filesystems for those partitions.
The default inode ratio
ext4 is quite small. It might not be significant for small partitions (tens of Gigibytes, yes, not Gigabytes),
but the space waste is considerable for big partitions. A typical Linux root filesystem will be unlikely to
use-up all the available inodes.
The ratio for
huge type is defined in
It is 65536 Bytes = 64KiB.
mkfs.etx4 -T huge /dev/nvme0n1p3
We also need to create a
vfat FS for UEFI booting.
swap FS for system swap usage.
Migrate Data in the Root Filesystem
First, mount the old root FS and the empty new one.
mount /dev/nvme0n1p3 /mnt/new_root mount /dev/nvme1n1p3 /mnt/old_root mount /dev/nvme0n1p1 /mnt/new_efi mount /dev/nvme1n1p1 /mnt/old_efi
Root FS Data Transfer
Next, we use
rsync to copy everything, literally everything
(hardlink, symbolic link,
-a: archive mode, the mode for our purpuse. Equal to
-r: recurse into directories
-l: copy symlinks as symlinks
-p: perseve permissions
-t: preserve modification times
-g: preserve group
-o: preserve owner
--specials, preserve device and special files
-h: output numbers in human-readable format
-H: preserve hardlinks
-A: preserve ACLs (Access Control List)
-X: preserve extended attributes
--one-file-system, don’t cross filesystem boundaries
- keep partially transferred files
- show progress during transfer (for every files, can be annoying and taxing to performance)
rsync -ahHAXx /mnt/old_root/ /mnt/new_root
Update fstab and grub config
blkid to list UUID for the new root filesystem.
The output looks something like this:
/dev/nvme0n1p1: UUID="<efi-uuid>" TYPE="..." PARTUUID="..." /dev/nvme0n1p3: UUID="<rootfs-uuid>" TYPE="..." PARTUUID="..." ...
/etc/fstab, update the UUID for
/ to the new one. (<rootfs-uuid>)
default: resume=<efi-uuid> ...
Finally, regenerate GRUB in the EFI partition.
To change root. Luckily, Mnajaro architect installation media provides
manjaro-chroot to properly setup mount points.
If nothing goes wrong, we can now reboot into our new home. Oh, remember to change the boot order in your BIOS/UEFI.