1

I have a backup image of a device file /dev/sda3 that I created using:

dd if=/dev/sda3 of=~/sda3.img.

The image is very large, so I have re-sized it to remove empty space. My question is can I write the shrunken image back to /dev/sda3 with

dd if=~/sda3.img of=/dev/sda3

without messing up the partition(s) or altering the device file size for /dev/sda3?

In the past I've been able to do this, but I'd like to get some technical information about this operation.

Secondly, let's assume I know where the device file starts and ends in /dev/sda.

Can I write the shrunken backup image directly to /dev/sda, using something like :

dd if=~/sda3.img seek=2048 count=4096,

without messing up the partition table or altering the file size for /dev/sda3 and other /dev/sda devices?

I do not want to compress the image file with something like gzip and then gunzip the compressed file to dd , to write it to disk.

I will likely be accessing the backed up image file regularly via loop mount to grab data from it, so storing it as a compressed image file is not a good option.

1
  • What do you mean by “re-sized”? Did you truncate it? Did you resize the filesystem? Aug 17 '15 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.