Why not mirror the partitions ?
Or 
If solaris. Ufsdump 0cf - <filesystem> |(cd <new filesys>;ufsrestore -xf -)


Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: Steve Bertrand <st...@ibctech.ca>

Date: Mon, 28 Sep 2009 22:50:55 
To: xufengnju<xufeng...@sina.com>
Cc: beginners<beginners@perl.org>
Subject: Re: how to do a `cp` on millions of files


xufengnju wrote:
> Hi all,
> I have a storage server that holds one million of images with well structured 
> directory structure such as
> 
> /data/user1/2008/09/12/image1.jpg
> /data/user1/2008/09/12/image2.jpg
> ...
> /data/user2/2009/01/01/image1.jpg
> ...
> 
> I want to copy them to the /data2 directory in the same server on another 
> disk partion.
> I want to keep the directory structure and `chown` && `chmod` the directories 
> and files,much like doing a `cp -rf /data /data2 && chown -R sysuser:sysuser 
> /data2 && chmod -R 755 /data2`.
> 
> File::Find maybe an option.
> Is there somebody who have some suggestions?
> 
> If I do a `cp -rf /data /data2 && chown -R sysuser:sysuser /data2 && chmod -R 
> 755 /data2`,how much time maybe taken to finish the job?(The images are about 
> one million in count and 250GB in size totally).

Perhaps I am missing something completely obvious. If not:

Why-oh-why do you want to use Perl do perform such a task?

Use dump/restore (which I can't recall a cli sequence for off the top of
my head), or rsync:

# mount the new disk into /mnt/data, then:

% rsync -arcvv /data /mnt/data &

...owns/perms will be copied. The '&' will ensure that the process will
continue if your term session breaks mid-stream.

Steve

Reply via email to