LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Few questions abbout making backups (https://www.linuxquestions.org/questions/linux-newbie-8/few-questions-abbout-making-backups-736715/)

Micik 06-30-2009 11:51 AM

Few questions abbout making backups
 
Hello to all,

I have already searched the forum and found useful information. However, to be 100% sure, I need more information.

I need to make a backup (copy entire disk) of existing hard drive which is big about 10 GB. I have a spare one which is 40 GB in size, so it should fit.
I need to be sure about the following:

1.When I add new drive in the computer on the separate IDE cable (secondary), that new drive will become hdb while existing drive (Master on primary IDE) is hda, right?


2. I will make exact copy in the following way:
dd if=/dev/hda of=/dev/hdb
This will copy entire hda to 10 GB of hdb, the rest will be free on hdb, right?

3. Does hdb (spare HD) needs to be partitioned in any way before executing dd command? I think not, but just to be sure.

If someone can agree or disagree on this three question, I'd be very grateful.

Thank you

xxloaf 06-30-2009 12:57 PM

Quote:

2. I will make exact copy in the following way:
dd if=/dev/hda of=/dev/hdb
This will copy entire hda to 10 GB of hdb, the rest will be free on hdb, right?
I believe if you do it this way with just /dev/hda and /dev/hdb (without partition numbers), that is going to make an exact copy of the whole drive, including partition layout, so your hdb drive is only going to have a 10gb partition still.

You will have to use fdisk most likely to change your partitions after you do that.

If Im wrong someone correct me, I havent used dd to copy a drive in a while.

xxloaf 06-30-2009 01:02 PM

Sorry and the other 2 questions:

Quote:

3. Does hdb (spare HD) needs to be partitioned in any way before executing dd command? I think not, but just to be sure.
Correct because the DD command will overwrite the partition table.

Quote:

1.When I add new drive in the computer on the separate IDE cable (secondary), that new drive will become hdb while existing drive (Master on primary IDE) is hda, right?
It really depends on how the kernel feels like naming it and what other devices you have, like CD/DVD drives.

If you are putting it on a separate cable completely most likely it will become HDC.
hda primary master
hdb primary slave
hdc secondary master
hdd secondary slave

but like I said it could be completely different.

rbees 06-30-2009 01:12 PM

Micik,

Have you looked at this http://www.linuxquestions.org/questi...ommand-362506/ There is a specific section that deals with coping a smaller drive to a larger one. Just scroll down and you will find it.

The new drive may be hdb, that depends on if the primary ide controler has 2 drives on it. If it does then it will most likely be hdc.

There is one certin way you can tell. After you install it, boot on a live-cd like knoppix and the drives/partitions will show up on the desktop.

Hope that helps

Micik 06-30-2009 02:27 PM

Thank you,
I need to be careful about source and destination. I don't want to mix this and end up with two empty hard drives. So far, I have only one drive which is hda. I'm pretty much sure that this won't change after I add new hd on separate cable. Source will stay the same (hda).
rbees, I have already read that thread. Just one question.
Should this "Rejuvenate a hard drive To cure input/output errors experienced when using dd."
be
"Rejuvenate a hard driveTo cure input/output errors experienced when using HD."?

rbees 06-30-2009 03:23 PM

Quote:

"Rejuvenate a hard driveTo cure input/output errors experienced when using HD."?
I don't think so, but you might post to that thread to find out for sure. I have only used dd a little bit. I would run that command to rejuvenate the drive if it is old, kind of like an oil change on the car. I usually do the dd thing from a "Helix" cd because it does not use any of the system on the machine, including swap, so there is less chance of damaging the file system, a little anyway. Helix is a forensic cd used to examine a system by law enforcement.

From a live cd you can look at the partitions to see what is on them to be sure you have the correct one. But if I remember right the partitions have to be unmounted before you run dd on them.

Micik 06-30-2009 03:46 PM

Does it mean that I cannot just log on as root and type dd command?
I didn't find that piece of information.
I thought to proceed as follows:
1. Open computer case and add new empty disk with IDE cable.
2. Turn ON computer, go to terminal, login as root
3. type dd command
4. after dd is finished, turn off computer and remove backup drive

So, if I understood correctly, this will not work. What I need to do before typing dd command in terminal (command) window?
Sorry because of these questions, but I need to be sure. Mistake may be very costly.

The best possible approach would be to mount hda as a read only. syntax is mount -r, but don't know complete command.

After logged on as root, should I type mount -r /hda or what?

Thanks again

rbees 06-30-2009 04:24 PM

Quote:

Does it mean that I cannot just log on as root and type dd command?
No. You can do it from root as far as I know. I just prefer to use a live cd.

I am not sure about the partition being mounted though. I would think that the source partition would not matter because dd is only reading it. The destination partition may be a different matter. But like I said I am not sure it is only something I think I remember. I skimed the man page but didn't see that it said. A quick google search on 'dd mounted partition' gave me this http://www.inference.phy.cam.ac.uk/s...artitions.html but I have not really read it.

If you don't change your fstab file to mount the new drive on boot after you install it, it won't be mounted anyway. Unless you mount it manually that is.

What is the worst that can happen, you write a bunch of garbage to the drive and have to do it again. As long as you are carefull in your drive assignments that is. As long as you treat dd with a healthy amount of respect you should be ok.

Use my advice at your own risk.

rylan76 07-01-2009 03:32 AM

Wouldn't it be easier to become root and just do

Code:

cd <source disk mount>
tar cvf hdd.tar *
cd <to target disk mount>
cp <source disk mount>/hdd.tar .
tar xvf hdd.tar

?

If there isn't enough space on the source drive, why not just tar FROM the source while on the TARGET, then untar on target?

Micik 07-01-2009 09:32 AM

I've already made backup by using dd command.
I used the following command:
dd if=/dev/hda of=/dev/hdb bs=32256

Source drive was 10GB and destination 40GB. It took about one hour and ended up with error message that there is no space on the drive (which makes no sense). But nevertheless I tested backuped HDD and it seems that working just fine. Probably, the problem was in the fact that I didn't unmout /hda2, but not really sure. I didn't know how to remount drive as read only.
I'll test more tomorrow and see if there are any problems...

Thanks for the help


All times are GMT -5. The time now is 06:27 PM.