Raspberry Pi Custom Installation/Preparations
Jump to navigation
Jump to search
Partition the SD card
root@localhost ~ # parted -a optimal /dev/mmcblk0Create GPT partition table, set unit, and list partitions
mklabel gpt unit mib print
Create new primary partition for boot and another one for LVM with the rest of the card
mkpart primary fat16 4Mib 132Mib set 1 boot on name 1 boot mkpart primary 132Mib -1 set 2 lvm on name 2 lvm print quit
The partitions should look like this
Number Start End Size File system Name Flags 1 4.00MiB 132MiB 128MiB fat16 boot boot, esp 2 132MiB 122622MiB 122490MiB lvm lvm
Create physical volume and volume group
root@localhost ~ # pvcreate /dev/mmcblk0p2root@localhost ~ #
vgcreate rpi /dev/mmcblk0p2Create swap partition and raspbian root
root@localhost ~ # lvcreate -L1G -nswap /dev/rpiroot@localhost ~ #
lvcreate -L10G -nraspbian /dev/rpiFormat the partitions
root@localhost ~ # mkfs.vfat -nboot /dev/mmcblk0p1root@localhost ~ #
mkswap -Lswap /dev/rpi/swaproot@localhost ~ #
mkfs.ext4 -Lraspbian /dev/rpi/raspbianDouble check if all is right
root@localhost ~ # pvsPV VG Fmt Attr PSize PFree /dev/mmcblk0p2 rpi lvm2 a-- 119.62g 108.62g
root@localhost ~ # vgsVG #PV #LV #SN Attr VSize VFree rpi 1 2 0 wz--n- 119.62g 108.62g
root@localhost ~ # lvsLV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert raspbian rpi -wi-a----- 10.00g swap rpi -wi-a----- 1.00g
root@localhost ~ # lsblkmmcblk0 179:0 0 119.8G 0 disk ├─mmcblk0p1 179:1 0 128M 0 part └─mmcblk0p2 179:2 0 119.6G 0 part ├─rpi-swap 253:4 0 1G 0 lvm └─rpi-raspbian 253:5 0 10G 0 lvm