Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-27-2010, 11:16 AM   #1
Registered: Mar 2009
Posts: 41

Rep: Reputation: 15
Smile Different file size after copy

Firstly, I did perform a search on this problem in these forums, but didn't quite get what I was looking for. So I hope I don't yelled at for making a duplicate post.

So I used rsync to backup my webroot to another nix machine. du -hs gave me 1.3 G on the source machine and 1.1 G on the backup machine. I tried to compare the individual files and noticed a trend. The files on backup machine were always smaller than the files on source machine.

The source uses SATA drive, destination uses IDE. So this time I rsynced locally to another folder on the source machine. Same size anomaly. So i did a simple cp file ~/file and same size anomaly. So it's not a rsync issue.

I took a file and ran md5sum on both, the source file and destination file. To my surprise, even though the file size was different, they had the same md5sum.

Now, let it be known that the source machine is a production server and the dir i rsynced was being used, serving pages to the web. I googled about this and came up with stuff like open descriptors and holes. I don't understand this stuff and was wondering if this was really the case. What are those if it is the case? And my backup copy is 100% identical right? There are thousands of files and I ran md5sum only on couple. Can I take comfort that when time comes, I can restore using my backup without any problems?

Thanks a lot in advance.
Old 02-27-2010, 12:17 PM   #2
Senior Member
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Take a look at the --apparent-size option on du. See if running du with that gives you the same values on both machines.

Also try using stat on some of the files on each machine to see what block size is reported and how many blocks they are using.

mike@continuity:~$ stat /etc/bash.bashrc  | grep Block
  Size: 8577      	Blocks: 24         IO Block: 4096   regular file
Old 02-27-2010, 01:46 PM   #3
Registered: Nov 2008
Distribution: Linux Mint
Posts: 56

Rep: Reputation: 17

I'm not sure about the exact problem here, but I have read of having problems estimating drive size from the shell in certain situations. (Something about some readings being approximate).

If you get the same md5 for each I wouldn't worry. You might want to open one or two files to make sure they do what you wanted them to do-and I wouldn't worry about it.
Old 02-27-2010, 02:33 PM   #4
Registered: Mar 2009
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks arizonagroovejet. Here is the output:

Source / Destination on same machine, so the question of different hardware, such as hard disk doesn't arise.

[root@peweb1 modules]# stat | grep Blocks
Size: 4593 Blocks: 24 IO Block: 4096 regular file

[root@peweb1 modules]# stat | grep Blocks
Size: 4593 Blocks: 16 IO Block: 4096 regular file

[root@peweb1 www]# du -hs
1.3G .

[root@peweb1 www1]# du -hs
1.1G .

[root@peweb1 www]# du --apparent-size -hs
987M .

[root@peweb1 www1]# du --apparent-size -hs
986M .

Ouch... so close... now only if they weren't off by 1MB. But yeah, pretty close... what do you think happened to the 1MB?

BeacoN, thanks, but I can't test the the files from functionality perspective, because the files are php files and are part of the entire source code for an e-commerce site.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dd copy; destination drive size wheelsg Linux - Hardware 5 11-11-2008 12:21 PM
ReiserFS 2Gb maximum file size limit? Cannot copy files bigger than 2Gb ihtus SUSE / openSUSE 2 10-26-2007 09:21 AM
any ideas to reduce log file size or make log file size managed? George2 Programming 2 08-13-2006 06:55 AM
"File size limit exceeded" during copy h3xis Linux - Networking 2 06-17-2006 01:24 PM
file system size larger than fysical size:superblock or partition table corrupt klizon Linux - General 0 06-18-2004 04:18 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration