hard disk duplication
Are there any good hard disk duplicators/copiers available for Linux? I plan on transferring this install to a larger drive now that I got all the hardware working. Thanks.
|
Just use the dd command. Enter "man dd" at a shell prompt to get information.
|
Quote:
|
Quote:
|
Quote:
|
A few months back, I posted a complete session at The Motley Fool on using Knoppix and dd to scroll an entire XP system off of a failing HD in a laptop, then replace the laptop HD and scroll the image back. This session had me saving a complete Windows HD onto a series of files on a Linux box with ext3 file system, then put it all back.
Subsequently, a friend of mine picked up on that session and with my permission reposted it on his website, which is a Windows help site. Here is the link; you might find it interesting. http://www.williamaford.com/CloningaHDD.php Also, as a matter of routine, I use dd (in a cron job) to scroll my entire Linux system off to another HD as a backup. Here is the command string I use for that: Code:
dd if=/dev/sdc of=/mnt/sdb1/sysimg.img bs=512 skip=4193028 count=19824147 dd can do pretty much anything. |
Quote:
Cheers, Tink |
jiml8, how do you deal with size changing say from 6 gig to 80 gig? I'm a Linux newb, use to Win/DOS dups that do all the work for you when you upgrade to a bigger drive. Thanks.
|
Quote:
By specifying the entire disk, then specifying the skip and the number of blocks, I pick up every byte of the partition, including its boot record. I can then restore the whole thing if something happens. |
Quote:
The easiest way is to mount the new HD in the same box as the old HD, partition it, and just copy the stuff from the old drive and partition(s) to the new drive and partition(s). Then change the boot loader, change the fstab, and reboot. Another way (much harder) is to make an image of each partition as I showed (setting the right skip for the beginning of each one), then copy the partitions one by one to the new HD, starting with the MBR, then the first partition. After copying each partition on the drive, before placing the next partition on, you resize the partition you just copied using parted or fdisk, then you use a tool such as resize2fs to resize the file system on that partition. When you have completed this, you copy on the next partition, again resize using fdisk or parted, again resize the file system, and just keep on truckin'. This method is a lot harder because you have to keep track manually of where you are putting the partitions as you lay them down, and you have to make sure that you don't fdisk into overlapping partitions. |
Quote:
What I'd like to be able to do is, install the 2 drives at the same time on the same ide channel (as you said), duplicate the 6 to the 80. Then connect the 80 by itself and boot off that. I don't ever intend on having the 2 drives in at the same time other than during the duplication process. In this case, I would also create a third partition (or second if no swap) on the 80 free space for use. Sorry about all the questions, I'm use to doing this in DOS/Windows where it's basically a no-brainer. |
Quote:
Since you wish to remove the old HD when you are done, it is simple enough. Insert the 80 Gig drive and format/partition it as it suits you. Whether you need a swap file is a matter of considerable debate on this site; I personally would always use a swap file. Presently my system, which has 1 Gig of RAM, has all RAM in use and 394 Megs of Swap as well. Anyway, after formatting and partitioning the new drive, just copy everything from the old drive to the new drive. After you have done that, copy the MBR over using this command: Code:
dd if=/dev/hda of=/dev/hdb bs=512 count=1 Because you want to remove the old drive, you don't have to modify fstab or the boot loader. One comment; To avoid any troubles with an old BIOS in the computer you are upgrading, I think I might make a separate /boot/ partition at the very front of your new HD, then copy all the contents of /boot/ into it. I then would modify menu.lst in the /boot/grub directory to enable the system to transfer control to your root partition after booting. Specifically, with both drives in the system and hdb your big new drive, partition hdb1 to be maybe 30 Megs, and copy all of /boot/ into it. Then make a new partition hdb2 for swap. You pick the size; I would use 1 Gig. Then make another new partition hdb3 which fills the rest of the drive. Go to /hdb1/boot/grub/menu.lst and change it so that it says, for instance, Code:
kernel (hd0,1)/boot/vmlinuz root=/dev/hda3 ... You can determine how big /boot really needs to be by entering this command: Code:
du --max-depth=1 /boot If you are sure your BIOS is recent enough to handle large hard drives without trouble, then you don't have to worry about doing this. |
Oh, one further comment.
Since you are running mandrake, you don't have to fdisk everything. Just do it with diskdrake. |
jiml8, First of all, thank you for the info, the steps you described are exactly what I'm looking for, should be rather easy. As for my BIOS, currently, I have an 80 gig drive on this box that is a WinXP boot drive. My hardware, including motherboard is pretty new so there's no reason to be concerned about drive size. See, right now I have the 80 gig disconnected and the little 6 gig hooked up. I did this so I could play with Linux without messing up my WinXP boot (much data, games, bookmarks...you get the picture). Ultimately, I'm going to rig a hard switch so I can manually switch between the two drives. Yes, I know all about programs like boot commander, even Lilo or grub could handle a dual boot system if I'm not mistaken. I choose not to do it that way for reasons that shall remain out of this discussion. Anyway, thanks again for your help. I think I can pull this off with no problems. If I have anymore questions, I'll post back. BTW - I'm using the unbuntu Hoary distro, not Mandrake. Cheers.
|
All times are GMT -5. The time now is 12:32 AM. |