LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-30-2009, 11:51 AM   #1
Micik
Member
 
Registered: Dec 2004
Distribution: open suse
Posts: 137

Rep: Reputation: 15
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
 
Old 06-30-2009, 12:57 PM   #2
xxloaf
LQ Newbie
 
Registered: May 2007
Distribution: Debian
Posts: 10

Rep: Reputation: 0
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.
 
Old 06-30-2009, 01:02 PM   #3
xxloaf
LQ Newbie
 
Registered: May 2007
Distribution: Debian
Posts: 10

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

Last edited by xxloaf; 06-30-2009 at 01:03 PM.
 
Old 06-30-2009, 01:12 PM   #4
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 882

Rep: Reputation: 45
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
 
Old 06-30-2009, 02:27 PM   #5
Micik
Member
 
Registered: Dec 2004
Distribution: open suse
Posts: 137

Original Poster
Rep: Reputation: 15
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."?

Last edited by Micik; 06-30-2009 at 02:37 PM.
 
Old 06-30-2009, 03:23 PM   #6
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 882

Rep: Reputation: 45
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.
 
Old 06-30-2009, 03:46 PM   #7
Micik
Member
 
Registered: Dec 2004
Distribution: open suse
Posts: 137

Original Poster
Rep: Reputation: 15
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

Last edited by Micik; 06-30-2009 at 04:07 PM.
 
Old 06-30-2009, 04:24 PM   #8
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 882

Rep: Reputation: 45
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.
 
Old 07-01-2009, 03:32 AM   #9
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,500

Rep: Reputation: 100Reputation: 100
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?
 
Old 07-01-2009, 09:32 AM   #10
Micik
Member
 
Registered: Dec 2004
Distribution: open suse
Posts: 137

Original Poster
Rep: Reputation: 15
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

Last edited by Micik; 07-01-2009 at 09:35 AM.
 
  


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
Groupware - backups & Outlook questions bax Linux - Server 2 04-15-2008 10:49 AM
Questions about making package mocqueanh Slackware 5 02-08-2008 02:00 PM
is there any way to keep the KDE text editors from making backups? Necronomicom Linux - Software 7 08-22-2004 10:52 PM
Some questions about making your OpenBSD CD... Quartzophobia *BSD 7 02-10-2004 08:33 AM
Making some programs default and another questions... Mega Man X Linux - General 4 07-19-2003 05:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:19 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration