Operating System - HP-UX
1754886 Members
3946 Online
108827 Solutions
New Discussion юеВ

copy a filesystem best solution (local host or remote host)

 
SOLVED
Go to solution
Billa-User
Regular Advisor

Re: copy a filesystem best solution (local host or remote host)

@ OK - The count of files and subdirs looks OK - Still, just do a df -i.

thx, i added to my checks
Billa-User
Regular Advisor

Re: copy a filesystem best solution (local host or remote host)

hello,

are those commands ok for remote copy ?

cd /old_fs

local :
pax -r -w -pe . /new_fs

remote : ?
pax -w . | ssh server " ( cd /new_fs ; pax -r -pe )"

local :
vxdump 0f - /old_fs | (cd /new_fs ; vxrestore xf -)

remote : ?
vxdump 0f - /old_fs | ssh server "(cd /new_fs ; vxrestore xf -) "
chris huys_4
Honored Contributor

Re: copy a filesystem best solution (local host or remote host)

tss...

vxvm with diskgroup split and join, thin provisioning luns and smartmove functionality, should beat the dd time easily.

and cost shouldnt be an issue as the tests were done on a xp10k. ;)

Greetz,
Chris
Michael Steele_2
Honored Contributor

Re: copy a filesystem best solution (local host or remote host)

rsync --progress -avh /source/ user@/dest/
-or-
cp -p -r /source /dest
-then-
df -i /source /dest

The df -k command is just like bdf - you get a report in bytes utilized.

When you write a script counting files and sub directories you are in essence counting inodes. So use the df -i command which does the counting for you and verify success when the /source inode total = the /dest inode total.
Support Fatherhood - Stop Family Law
Billa-User
Regular Advisor

Re: copy a filesystem best solution (local host or remote host)

@ vxdump remote

first command doesn't work,
second comand point out errors, but works ....

cd /old_fs

/usr/sbin/vxdump -0f - /old_fs | ssh host '( cd /new_fs ; /usr/sbin/vxrestore -xf - )'

vxfs vxdump: Date of this level 0 dump: Wed May 18 10:42:49 2011
vxfs vxdump: Date of last level 0 dump: the epoch
Dumping /dev/vgfs/rold_fs to stdout
vxfs vxdump: mapping (Pass I) [regular files]
UX:vxfs vxrestore: ERROR: V-3-20068: cannot open /dev/tty: No such device or address
vxfs vxdump: mapping (Pass II) [directories]
vxfs vxdump: estimated 1948264 blocks (951.30MB) on 6.33 tape(s).

cd /old_fs
/usr/sbin/vxdump -0 -f - -s 1000000 -b 16 /old_fs | ssh host '(cd /new_fs; /usr/sbin/vxrestore -rf -) '

UX:vxfs vxrestore: ERROR: V-3-20068: cannot open /dev/tty: No such device or address
vxfs vxdump: Date of this level 0 dump: Wed May 18 10:45:29 2011
vxfs vxdump: Date of last level 0 dump: the epoch
Dumping o stdout
vxfs vxdump: mapping (Pass I) [regular files]
vxfs vxdump: mapping (Pass II) [directories]
Billa-User
Regular Advisor

Re: copy a filesystem best solution (local host or remote host)

my last question, then i am ready with my script:

@ OK - The count of files and subdirs looks OK - Still, just do a df -i.

1) i got an input : is md5sum a way to check two filesystems ?

i tested it and it seems ok:

/usr/bin/md5sum /old_fs
b0292b7e9f9439d25be786f99b22587d /old_fs

/usr/bin/md5sum /io_dst_test
b0292b7e9f9439d25be786f99b22587d /new_fs

when i made a change, the fingerprint changes !

2) when i want to log for example "cpio" output in another logfile in a shell script, this is the only way ?

exec 3>> /tmp/logfile

find . ! -path ./lost+found -depth -print | cpio -padlmuv 1>&3 2>&3 >&3

regards
Bill Hassell
Honored Contributor

Re: copy a filesystem best solution (local host or remote host)

> 1) i got an input : is md5sum a way to check two filesystems ?
> i tested it and it seems ok:

> /usr/bin/md5sum /old_fs
b0292b7e9f9439d25be786f99b22587d /old_fs

> /usr/bin/md5sum /io_dst_test
b0292b7e9f9439d25be786f99b22587d /new_fs

> when i made a change, the fingerprint changes !

What you are doing is creating a unique number (a checksum) from the information in the directory. The directory has a list of pointers to inodes and a set of names. Add, delete or change a file in the old_fs directory and the checksum will change. But add, delete or change a file in a subdirectory (/old_fs/testing direcory) and the top level directory (/old_fs) is the same.


Bill Hassell, sysadmin
Michael Steele_2
Honored Contributor

Re: copy a filesystem best solution (local host or remote host)

"...when i want to log for example "cpio" output in another logfile in a shell script, this is the only way ?..."

There seems to be a gap in you knowledge about inodes; there are always 4 - 0, 1, 2,and a pointer to the disk address. 0, 1 and 2 are also known as STDIN, STDOUT and STDERR.

When you do a :

exec 3 > /tmp/file

You are over riding the OS and manually assigning STDOUT. When you want to do this I'm sure its fine but also unnecessary and confusing to the next person who comes along and maintains your work after you leave.

The standard in the industry is STDOUT = 1. For example, I'm sure you've seen this:

cat file > logfile 2>%1

What does this mean?
Support Fatherhood - Stop Family Law
Bob_Vance
Esteemed Contributor

Re: copy a filesystem best solution (local host or remote host)

@ Michael

Did you mean 2>&1 ?


bv
"The lyf so short, the craft so long to lerne." - Chaucer
Michael Steele_2
Honored Contributor

Re: copy a filesystem best solution (local host or remote host)

@ Bob

Yes, thanks!
Support Fatherhood - Stop Family Law