Clone OS image
Read disk and save .img.xz
$ sudo fdisk -l
...
Disk /dev/sdb: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disk model: STORAGE DEVICE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf7bdbfa9
Device Boot Start End Sectors Size Id Type
/dev/sdb1 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/sdb2 532480 31115263 30582784 14.6G 83 Linux
sudo umount /dev/sdb1 /dev/sdb2
sudo dd if=/dev/sdb of=clone.img bs=4M count=$((31115263 + 1)) status=progress
$ sudo parted -ms clone.img unit B print
BYT;
/home/hhk7734/clone.img:15931539456B:file:512:512:msdos::;
1:4194304B:272629759B:268435456B:fat32::lba;
2:272629760B:15931015167B:15658385408B:ext4::;
$ sudo losetup -f --show -o 272629760 clone.img
/dev/loop20
sudo e2fsck -pf /dev/loop20
$ sudo tune2fs -l /dev/loop20 | grep -e '^Block size:' -e '^Block count:'
Block count: 3822848
Block size: 4096