Linux_Raspberry Pi_Minimal Image_Lossless Compression

The TF card has 16G, and the img file directly backed up is as big as 16G, but the useful data actually installed in the TF card is only a few gigabytes, and then you need a 32g card to write, so the img file produced by this is too wasteful Space is available, so use this method to compress the disk and make a small img image.

Reference tutorial

https://blog.csdn.net/zhaodeming000/article/details/103198175

https://blog.csdn.net/u013451404/article/details/80552765

View partition information

fdisk -l

Configure partition

sudo e2fsck -f /dev/sda2
sudo resize2fs /dev/sda2 10G

Rebuild the partition:

fdisk /dev/sda

Delete partition:

d

To create a new partition, enter:

n
p
2
【fdisk的起始点】
+10G

Exporting
10504 is calculated using the end sector of sdb2
(the last occupied sector number end 512)/(1024 1024) = 10504

sudo dd if=/dev/sdb of=debian-on-rpi.img bs=1M count=10504

If you want to export to another disk, you need to mount

mkdir /ssc
mount /dev/sdc /ssc
sudo dd if=/dev/sdb of=/ssc/debian-on-rpi.img bs=1M count=10504

Guess you like

Origin blog.csdn.net/nbcsdn/article/details/107143233