Sample Header Ad - 728x90

How to uncompress a gzipped partition image and dd it directly to the destination partition without writing to current partition?

6 votes
1 answer
9414 views
I've backed up a partition using sudo dd bs=8M if=/dev/sda2 | gzip > /someFolderOnSDB/sda2.img.gz. The image is stored on a separate disk sdb. When restoring it using gunzip -k /mnt/bkp/sda2.img.gz | sudo dd of=/dev/sda2, I noticed that the image is being unzipped into the folder someFolderOnSDB where the gz file is, and I think is simultaneously being written with dd to sda2. I don't want that. I want the unzipping to happen in memory, rather than on sdb and the portions being unzipped get directly written to sda with dd. The unzipped image is 300GB in size. I considered using tee or/and the redirect operator >, but am unsure how.
Asked by Nav (389 rep)
Feb 2, 2021, 02:46 PM
Last activity: Jul 30, 2023, 07:37 PM