- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: tar command changed directory size
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
12-02-2003 11:00 AM
12-02-2003 11:00 AM
tar command changed directory size
I used command to move one directory from one box to another.
In box A
cd EN2001.1; tar -cvfh - . | remsh csihp08 "(cd /homes/boxB/EN2001.1; tar -xvf - .)"
The original size in boxA is
# du -sk EN2001.1
1723142 EN2001.1
After tar command, in boxB, the size got much bigger.
# du -sk EN2001.1
4501585 EN2001.1
Can you explain?
Jane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2003 11:11 AM
12-02-2003 11:11 AM
Re: tar command changed directory size
Sparse files are those with "holes" in them. For example, write 1 byte at offset 0 then seek to offset 1,000,000 and write 1 byte. You now have a file which occupies only 2 blocks but ls -l reports its size as 1MB. When a sparse file is copied the "missing" bytes are filled in with NUL's. More advanced backup like OmniBack or fbackup are able to preserve sparse files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2003 11:15 AM
12-02-2003 11:15 AM
Re: tar command changed directory size
I do not really want to go back to omniback tape to restore if I can do it online.
the big size difference is definitely not desired. Does tar command have any option to reduce the holes? I also need to preserve the symbolic links as well.
Thanks,
Jane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2003 11:30 AM
12-02-2003 11:30 AM
Re: tar command changed directory size
Vanilla tar or cpio cannot preserve sparse files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2003 01:27 PM
12-02-2003 01:27 PM
Re: tar command changed directory size
It is very important that 1723142 is NOT the true size of the file. If you use cp or tar or cpio or pax or dump, they will all create a copy that is 4501585 in size. This is the true size of the file and if this is a database file, the unoccupied space may eventually become occupied, eventually increasing the orginal file's size. It is very important to note that the file behaves exactly the same way whether the null records exist or not. To see this, use the cksum command on both files. You can also use the cmp command to compare the files. Other than the result from du, the files are truly identical.
It is very seldom the case that a backup then restore of a set files and directories will be the same size. A sparse file can make the copied result larger, but a sparse directory (a directory that once had thousands of files but they were deleted) when copied will be much smaller. This is normal behavior.
As far as symlinks, this can be quite complicated to resolve. A symlink is really just a string that contains the link. There is nothing truly connecting the symlink to a real file or path. So if you restore the link on another system, it may point to nothing. A hard link is just a directory entry that points to the same file and will always work when restored.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2003 05:24 PM
12-02-2003 05:24 PM
Re: tar command changed directory size
find EN2001.1 -type l -exec ls -lad {} ';'
Or, to get some more info
find EN2001.1 -type l | while read link
do
echo "`ls -lad $link` -> `ls -adlL $link' `du -sk $link`"
done
When you add up the results from the du's in the loop, they could very well add up to your difference, in which case the -h option of tar is the cause of your size difference. If not, the sparse file option could very well be the cause. In which case you have to look at the type of files and need to think about better ways to duplicate the data, for instance a dump and import.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 05:40 AM
12-03-2003 05:40 AM
Re: tar command changed directory size
Thanks you all, I will need to consider the other method to move the directory which contains symbolic links.
Jane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 05:49 AM
12-03-2003 05:49 AM
Re: tar command changed directory size
according to man pages tar does not follow links unless explicitly told so. Have you compared individuell file sizes? What about block size?
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2003 08:49 AM
12-03-2003 08:49 AM
Re: tar command changed directory size
Best regards...
Dietmar.