On 25/12/2021 15.16, Carlos E. R. wrote:
Hi,
I use this bash code (script) to image partitions - I arrived there with help here:
I just did a run with a modification (for real use):
function hacer() { echo echo "Doing partition $1 ($2) on $3" echo "copying, compressing, and calculating md5..." mkfifo mdpipe dd if=/dev/$1 status=progress bs=16M | tee mdpipe | pigz > $3.gz &
dd if=/dev/$1 status=progress bs=16M | tee mdpipe | > $3.img &
md5sum -b mdpipe | tee -a md5checksum_expanded wait rm mdpipe echo "$3" >> md5checksum_expanded
echo echo "·········" }
Used this way:
time hacer sda8 "XX:YY H" "sda_8_Home" I did it that way, to image without compression a 252G partition (I thought it would be faster without compression, and intended to delete the image afterwards). Source on SSD, writing on rotating rust over USB2. It took 2:27 hours, or 147 minutes. 30..33MB/S, continuous, *no alternating*. Actually, that external disk is mounted as btrfs with compression and encryption, so there is always some compression: /dev/mapper/cr_data on /data type btrfs (rw,relatime,lazytime,compress=zlib:3,space_cache,subvolid=5,subvol=/) Erebor:/data/Portatil_entero_9.1 # compsize --bytes sda_8_Home.img Type Perc Disk Usage Uncompressed Referenced TOTAL 99% 269950705664 270011826176 269657550848 none 100% 269859127296 269859127296 269505048576 zlib 59% 91578368 152698880 152502272 Erebor:/data/Portatil_entero_9.1 # Then I did a restore, of the files, with rsync (because I am reformatting the disk with different filesytem): md theloop mount -o ro,loop sda_8_Home.img theloop/ md thehome mount -v /dev/sda8 thehome/ resulting in these mounts: /dev/sda8 on /data/Portatil_entero_9.1/thehome type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota) /data/Portatil_entero_9.1/sda_8_Home.img on /data/Portatil_entero_9.1/theloop type reiserfs (ro,relatime) And restoring files with: time rsync --archive --acls --xattrs --hard-links --sparse \ --partial-dir=.rsync-partial --stats --human-readable \ --checksum /data/Portatil_entero_9.1/theloop/ \ /data/Portatil_entero_9.1/thehome resulting in these 'fs': dev/sda8 252G 179G 73G 72% /data/Portatil_entero_9.1/thehome /dev/loop0 252G 180G 73G 72% /data/Portatil_entero_9.1/theloop With this screen output: 2021-12-31 21:39:15+01:00 Empezando rsync: Number of files: 552,872 (reg: 529,077, dir: 21,541, link: 2,214, special: 40) Number of created files: 552,871 (reg: 529,077, dir: 21,540, link: 2,214, special: 40) Number of deleted files: 0 Number of regular files transferred: 462,412 Total file size: 191.62G bytes Total transferred file size: 191.41G bytes Literal data: 191.41G bytes Matched data: 0 bytes File list size: 30.21M File list generation time: 0.250 seconds File list transfer time: 0.000 seconds Total bytes sent: 191.51G Total bytes received: 12.12M sent 191.51G bytes received 12.12M bytes 11.06M bytes/sec total size is 191.62G speedup is 1.00 real 288m29.496s user 31m20.928s sys 24m50.115s End at 2022-01-01 02:27:45+01:00 The point here is how much slower is the rsync restore (288 min or 2:30H) than the image write (147, or 4:48H), so an image backup/restore can be faster than an rsync strategy. -- Cheers / Saludos, Carlos E. R. (from 15.2 x86_64 at Telcontar)