Tool for semi-cloning a hard drive: recommendations?

John Summerfield debian at herakles.homelinux.org
Fri Jan 11 22:29:56 UTC 2008


Phil Meyer wrote:
> 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
You want NULs in there, use -print0 and something extra on cpio


> 
> 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

Shouldn't be doing it on the running system.


> 
> 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. :)


Not very well, if that's really what you do. Files and directories with 
spaces in their names cause problems.

I personally have used tar many times, but I've heard there are problems 
with extended attributes....

EAs are a recent innovation to Linux (though OS/2 had them for donkey's 
years).

As I posted to another thread yesterday, copying with tar, cpio, pax, cp 
and the like resets ctime, and this is bad.


I prefer judicious use of dd where the target is larger, followed by 
whatever filesystem/LVM resize magic is required.


OP could also look at systemimager, it is designed to clone systems with 
customisation. I've not used it myself, but I've heard good of it.


-- 

Cheers
John

-- spambait
1aaaaaaa at coco.merseine.nu  Z1aaaaaaa at coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)




More information about the fedora-list mailing list