Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 04-16-2009, 05:57 PM   #1
Registered: May 2008
Location: deep dark north wales
Distribution: Zenwalk
Posts: 162

Rep: Reputation: 30
clone hard disk with: cat /dev/sda >/media/disk/backup

Can this be done and to restore the disk with a similar cat command.
Old 04-16-2009, 06:13 PM   #2
Registered: Apr 2009
Location: Lawrence, KS
Distribution: Debian, Centos
Posts: 102
Blog Entries: 1

Rep: Reputation: 24
Originally Posted by deathalele View Post
Can this be done and to restore the disk with a similar cat command.
Try using
dd if=/dev/sdx of=/drive/backup.img
restore with the reverse if and of
Old 04-16-2009, 06:57 PM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
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.
Old 04-17-2009, 12:29 AM   #4
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to clone centos to other hard disk? windstory Linux - Newbie 2 02-13-2009 08:43 PM
LXer: Clone your Ubuntu installation onto a new hard disk LXer Syndicated Linux News 0 11-13-2008 09:11 PM
RAID1 array down to one disk with bad blocks, clone to good disk with dd noerror? ewolf Linux - Server 2 05-10-2008 12:40 AM
boot disk no longer /dev/sda when adding ext. disks rspielma Linux - Hardware 5 12-26-2007 06:21 PM
[SOLVED] system disk moves from /dev/sda to /dev/sdm gdevaucorbeil Linux - Hardware 4 03-10-2007 09:30 AM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration