LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices



Reply
 
Search this Thread
Old 04-16-2009, 06:57 PM   #1
deathalele
Member
 
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, 07:13 PM   #2
cmdln
Member
 
Registered: Apr 2009
Location: Lawrence, KS
Distribution: Debian, Centos
Posts: 102
Blog Entries: 1

Rep: Reputation: 24
Quote:
Originally Posted by deathalele View Post
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
 
Old 04-16-2009, 07:57 PM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
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, 01:29 AM   #4
grepmasterd
Member
 
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.
 
  


Reply


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 09:43 PM
LXer: Clone your Ubuntu installation onto a new hard disk LXer Syndicated Linux News 0 11-13-2008 10: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 01:40 AM
boot disk no longer /dev/sda when adding ext. disks rspielma Linux - Hardware 5 12-26-2007 07:21 PM
[SOLVED] system disk moves from /dev/sda to /dev/sdm gdevaucorbeil Linux - Hardware 4 03-10-2007 10:30 AM


All times are GMT -5. The time now is 11:07 AM.

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