LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-01-2010, 12:00 PM   #1
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 136
Blog Entries: 1

Rep: Reputation: 17
DD to backup failing HDD


HDA1 is going to die, SMART says its well beyond dead, and I can tell the read/write times have gone up drastically.

I know I can use dd to copy it from a live CD.

1.) If I dd it to something.img, is there a way for me to "work" on the backup copy? Basically, I need to backup ASAP, but won't have a replacement drive for a while, so I'll need to be able to put the changes into the backup.

2.) When it comes time to restore, if I dd it to a larger drive, is there a way to take advantage of all the extra space? I assume I can dd it over and the MBR & Partition Table will go with, so I can use something like gparted to grow the partition to the drive size?

Or is there a better way to make a backup?
 
Old 02-01-2010, 12:15 PM   #2
HasC
Member
 
Registered: Oct 2009
Location: South America - Paraguay
Distribution: Debian 5 - Slackware 13.1 - Arch - Some others linuxes/*BSDs through KVM and Xen
Posts: 329

Rep: Reputation: 55
A better way IMO would be using tar or cpio.
Or any GUI frontend for the aforementioned.
 
Old 02-01-2010, 12:17 PM   #3
minrich
Member
 
Registered: Aug 2003
Location: Isles of Man & Wight
Distribution: See signature
Posts: 548

Rep: Reputation: 40
If you are worried I would strongly suggest that you look into ddrescue (the debian package is called gddrescue) which builds as good as possible bit copy of the failing disk, and it incrementally builds the bad blocks etc, and it can stop and start and it can be run numerous times.

However if you hdd is seriously dodgy then you would be better of using a live cd (such as knoppix 5.1) which avoids booting from the hard disk and only loads the operating system into ram - thereby avoiding any unnecessary read/writes to the drive. I believe that knoppix does include ddrescue.

I regularly 'backup' my os partitions to a created imageYYMMDD.txt file in a partition on my usb drive and it grows automagically to the 10.6GB that my os's reside in. I can then mount it as a loop device and read it from another distro.

Hope this helps
 
Old 02-01-2010, 12:22 PM   #4
minrich
Member
 
Registered: Aug 2003
Location: Isles of Man & Wight
Distribution: See signature
Posts: 548

Rep: Reputation: 40
I strongly suggest that you read: http://www.debianadmin.com/recover-d...-ddrescue.html
 
Old 02-02-2010, 10:30 PM   #5
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 136
Blog Entries: 1

Original Poster
Rep: Reputation: 17
This seems to work (I tried it with a smaller XFS partition to see what would happen).

Old drive:
20GB XFS (hda1)
Has MBR/Grub
Contains /

xfsdump -f /mnt/external-1/xfs.bak /dev/hda1

New drive:
60GB XFS (sdf1)

xfsrestore -f /mnt/external-1/xfs.bak /dev/sdf1

Seems to have put all the files back in place as far as I can quickly visually tell.

Question 1: xfsdump seems to work on a mounted fs. Safe? Or shall I use a livecd so its not mounted?

Question 2: How do I go about the grub install again? I think this will work:
grub> find /boot/grub/stage1
grub> setup (hd0)
grub> quit

Should put it back in the MBR on the replacement drive, and put the menu back together, correct?


Edit: Live dump on / goes bad, it takes all the things mounted as well...

Last edited by jmoschetti45; 02-02-2010 at 10:47 PM.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linux HDD backup under windows - looking for backup utility SigTerm General 1 01-27-2010 11:54 AM
HDD Failing johnny121 Linux - Hardware 3 11-25-2009 08:20 PM
corrupted HDD: need to place backup onto different HDD Cyberman Linux - Desktop 6 09-26-2009 10:51 PM
partimage backup failing babag Linux - Newbie 38 03-08-2008 06:05 PM
Know of an app to analyze a possibly failing HDD? 0mn1z10n Linux - Hardware 7 04-06-2007 07:21 PM


All times are GMT -5. The time now is 07:05 PM.

Main Menu
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