LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   clone hard disk with: cat /dev/sda >/media/disk/backup (https://www.linuxquestions.org/questions/linux-security-4/clone-hard-disk-with-cat-dev-sda-media-disk-backup-719685/)

deathalele 04-16-2009 05:57 PM

clone hard disk with: cat /dev/sda >/media/disk/backup
 
Can this be done and to restore the disk with a similar cat command.

cmdln 04-16-2009 06:13 PM

Quote:

Originally Posted by deathalele (Post 3511554)
Can this be done and to restore the disk with a similar cat command.

Try using
backup:
Code:

dd if=/dev/sdx of=/drive/backup.img
restore with the reverse if and of

jschiwal 04-16-2009 06:57 PM

Yes, it is possible thanks to the everything is a file philosophy of Unix. Dd has some options that might make using it preferable.

One thing you can do is use "df" to determine how much free space is left on the filesystem, and then create a file of zeroes using dd of that size. Then delete that file. This will zero out the free space which may make the partition more compressible by piping the output of dd through gzip. To restore you can use zcat and pipe the output to dd.

grepmasterd 04-17-2009 12:29 AM

This may go without saying, but I strongly recommend un-mounting /dev/sda or its partitions before performing any direct device reads.

also look into 'dd_rescue' -- basically the same idea as 'dd' but has some nice error handling capabilities.


All times are GMT -5. The time now is 09:54 AM.