Copying a windows or linux install to a new hard disk using linux....
I've being searching around but haven't found the kind of simple solution I'm looking for...
Anyway, I'm fairly unix/linux savvy, but I've never worked some things out.
For example, say I have a windows install and want to copy the entire install with programs and everything to a new harddisk, I could format/partition the new hard disk and then copy all the files from the old ahrd disk to it...
But the new hard disk would not have a new MBR which would automatically boot windows, how could I fix this?
I can think of some things but don't know if they'll work, install grub onto the hard disk (and use its chainloader +1 option, will that work?). But then where will the grub files sit? I would need an ext2 partition or something where grub can live....(right?).
Or copy the MBR from the old hard disk to the new harddisk, using say dd...
Or is there a way to copy the entire partition across to the new hard disk and resize it (ie. if the partition table was copied its going to be sized wrong isn't it)?
These questions would be quite identical for a linux based system, I could boot say using knoppix and have both hard disks recognised and do things that way....
I apologise if this has being asked but after 40mins of searching I couldn't find anything.
Please respond if you have some ideas,
Also note: I'm aiming to do this with free software...
copying a linux partition to a new hd should be no problem (when using lilo).
* start your computer from a rescue disk (or a second linux installation, when available)
* mount your partitions to something like /old-part/ and /new-part/
* copy the root directory with:
# cp -r --preserve /old-part/./ /new-part/
* edit /new-part/etc/lilo.conf and /new-part/etc/fstab according to your hd/partition layout
# /new-part/sbin/lilo -r /new-part/
This will write lilo to the mbr of your new hd.
When using grub, copying the first 446 bytes (=the boot loader code of your old hd, not the complete mbr (=512 byte, which contains the partition table) with dd to your new hd may work.
To save the complete mbr of /dev/hdx:
# dd if=/dev/hdx of=/path/mbr-backup bs=512 count=1
To restore the first 446 byte (boot loader code) to hdy:
# dd if=/path/mbr-backup of=/dev/hdy bs=446 count=1
Definitely an interesting idea, thanks a lot of that.
Now another question, what if it was a pure windows box (ie. no linux).
Would the copy the first 446 bytes work?
Or would I need to install a bootloader and create a partition for it?
With windows, there is no need for dd,... To write a new (windows) mbr, simply do the following:
Use a DOS Bootfloppy or a Windows 9x/ME Start Disk and type at the prompt:
A:\> fdisk /MBR
Or, use the Windows 2000/XP CD-Rom to start the computer. At the "Welcome to Setup" screen, press <F10> or press <R> to repair, and start the Windows Recovery Console.
Use the fixmbr command to replace the master boot record. This will leave the existing partition table intact.
But if the registry is raw data, wouldn't copy work?
Or does the position of the data mattter?
Thanks a lot for the help so far.
I know there are a lot of commercial tools for copying windows to a new hard disk, but I'm not quite sure how they work (trying to work out if I can do it simply, without buying software).
Also the linux thing was curiosity, now I know that its possible, thanks! :)
I have read this in a computer magazine, but I can't say if it is correct. Some of the files, where the position of the data matters, are MSDOS.SYS and IO.SYS.
But, if a simple "copy" would work, what about all those commercial "data rescuing programz"?
And that's another reason for me why to use linux: there is no need for commercial programz.
I'm not sure if this is what you need but it's probably worth a look.
Certainly looks intersting.
Thanks a lot for that, yes I guess copy wouldn't pay attention to the way it writes the data, while something like DD would.
But DD might get messy, I was just checking that there wasn't a really simple solution to this....
(cos often linux does have solution's where it takes commercial programs in windows).
Thanks for the help.
That partimage looks useful.
|All times are GMT -5. The time now is 10:47 PM.|