View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 13 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Fri Dec 01, 2006 9:54 pm 
Offline
Joined: Fri Aug 26, 2005 9:54 pm
Posts: 617
I have a second (identical) hard drive in my knoppmyth box. I would like to use it to make a snapshot backup of my knoppmyth harddrive. Is there any program that can copy all the partitions and MBR stuff all together.

The best I've been able to find is coping the partition table then using a ghost clone to backup each partition. Then restore each partition on the second harddrive. Then manually rebuilding the MBR on the second harddrive.

That is too much work I think. Especially the extra drive space required to store the ghost backup image.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 11:51 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
Code:
man dd
dd if=/dev/hda of=/dev/hdb

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 7:40 am 
Offline
Joined: Fri Aug 26, 2005 9:54 pm
Posts: 617
Great that is very easy. Thanks.

I actually did look at the man page for 'dd' earlier. It says "dd - convert and copy a file". That doesn't sound like a correct description for what I want to do so I didn't examine it any further.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 2:21 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
:) You're welcome.

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 5:06 pm 
Offline
Joined: Fri Aug 26, 2005 9:54 pm
Posts: 617
cesman's command worked perfectly. But wow, it took over five hours to duplicate my 250GB drive. Sill a very useful backup method. Though I'll have to plan ahead whenever I want to use it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 1:47 pm 
Offline
Joined: Tue Nov 14, 2006 2:55 pm
Posts: 245
Location: South Jersey
the dd command can be optimized if given a block size. I've found dd if=/dev/hda of=/dev/hdb bs=32768k works well. Try experimenting if you plan to copy the drive often.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 1:48 pm 
Offline
Joined: Tue Nov 14, 2006 2:55 pm
Posts: 245
Location: South Jersey
Actually once you have a "copy" you could simply run "rsync" every night to update the copy.

Fyi,

Abs


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 06, 2006 9:55 am 
Offline
Joined: Fri Aug 26, 2005 9:54 pm
Posts: 617
abigailsweetashoney wrote:
Actually once you have a "copy" you could simply run "rsync" every night to update the copy.

Fyi,

Abs


The rsync man page talks a lot about transferring over a network. I assume it is smart enough to not do that when working on two local files. This is the command I would want right?
Code:
rsync /dev/sda /dev/sdb


When I used 'dd' to copy the drive before, I booted off a CD so that the source drive (including swap space) was not mounted. Do you think I need to do that or is it possible to do the copy with the drive in use? It seems that for rsync the checksum would keep changing and screw it up mid copy.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 07, 2006 7:24 am 
Offline
Joined: Tue Aug 08, 2006 7:08 pm
Posts: 561
Location: UK
Rsync works at the file level, so I don't believe device level access (/dev/hdX) will work. For direct image copies of drives/partitions dd is your command. If you are wanting to do file level backups, cp, tar, dump and rsync are best.

Bruce S.

_________________
Updated 2019/10/26: AthlonII X2 265 Gigabyte GA-970A-DS3P
16Gb PC 1866 DDR3, 500GB+2TB+4TB SATA HDD,
SATA DVD-RW Asus DRW-24D5MT , NVIDIA GeForce GT1080
Hauppauage Nova-T 500, Nova-T LinHes R8.6.1


Top
 Profile  
 
 Post subject: Boot info??
PostPosted: Thu Dec 07, 2006 8:07 am 
Offline
Joined: Mon Oct 02, 2006 7:24 am
Posts: 39
I assume dd will preserve everything, including MBR info, so you could potentially swap hdb into hda and roll with a running system in just a few minutes. No partitioning or anything needed, hdb is a total clone of hda?

I have had troubles rsyncing files between unix-pc, due to file name conventions. I assume rsync may have trouble with ownership and permissions as well. If you run rsync as root on your /myth would it respect ownership / groups appropriately?

For your own home directory or set of files, rsync is terrific but I have concenrnd.


