======================================================================== Date: 9 Dec 2022 by Lawrence Glaister VE7IT Project: ======== - move from a small sata SSD on /dev/sda to a larger nvme drive on /dev/nvme0n1 - move from MBR dos style boot to EFI to support larger devices - resize root partion to use new space available on the new nvme drive. - This process preserves all your installed programs and setups. You should not have to reconfigure or reinstall any user programs. The downside is that any cruft on your old system will also be preserved! Notes: ====== - assumes ARCH linux installation - it is useful to print this guide before starting the process. - nvme drives are driven directly from the bus via multiple channels resulting in up to 10X the disk performance of a sata SSD or 100X spinning rust drive. ie spinning rust, maybe 50MB/s; sata SSD, maybe 500MB/s; nvme, close to 5GB/s. - This process assumes new drive will have a simple partion setup of: 1. /boot (typically 300MB) 2. / (typically 900GB+ for a 1TB nvme drive) 3. swap (typically 16GB or same size as installed ram) Device Boot Start End Sectors Size Id Type /dev/nvme0n1p1 2048 524287 522240 255M ef EFI (FAT-12/16/32 /dev/nvme0n1p2 524288 1918707711 1918183424 914.7G 83 Linux /dev/nvme0n1p3 1918707712 1953523711 34816000 16.6G 82 Linux swap / Sola Process: ======== # install old ssd and new nvme devices in computer chassis # boot from arch install dongle (UFI mode option) # make sure the nvme drive is alive (look for nvme0n1p1,nvme0n1p2, etc) lsblk # image old drive onto nmne drive cmd below takes about 1100 sec or 18 minutes dd bs=4M if=/dev/sda of=/dev/nvme0n1 conv=fsync oflag=direct status=progress # power off and remove old drive for safety shutdown -h now # boot from arch install dongle (UFI mode option) # make sure the nvme drive is alive (look for nvme0n1p1,nvme0n1p2, etc) lsblk // convert to ufi boot by reformating old /boot partion // you can also resize the / partition if needed or wait and do it later // with graphical gpartd fdisk /dev/nvme0n1 #p to display partitions #t to change partition 1 to EF (boot partion to type EFI) #w to write changes mkfs.fat -F32 /dev/nvme0n1p1 # format the boot partition mkswap /dev/nvme0n1p3 # set up swap partition mount /dev/nvme0n1p2 /mnt # mount root partition mount --mkdir /dev/nvme0n1p1 /mnt/boot # mount boot partition swapon /dev/nvme0n1p3 # activate swap partition # this installs latest kernel (and populates /boot directory) pacstrap -K /mnt base linux linux-firmware # picks up current file system info and append it to fstab... you will # have to sort this out as the new UUIDS are correct but you may want the old options genfstab -U /mnt>>/mnt/etc/fstab nano /mnt/etc/fstab # fix options and UUIDS, delete cruft example: # /dev/nvme0n1p1 efi boot UUID=A043-9545 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 # /dev/nvme0n1p2 LABEL AntergosRoot UUID=ad8611a6-9acb-476d-b020-b18e003112b7 / ext4 defaults,noatime,discard 0 1 # /dev/nvme0n1p3 swap UUID=00364f5e-3d10-42b7-b72b-605e45526dac none swap defaults 0 0 # switch to our copied arch system arch-chroot /mnt # make sure fstab is correct blkid # note uuid for /dev/nvme0n1p1) cat /etc/fstab # (check and or update uuid for boot partion) # make sure we have some needed packages installed... should not hurt anything # most of these were likely installed already on our old drive image pacman -S grub efibootmgr dialog os-prober mtools dosfstools base-devel linux-headers reflector # now the grub stuff needs to be set up and installed on the new drive # next time the system boots, you will see a boot option called "GRUB" grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB # build the grub config file that will be used on next boot grub-mkconfig -o /boot/grub/grub.cfg exit # to exit chroot reboot # remove arch linux dongle after it closes up shop # catch the bios during booting to select GRUB as the reboot device # check the boot log for any errors and fix the new image up journalctl -b #to fix ERROR: resume: no device specified for hibernation #this was caused because I deleted and recreated the swap partition when #resizing the / partition resulting in a new parition UUID being generated. # a quick edit to update the resume partition ID is all thats needed. nano /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=00364f5e-3d10-42b7-b72b-605e45526dac" sudo grub-mkconfig -o /boot/grub/grub.cfg #The swap partion is my swap partition now I can hibernate! #======================================================================= # section added 30 Jan 2023 after system failed to find boot device # forensics: motherboard battery at 1.88V instead of 3.3V... # forgets efi settings and wont boot # boot from arch install compact flash, make sure to pick option # UFEI:Generic Compact Flash 1.0 fdisk -l # make sure you can see the 3 /dev/nvme0n1xx partitions mount /dev/nvme0n1p2 /mnt mount /dev/nvme0n1p1 /mnt/boot arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB grub-mkconfig -o /boot/grub/grub.cfg exit # exit chroot reboot # unplug compact flash after system shutdown and before reboot starts # all should boot again #=======================================================================