Boot from m.2: Difference between revisions

From Mike's wiki
Jump to navigation Jump to search
(Created page with "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> # 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.. use fdisk to create the partition table, and mount it up as you want eg.<pre> Create the following partitions / 100G /boot 1G /var 100G /home 100G swap 16G using fdisk. format each partition using m...")
 
No edit summary
Line 19: Line 19:
mount up the structure in the way you want.
mount up the structure in the way you want.


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


mount partitions under /mnt/sysimage
mount partitions under /mnt/sysimage
Line 26: Line 26:


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


mount partitions under /mnt/sys1
mount partitions under /mnt/sys1

Revision as of 16:49, 9 February 2024

To 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 -)