Top
 Profile  
 
 Post subject: Re: Boot info??
PostPosted: Thu Dec 07, 2006 8:27 am 
Offline
Joined: Fri Aug 26, 2005 9:54 pm
Posts: 617
ed.gatzke wrote:
I assume dd will preserve everything, including MBR info, so you could potentially swap hdb into hda and roll with a running system in just a few minutes. No partitioning or anything needed, hdb is a total clone of hda?

Correct after running 'dd' I was able to swap the harddrives and the system never knew the difference. No messing with partitions or lilo or anything. I havn't needed it yet but if I brake anything I can just swap cables and be back at a working system in 2.2 seconds.

It sounds like 'rsync' wont work for a quick update of the back up drive.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 12:05 pm 
Offline
Joined: Fri Sep 15, 2006 12:16 pm
Posts: 292
dd works if the drives are the same size, but there is still a way if your drives are a different size. Try the GPartEd bootable CD.

dd, delete junk destination partitions, use the GPartEd CD.

Basic steps that I use:
- Boot the GPartEd CD. 0.3.1-1 is the version I am using.
- Get to a shell prompt by pressing the Terminal button in the task bar at the bottom right of the screen. The Terminal button has a $ sign on it.
- Copy the first 100 meg or so over with dd. This will get all the boot info, but it will get the partition table too and the partition table will have to be cleared. Assuming you are copying from hda to hdb use this:
dd bs=1M count=100 if=/dev/hda of=/dev/hdb
- Reboot the GPartEd CD to make sure the OS sees the new partition table.
- Use cfdisk to clear out the partition table on the destination disk. Use
cfdisk -z /dev/hdb
with the write and quit commands.
- Or use fdisk to clear out the partition table on the desination disk. Use
fdisk /dev/hdb
d
4
d
3
d
2
d
1
w

You will get some warnings if you don't have all 4 primary partitions in use.
- Reboot the GPartEd CD to make sure the OS sees the new partition table.
- The rest is done with the mouse from the GPartEd GUI
- Select the source drive from the drop down menu in the upper right corner in this example it would be /dev/hda.
- Right click the first (/next) partition (middle of the screen) and select "Copy"
- Select the destination drive from the drop down menu in the upper right corner in this example it would be /dev/hdb.
- Right click the unpartitioned space (middle of the screen) and select "Paste". You can change the size of the destination partition here.
- Perform the previous 4 steps for each partition on the source drive, in order.
- Click the "Apply" button at the top.
- Wait :wink: or go to bed. On most average computers it takes about 1 minute per gig to copy.

The preceding supposes that you are going from a small hard drive to a big hard drive. If you are going from a big hard drive to a small hard drive (i.e. the sum of the sizes of the source partitions just won't fit on the destination hard drive), but the partitions have enough free space on them, you can still do the copy. You just have to "Resize" (shrink) the source partitions before the copy and "Resize" (expand) them back to their original size after the copy.

Some boot loaders (LILO at least?) will get confused under some atypical configuration conditions if you have both hard drives in the same machine after the copy completes (true of the original "use dd" method too). (Maybe trying to get LILO to boot from hdb in the example?) This is because the drives' volume id's (terminology?) are the same. There is probably some easy way to change the volume id, but you may have to re-run LILO after that.

Although I have never had problems with copying hard drives this way, you should be aware that some files will not be at the same place on the hard drive when you are done and that could cause some boot loaders (or programs that know their own location on the disk) to fail. E.g. you may have to find a way to re-run LILO to get it to boot although I haven't had this problem.

dd, delete junk destination partitions, use GPartEd. Whew! Isn't it amazing how long a thorough explanation of something this simple can be?

-- Cliff --


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 2:34 pm 
Offline
Joined: Fri Aug 26, 2005 9:54 pm
Posts: 617
Thanks for the info. I'll check out that GPartEd CD. It sounds really powerful.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu