LinHES Forums http://forum.linhes.org/ |
|
how to copy all partitions, files, MVR,etc to duplicate HDD? http://forum.linhes.org/viewtopic.php?f=5&t=12812 |
Page 1 of 1 |
Author: | ryanpatterson [ Fri Dec 01, 2006 9:54 pm ] |
Post subject: | how to copy all partitions, files, MVR,etc to duplicate HDD? |
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. |
Author: | cesman [ Fri Dec 01, 2006 11:51 pm ] |
Post subject: | |
Code: man dd
dd if=/dev/hda of=/dev/hdb |
Author: | ryanpatterson [ Sat Dec 02, 2006 7:40 am ] |
Post subject: | |
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. |
Author: | cesman [ Sat Dec 02, 2006 2:21 pm ] |
Post subject: | |
![]() |
Author: | ryanpatterson [ Sat Dec 02, 2006 5:06 pm ] |
Post subject: | |
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. |
Author: | abigailsweetashoney [ Tue Dec 05, 2006 1:47 pm ] |
Post subject: | |
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. |
Author: | abigailsweetashoney [ Tue Dec 05, 2006 1:48 pm ] |
Post subject: | |
Actually once you have a "copy" you could simply run "rsync" every night to update the copy. Fyi, Abs |
Author: | ryanpatterson [ Wed Dec 06, 2006 9:55 am ] |
Post subject: | |
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. |
Author: | bruce_s01 [ Thu Dec 07, 2006 7:24 am ] |
Post subject: | |
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. |
Author: | ed.gatzke [ Thu Dec 07, 2006 8:07 am ] |
Post subject: | Boot info?? |
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. |
Author: | ryanpatterson [ Thu Dec 07, 2006 8:27 am ] |
Post subject: | Re: Boot info?? |
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. |
Author: | cliffsjunk [ Fri Dec 08, 2006 12:05 pm ] |
Post subject: | |
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 ![]() 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 -- |
Author: | ryanpatterson [ Fri Dec 08, 2006 2:34 pm ] |
Post subject: | |
Thanks for the info. I'll check out that GPartEd CD. It sounds really powerful. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |