Boot from m.2: Difference between revisions

From Mike's wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
To boot from M.2. requires some changes.  transfer boot image to m.2. which can be done by restoring the boot image directly<pre>
disk imagesTo boot from M.2. requires some changes.  transfer boot image to m.2. which can be done by restoring the boot image directly<pre>
# dd if=bootimg of=/dev/nvme0 bs=10M status=progress
# dd if=bootimg of=/dev/nvme0 bs=10M status=progress
</pre>However, this does not allow you to easily change the partition tables, and thus..
</pre>However, this does not allow you to easily change the partition tables, and thus..
Line 34: Line 34:


# (cd /mnt/sys1; tar cvf - * ) | (cd /mnt/sysimage ; tar xf -)
# (cd /mnt/sys1; tar cvf - * ) | (cd /mnt/sysimage ; tar xf -)
</pre>
</pre>having transferred all of the data to the new drive we need to reset the partitions to mount them, this involved setting the uuid on the devices, and mount them using uuid.

Latest revision as of 16:55, 9 February 2024

disk imagesTo boot from M.2. requires some changes. transfer boot image to m.2. which can be done by restoring the boot image directly

# dd if=bootimg of=/dev/nvme0 bs=10M status=progress

However, this does not allow you to easily change the partition tables, and thus.. use fdisk to create the partition table, and mount it up as you want eg.

Create the following partitions 

/ 100G
/boot 1G
/var 100G
/home 100G
swap 16G

using fdisk.

format each partition using mkfs.ext4 for non-swap partitions 
format each swap partition using mkswap

mount up the structure in the way you want.

# mkdir -p /mnt/sysimage/ /mnt/sysimage/boot /mnt/sysimage/var /mnt/sysimage/home 

mount partitions under /mnt/sysimage

mount disk image

- using losetup

# mkdir -p /mnt/sys1/ /mnt/sys1/boot 

mount partitions under /mnt/sys1

Transfer files.

# (cd /mnt/sys1; tar cvf - * ) | (cd /mnt/sysimage ; tar xf -)

having transferred all of the data to the new drive we need to reset the partitions to mount them, this involved setting the uuid on the devices, and mount them using uuid.