- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: The best method for duplicating/coping a file ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:06 PM
01-21-2003 10:06 PM
The best method for duplicating/coping a file system onto another
this question has always been pestering my mind.
What is the best and efficient way of copying a whole file system to another one - both found on the same server.
For example, i have the following setup where all the files in /d02 should be copied/moved to /d01:
SLX2:>bdf /d01 /d02
Filesystem kbytes used avail %used Mounted on
/dev/vgappinst/lv_appinst 20963328 3472 20632368 0% /d01
/dev/vg02/lvol1 17776640 11557928 6121600 65% /d02
SLX2:>
Possible options: (i hope i don't miss any of them)
a. cp -p -R /d02 /d012
b. cd /d01; tar -cvf D02.TAR /d02 then tar -xvf D02.TAR
c. cd /d02; find . -depth -print | cpio -pd /d01
d. dd if=/dev/vg02/lvol1 of=/dev/vgappinst/lv_appinst (??)
e. Backup/Restore using omniback
Which one gives the best performance?
Thank you for your replies.
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:12 PM
01-21-2003 10:12 PM
Re: The best method for duplicating/coping a file system onto another
Rajeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:20 PM
01-21-2003 10:20 PM
Re: The best method for duplicating/coping a file system onto another
In such situations i always opt for dd, which is faster than tar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:20 PM
01-21-2003 10:20 PM
Re: The best method for duplicating/coping a file system onto another
I feel cpio and dd is the fastest method than other options. I have to check this thread for more options if anybody have better options.
mirroring is one option but you have 2 diff vg's :(.
Srini.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:32 PM
01-21-2003 10:32 PM
Re: The best method for duplicating/coping a file system onto another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:33 PM
01-21-2003 10:33 PM
Re: The best method for duplicating/coping a file system onto another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:36 PM
01-21-2003 10:36 PM
Re: The best method for duplicating/coping a file system onto another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:41 PM
01-21-2003 10:41 PM
Re: The best method for duplicating/coping a file system onto another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:45 PM
01-21-2003 10:45 PM
Re: The best method for duplicating/coping a file system onto another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 10:51 PM
01-21-2003 10:51 PM
Re: The best method for duplicating/coping a file system onto another
create new filesystem and mount on say /new
# cd /oldfilesystem
# find . -xdev -print | cpio -pdumv /new
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2003 11:01 PM
01-21-2003 11:01 PM
Re: The best method for duplicating/coping a file system onto another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 01:01 AM
01-22-2003 01:01 AM
Re: The best method for duplicating/coping a file system onto another
dd is a possibility but there are a few things to be aware of:-
- both filesystems should be unmounted before running dd.
- both logical volumes ought to be the same size. If the target is larger then you can extendfs after dd.
- dd will copy ALL the data, not just the files in use so it may be slower if the filesystem isn't full.
One other possibility is to pipe vxdump into vxrestore (see the man pages).
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 01:12 AM
01-22-2003 01:12 AM
Re: The best method for duplicating/coping a file system onto another
If the filesystems is very large and you have fast tape devices (LTO) I would suggest using OmniBack rawdisk backup/restore. In other cases I always use find ... |cpio ... .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 01:50 AM
01-22-2003 01:50 AM
Re: The best method for duplicating/coping a file system onto another
I guess in my case, the only plausible options are:
1. cpio
2. Omniback backup/restore
dd option is a bit more complicated, as i already doubted it, because of the difference in sizes of the LVs as John mentioned.
The cpio option does not seem to be working properly:
---------------------------------------------------------------------
SLX2:d02>find . -depth -print | cpio -pd /d01
22357001 blocks
[took about 20 mins!!]
SLX2:d02>bdf /d01 /d02
Filesystem kbytes used avail %used Mounted on
/dev/vgappinst/lv_appinst 20963328 11565664 9250880 56% /d01
/dev/vg02/lvol1 17776640 11557928 6121600 65% /d02
SLX2:d02>cd /d01
SLX2:d01>ls
lost+found product
SLX2:d01>ll
total 0
drwxr-xr-x 2 root root 96 Jan 21 09:44 lost+found
drwxrwxr-x 5 ias902 oinstall 96 Jan 22 11:02 product
SLX2:d01>ll lost*
total 0
SLX2:d01>du -sk product
11523064 product
SLX2:d01>cd ../d02
SLX2:d02>du -sk product
11515516 product
SLX2:d02>
---------------------------------------------------------------------
The target (11523064) and the source (11515516) sizes do not match after the execution of the command.
Will now attempt the omniback option.
Will update this as soon as completed.
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 03:24 AM
01-22-2003 03:24 AM
Re: The best method for duplicating/coping a file system onto another
My standard answer would be dd piped to cpio but I have, on occasion, run into errors. In those cases I resort to the omniback method. If you already have the backup, it's relatively quick and it's definitely foolproof.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 03:53 AM
01-22-2003 03:53 AM
Re: The best method for duplicating/coping a file system onto another
The difference in size reported by du can usually be attributed to directory sizes although I would have expected the source to be larger than the target.
I reckon your cpio copy was OK and expect that you'll get similar du results after your restore.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 04:52 AM
01-22-2003 04:52 AM
Re: The best method for duplicating/coping a file system onto another
Yogeeraj,
I just did a quick test, and I found "cp -Rp" to be faster and consume less resources:
# time cp -rp * /dbf4
real 4:32.3
user 0.1
sys 35.3
# time find . -xdev -print | time cpio -pdumv /dbf4
real 0.0
user 0.0
sys 0.0
/dbf4/DB2003-1PGN.ZIP
/dbf4/DB2003-1.pgn
/dbf4/unzipped.pgn
5249489 blocks
real 4:54.2
user 1.5
sys 43.3
# ll
total 5249522
-rw-rw-rw- 1 root sys 74481664 Dec 30 00:57 DB2003-1.pgn
-rw-r----- 1 root sys 558082162 Dec 30 16:46 DB2003-1PGN.ZIP
drwxr-xr-x 2 root root 96 Aug 14 2001 lost+found
-rw-rw-rw- 1 root sys 2055174021 Dec 30 16:54 unzipped.pgn
#
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 05:01 AM
01-22-2003 05:01 AM
Re: The best method for duplicating/coping a file system onto another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2003 05:10 AM
01-22-2003 05:10 AM
Re: The best method for duplicating/coping a file system onto another
While 'cp' may be faster than 'cpio', the later has the advantage that file creation timestamps can be preserved. My preference is to use 'cpio' to copy while filesystems in the original question's context.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2003 07:26 AM
01-23-2003 07:26 AM
Re: The best method for duplicating/coping a file system onto another
See following example:
# touch text
# ll text
-rw-rw-rw- 1 root sys 0 Jan 23 16:09 text
# chown www:sys text
# cp text text1
# ll text*
-rw-rw-rw- 1 www sys 0 Jan 23 16:09 text
-rw-rw-rw- 1 root sys 0 Jan 23 16:10 text1
So if you choose a copy method (dd,cpio,tar,cp ...etc)
for your lvol copy think about your permissions.
Roland
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2003 05:20 PM
01-23-2003 05:20 PM
Re: The best method for duplicating/coping a file system onto another
As far as the size difference between the source and destination, *only* dd will preserve the disk usage. Anything that reads the files and copies them to a new location will cause the total usage to be larger or smaller than the original.
Here's why:
Smaller disk usage:
When lots of files are added to a directory (which itself is a file), the directory is increased in size to accomodate all the new names. However, if you add 10,000 files to a directry and then remove them, the directory does NOT shrink. It remains the same with just a bunch of empty entries. When the directory is 'copied', it is actually created as a 96 byte file and then increased in sized if needed. Lots of directories that used to have lots of files will be recreated much smaller than the source.
Larger disk usage:
Two words: sparse files. A sparse file is one in which a few random records (perhaps the first and the 10,000th) are written and then closed. The occupied space is two records but read the file serially (as happens in a backup or copy) and the filesystem fills in the all the missing records with zeros. Databases are commonly created as sparse files. So when the file is copied, it will be much larger. Create your own sparse file with:
dd if=/etc/issue of=/var/tmp/sparse bs=2048k seek=1
where you will see the original file is just a few dozen bytes, the result with ls -l or wc -c shows a 2 meg file, but du will show the file as occupying just a bit more than the original /etc/issue file. A cp of the file will create a new file that is the same size (using ls -l or wc -c) but du will now show a MUCH larger size than the original file.
Another common file that is often sparse is a core file from a crashed program. cp the core file and it is often larger than the original.
Bill Hassell, sysadmin