Tool for semi-cloning a hard drive: recommendations?

Phil Meyer pmeyer at themeyerfarm.com
Fri Jan 11 18:52:50 UTC 2008


Dan Thurman wrote:
> Is there a [Fedora/Linux] clone/partition tool that will clone a hard drive 
> with features that allows one to specify any partition size to the target new 
> drive?  For example, the original drive may have a partition with a size of 
> say, 10GB and instead of a direct clone, I'd like to specify a larger target 
> partition size of say, an increase of 25GB?
>
> As a feature, I'd also like the capability if need be, to be able to change 
> the source drive's partition sizes and to be able to move partitions around 
> so as close partition gaps?  System Commander was such a tool for windoes but 
> is there one for Fedora/Linux?
>
> Any suggestions?
>   

Copying the contents of one drive to another is as simple as:

cp -a <source> <target>

Or there is the most correct way:

cd <source>

find . -depth -print | cpio -pdmu <target>

If both file systems are LVM or hardware raid, then that solves the 
other part of your question.

But lets look at a specific example since you did not provide one:

Lets assume that /var keeps filling up and its currently on / which is a 
fixed partition.
You have hardware based raid from a SAN or new shoebox.

Use whatever tools are appropriate to create <new volume>.

Mount the new raid device on /mnt

mount <new volume> /mnt

Quiesce applications

cd /var
find . -depth -print | cpio -pdmu /mnt

umount /mnt ; mv  /var  /foo ; mkdir /var ; mount <new volume> /var

revise /etc/fstab to correct the new /var

restart apps or reboot

rm -fr /foo

You need to MOVE /var because there will surely be something running 
with a file open in /var

You need to be quick making the changeover to the new /var, thus the 
commands all on the same command line.

Don't remove the old /var until you are positive that all apps that use 
/var have been restarted.  Sometimes a reboot will be necessary.  If 
unsure, reboot.

Tried and tested many times. :)

Good Luck!





More information about the fedora-list mailing list