compressing and decompressing dd image - zstd instead of gzip
Using dd
like that (without any options) will make your life miserable. Just cut it out entirely. Or at the very least increase its block size and tell it not to object to short reads.
Without
dd
, first runsudo -s
to get a root shell:gzip </dev/sda2 >/media/mint/Data/_Fsarchiver/MintV1.img.gz gunzip </media/mint/Data/_Fsarchiver/MintV1.img.gz >/dev/sda2
Your
zstd
commands look entirely plausible, but just omitdd
and read/write the device directly as root. (My version doesn't understand yourT6
so I've omitted that here.)zstd -16v </dev/sda2 >/media/mint/Data/_Fsarchiver/MintV1.zst zstdcat -v /media/mint/Data/_Fsarchiver/MintV1.zst >/dev/sda2
With
dd
, either prefix thedd
withsudo
or usesudo -s
to get a root shell:dd bs=1M iflag=fullblock if=/dev/sda2 status=progress | gzip >/media/mint/Data/_Fsarchiver/MintV1.img.gz gzcat /media/mint/Data/_Fsarchiver/MintV1.img.gz | dd bs=1M iflag=fullblock of=/dev/sda2 status=progress dd bs=1M iflag=fullblock if=/dev/sda2 status=progress | zstd -16v >/media/mint/Data/_Fsarchiver/MintV1.img.zst zstdcat /media/mint/Data/_Fsarchiver/MintV1.img.zst | dd bs=1M iflag=fullblock of=/dev/sda2 status=progress
With
pv
instead ofdd
. Either usesudo pv
orsudo -s
beforehand to get a root shell:pv </dev/sda2 | gzip >/media/mint/Data/_Fsarchiver/MintV1.img.gz gzcat /media/mint/Data/_Fsarchiver/MintV1.img.gz | pv >/dev/sda2 pv </dev/sda2 | zstd -16 >/media/mint/Data/_Fsarchiver/MintV1.img.zst zstdzcat /media/mint/Data/_Fsarchiver/MintV1.img.zst | pv >/dev/sda2
Also see Syntax When Combining dd and pv
zstd
supports same commands and pipe capabilities as gzip
,
so if the set of commands works with gzip
, it will work with zstd
too.
As a minor comment, note that several command flags on the decompression side are redundant: zstd -dvc
would be enough and work the same, since -f
and -T6
are not useful for this scenario (though thankfully they also don't hurt).