Re: how to clone a Linux hard disk?

From: Leon. (noemail_at_noemail.noemail.com)
Date: 12/30/03


Date: Wed, 31 Dec 2003 09:46:38 +1100


> I am a newbie to the Linux world (2 months). From my reading "dd" may work
> for this task as the next batch of computers we will work on all have the
> same model and size of hard disks. However, I understand 'dd' will not
work
> if either disk is mounted?

well, almost correct. if they are mounted read/write, they are liable to
have new data written and the data written would then be corrupt...

However if the read drive is mounted "read only", then that doesnt cause a
problem...

>
> Ideally what I would like is easy to use software that clones one HD at a
> time from a master, mounted HD using the MASTER-SLAVE EIDE cable
> arrangement (including MBR, lilo, etc.) without:
>
> 1) having to partition and format each new HD
> 2) unmounting the master HD
> 3) a long rigamaroule of CLI commands (except for perhaps an easy bash
> script)....

Well to do it just like that ...
-------------------------------------------
telinit 1
mount -o remount,ro / (and repeat for other partitions)
sync

dd if=/dev/hda of=/dev/hdb
sync
mount -o remount,rw /

------------------------------------------

Its only a few lines of CLI, and nothing wrong with a script.

just put the lines in a file called 'clonedrive' in /root/utils
and run '. /root/utils/clonedrive'.

Ah the new partitions wont be visible until you reboot...
OR you write a 'new' partition table to the drive.
So you check the partitions with '/sbin/fdisk /dev/hdb'
and then if its happy use 'wq' to write and quit from fdisk.
then the partitions on hdb would be accessable.

You could add 'shutdown -h now' to the script when you have decided that
the process works smoothly.

If you cant get the same hard drive model, you need to get a larger drive !
Be careful when you buy the hard drives , because drives of different
models that are sold as '60 gigabytes' are actually all sorts of sizes ..
between 55 and 65 gigabytes. You need to compare the actual size.

If you do get a larger drive that contains significant extra space (or you
just want to perfect this process) ,you can then reclaim the wasted space by
adding it to the last partition on the drive..

Run fdisk /dev/hdb , delete the last partition , and add it back to take up
the entire space. as the start of the partition is at the same place there
is no damage done to the partition...

Run the resize utility for the filesystem (eg e2resize of e2fs,e3fs ... )
you just have to read the manual page to see how to tell it to grow .. by
default it should grow to fill the available space...

> I have looked at "mondo" as a solution, but have not yet tried it. Does
> anyone have a good, easy suggestion to help us with our task? Will mondo
do
> this job?

there's a few others available free.
eg ranish partition manager.
it can clone drives .. but cant fix the larger hard drive problem.

>
> Larry Gagnon
> --
> ********************************
> to send direct email remove "fake"



Relevant Pages

  • Re: Dual Boot Instructions
    ... If "drive" means a single partition or logical drive, then the negatives you've heard are very true. ... But if "drive" means a physical hard disk drive, then I'm in big trouble because I have SIX versions of Windows installed on my 1 TB Disk 1, my second HDD! ... The name stuck when we added hard disk drives, ...
    (microsoft.public.windows.vista.hardware_devices)
  • Re: BootIt NG high level steps - best approach??
    ... backup boot strategy. ... As far as BING, I should tell you I've been using this software ... make managing your bootable options and partition management so much easier. ... drives) and the DATA partition on a mirrored array. ...
    (comp.sys.ibm.pc.hardware.storage)
  • Re: [opensuse] speaking of cloning....
    ... currently I use one Master WinXP image for Zenworks ... partition as users will have flash drives. ...
    (SuSE)
  • Re: Dual booting
    ... of Microsoft's dual boot scenario. ... The extended partition is not assigned a drive letter, ... BIOS reserves letters A and B for floppy drives, ... If WinXP Setup ...
    (microsoft.public.windowsxp.general)
  • Re: Dual Boot Instructions
    ... OS on a separate partition. ... the PHYSICAL DISK number, ... You should, at any one time, see ONE System Partition and ONE Boot ... The name stuck when we added hard disk drives, ...
    (microsoft.public.windows.vista.hardware_devices)