LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   dd to make backup of partition (https://www.linuxquestions.org/questions/slackware-14/dd-to-make-backup-of-partition-469676/)

titopoquito 08-01-2006 06:51 AM

dd to make backup of partition
 
Hi folks,

I'm sorry to ask this because I know I could read it in the man pages and other documentation and threads, but I'm in a hurry to get some lost data recovered and want to do nothing wrong here.
From a post here on lq.org I got a dd one-liner to clone a partition. Could someone familiar with dd please take a look at the following two line and post if they do what they should?!

1) Clone partition including free space bit for bit in a compressed file:
dd if=/dev/hdb2 bs=1024 | gzip > /mnt/data-a/bilders.iso.gz

2) Put the data back on the partition:
zcat /mnt/data-a/bilders.iso.gz | dd of=/dev/hdb2 bs=1024

Many thanks for reading (and answering) :D

lemmel 08-01-2006 07:16 AM

For me it is correct but I provide NO WARRANTY.

(I think bs parameter is useless, and try to not name your image "*.iso")

titopoquito 08-01-2006 07:23 AM

Quote:

Originally Posted by lemmel
For me it is correct but I provide NO WARRANTY.

Thank you. And I don't expect any warranty.
Quote:

Originally Posted by lemmel
(I think bs parameter is useless, and try to not name your image "*.iso")

The iso was in the example I adapted, I agree that it doesn't make sense, but I am feeling kind of panic so I forgive myself ;)

Any second confirmation that this should be ok to secure the partition? Two opinions would *feel* like a warranty.

b0uncer 08-01-2006 07:32 AM

Seems good to me..I've "backed up" a flash disk using lines quite like those, but after all it was too scrambled to rescue..though dd did it's work all right, so you should be fine (well if you happen to loose something, it's not my fault though:) but nevertheless..go ahead).

It's really not important whether or not it's ".iso", arguing about that is stupid. You can name it to ".godbackup" if you like..doesn't bother me as long as you know what it is :)

titopoquito 08-01-2006 07:41 AM

Quote:

Originally Posted by b0uncer
Seems good to me..I've "backed up" a flash disk using lines quite like those, but after all it was too scrambled to rescue..though dd did it's work all right, so you should be fine (well if you happen to loose something, it's not my fault though:) but nevertheless..go ahead).

It's really not important whether or not it's ".iso", arguing about that is stupid. You can name it to ".godbackup" if you like..doesn't bother me as long as you know what it is :)

Thanks A LOT. The disk dump is saved, so I'll go ahead and see what reiserfsck will be able to recover. Maybe I will set the disk label to "godbackup" if I get back my files :)

evilDagmar 08-02-2006 07:15 AM

bs should be set to 512, since that's the size of the blocks. I don't know if it's possible to have an odd number of blocks or not, but should it actually happen, things might turn ugly (or you might wind up losing the last block of the filesystem).

titopoquito 08-02-2006 09:55 AM

Quote:

Originally Posted by evilDagmar
bs should be set to 512, since that's the size of the blocks. I don't know if it's possible to have an odd number of blocks or not, but should it actually happen, things might turn ugly (or you might wind up losing the last block of the filesystem).

Thanks evilDagmar, I will change this in my personal collection of useful tips and tricks. I actually didn't have to use dd backwards to play the image again onto the partition, but it might be useful for future adventures :) Probably I should read the long dd post in the Newbie section again to see what dd is able to do.


All times are GMT -5. The time now is 10:56 PM.