NVME Upgrade
Yesterday morning, after booting up my desktop, I was greeted with an all too familiar warning:
disk space low on /
When I initially build this PC, I had installed a 250GB SSD to use for my Linux system. That was fine 8 years ago 1) but at some point didn't cut it anymore. So not that long ago2) I upgraded to a 500GB Samsung M2 NVME, thinking that twice as much space must surely be enough.
Well it wasn't. And yesterday morning I finally had enough and bought a Lexar NM790 which has a capacity of 4TB.
My mainboard only has a single M2 slot. So I needed to replace the old with the new one. Of course I did not want to reinstall my system, so here is what I did.
Together with the new NVME, I also ordered am external NVME USB case and put the new disk in there.
Next I booted from an USB stick, using the CloneZilla image. Then I used CloneZilla to clone my old NVME to the new one attached by USB. This took a loooong time3). Not sure if it would have been faster to simply dd
the data or if the USB connection was the bottleneck here.
After the cloning was done, I replaced the Samsung with the Lexar on the mainboard and was able to boot into my system as usual. But of course the cloned partition was still only 500GB.
Next I booted into another ISO that had gParted available. Incidentally that was the RescueZilla image for me. RescueZilla is a graphical fork of CloneZilla, but their cloning process didn't work for me.
Anyway, I tried to use gParted to resize the ext4 partition. However that failed, because my old setup still used a MSDOS style MBT partition table. And that can't handle 4TB partitions.
So the partition table needed to be converted to GPT first. I followed the first 4 steps of this Serverfault Answer. Basically gdisk
automatically converts your MBT to a GPT. But you also need to replace the MBR 4) with a boot partition.
With this done, I could then resize the ext4 partition using gParted.
Of course this would no longer boot. Grub needed to be reinstalled. The easiest way to do that, is to boot another ISO. This time the install medium of my distro of choice: Arch Linux5).
Once booted, mount the disk, chroot into it and reinstall grub.
#> mount /dev/nvme0n1p1 /mnt #> arch-chroot /mnt #> grub-install /dev/nvme0n1
Finally, I could boot into my system again. Hopefully this will now last for a while: