LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 10-13-2010, 04:04 AM   #1
DuarteSilva
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Rep: Reputation: 0
Unhappy Cant restore my hard drive disk properly


Hi all, this is going to be my 1st entry in this forum so any mistake i may do forgivme for it.

NEWBIE ALERT

So here's my problem:

I made a backup of my hard drive to my external disk using the command dd i done it like this:

dd if=/dev/sda of=/mnt/usbdrive/test.img

the copy was made without any errors, after that i tried to "recover" my hard drive with the same command:

dd if=/mnt/usbdrive/test.img of=/dev/sda

and my problems started, sometimes the "recover" finished but then when i reboot the OS wasnt working properly other times the "recover" didnt even end.

My hard drive has several disk partitions and i need them all that's why i used /dev/sda insted /dev/sda1 .

Ty in advance

Ps- I dont have cd-rom drive

Last edited by DuarteSilva; 10-13-2010 at 04:25 AM.
 
Old 10-13-2010, 04:28 AM   #2
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,159
Blog Entries: 4

Rep: Reputation: 149Reputation: 149
Hi,

There is nothing much to suggest you as we dont know exact problem, I mean "OS wasnt working properly" means what?

Was the external drive was of same size or of more size of original one?

And why don't you do directly this:

Quote:
dd if=/dev/sda of=/dev/sdb bs=512
 
Old 10-13-2010, 05:46 AM   #3
DuarteSilva
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
i got some other question about this "recover", when im making the "recover" of my hard drive with the dd command from my flash disk how it will be with the OS? I mean all the configurations will be like the OS from the flash disk? Or they will be like the current OS? Will i have trouble with that?

Dont know if i make me to understand myself, rigth now im making a copy of my hard drive with that command line u gave me.

ty
 
Old 10-13-2010, 11:18 AM   #4
DuarteSilva
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
after used dd if=/dev/sda of=/dev/sdb i had a error:

EXT3-fs error (device sda5): ext3_free_blocks_sb: bit already cleared for block 1249201

i believe its some error in my 5th partition...
any idea that this may be?

ty
 
Old 10-13-2010, 02:01 PM   #5
gammahermit
Member
 
Registered: Apr 2010
Distribution: Arch
Posts: 51

Rep: Reputation: 6
First off dd isn't a good program to use for backups of an entire drive. It makes a byte for byte image of that disk. Which may sound good but it can cause problems and should only be used in certain situations and when you know what you are doing. It would be better to use a GUI program that will handle all the details for you or just tar which is how I do backups.

But anyways we need some more information. How big is the drive you are backing up? How many partition are on it? What is on them, an operating system or just data? How big is the flash drive you are saving the image to?

Quote:
i got some other question about this "recover", when im making the "recover" of my hard drive with the dd command from my flash disk how it will be with the OS? I mean all the configurations will be like the OS from the flash disk? Or they will be like the current OS? Will i have trouble with that?
Do you have a rescue linux distro installed on the flash drive? Well regardless the image will be an exact copy of whatever was on sda at the time you made the image. Whatever else in on the flash drive won't effect the image.


Quote:
after used dd if=/dev/sda of=/dev/sdb i had a error:
You don't want to run that exact command. Since it will copy the contents of the second hard drive onto the first. You want of= to be the image you made "test.img".
 
Old 10-14-2010, 04:38 AM   #6
DuarteSilva
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
The drive Im backing up has 250 GB and it has 8 partitions, ther's a Linux OS, i will put the problem like this i need to have that OS and partitions in a USB hard drive for later use in other desktops that may have problems, my intention is to recover those desktops with problems all the desktops got the same functions/systems.
My USB drive has 160GB but from those 250 GB from my hard drive only 5 GB are being used from all partitions.
My flash drive is completly empty.

Question: Lets say i got something in the flash drive (sdb) and i do dd if=/dev/sda of=/dev/sdb , what will happen with the other things in there? And after i do that command if i do the if=/dev/sdb of=/dev/sda what will happen with the things that were already in the flash drive? They will also be replicated into the hard drive(sda)?

Ty for all the help
 
Old 10-14-2010, 07:45 AM   #7
gammahermit
Member
 
Registered: Apr 2010
Distribution: Arch
Posts: 51

Rep: Reputation: 6
Okay I see what you want to do know. But you can't use dd to do it. dd will just copy the first 160GB of the 250GB hard disk to the flash drive. And it wont be the actual used space it will just be the first 160 billion bytes of data. Even if the data is just 00000000. dd does a byte for byte copy, it doesn't care if it is actual data or just padded zeros, it will copy it over.

Well it may still be possible to use dd if you really want to. You can compress the image you make with dd then copy it to the flash drive. According to the man page if you omit `of=` it will just write it to stdout. Then you can pipe that through bzip. So something like `dd if=/dev/sda | bzip2 -c > sda.bz` might work. Then to restore it you could do `bunzip2 -c sda.bz | dd of=/dev/sda`.

Note: I don't know if that would actually work but it is worth a try. I'm sure that there are programs to do what you want. If you do some googling you should be able to find something. I can't recommend anything since I've never used any.

Last edited by gammahermit; 10-14-2010 at 07:55 AM.
 
Old 10-14-2010, 08:37 AM   #8
DuarteSilva
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
I see, what can u tell me about tar command? it will make backups from the partitions also?

ty in advance
 
Old 10-14-2010, 09:22 AM   #9
gammahermit
Member
 
Registered: Apr 2010
Distribution: Arch
Posts: 51

Rep: Reputation: 6
Taring only archives the files and directories not the filesystem or partition. So you would have to make a tarball (a tarball is just a tar archive compresses with gzip) of all the files in each partition. If you have 8 partitions you would have to make 8 tarballs for each of them. Then when you want to restore from the backups you would have to restore each tarball to the right partition overwriting the files. Unless there was a problem with the drive itself in which case you would first have to recreate all of the partitions then make a filesystem on each of them then mount them and finally unarchive the tarball in the correct mount point.

If you only had to backup one or two partition then tar would be a good way to do it. But since you have 8 it probably isn't the best solution.
 
Old 10-14-2010, 09:27 AM   #10
DuarteSilva
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Im going to try the ziped dd file then

dd if=/dev/sda | bzip2 -c > sda.bz from what i understnad this will make a ziped image file from all my hard drive in my main partition?

Last edited by DuarteSilva; 10-14-2010 at 09:29 AM.
 
Old 10-14-2010, 11:57 AM   #11
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,988

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Try using something like Clonezilla; it's a lot easier to use and can clone an entire hard drive to a single image file like you want:

http://clonezilla.org/
 
Old 10-15-2010, 03:30 AM   #12
DuarteSilva
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
It seems i made it done +/- properly, with the dd commnad piped with zip to make the backup, after I deployed the backup and i had some erros, but then i runed the fsck command in all partitions and the desktop started to work properly, dunno if is the best/fast way do make and deploy backups.

Any more advices/sujestions are welcome, mybe i will try the clonezilla.

Ty for evrything
THis forum rocks!
 
  


Reply



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
Virtual Hard Drive Restore Anomaly noob_@_linux Linux - Virtualization and Cloud 1 02-05-2010 01:44 PM
Can't boot from my hard disk. Can't restore GRUB . harish2704 Linux - General 2 02-05-2010 02:45 AM
Hard Disk Failure: How do I move data to a new hard disk drive? spyros Linux - Software 2 10-31-2008 03:01 PM
restore hard disk from several splitted files by Partition Image powah Linux - Software 4 03-11-2008 10:03 PM
Can dd restore the entire hard disk including partition table and MBR? depam Linux - General 17 01-01-2007 07:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:36 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
Open Source Consulting | Domain Registration