Michael Kraus wrote:
G'day all..
I've a Win95 HD (from another machine) that I'm wanting to back up, and I've placed it into a Linux box.
Now, when I mount the vfat filesystem and copy it to a directory on the ext3 filesystem (using `cp -a <src> <dest>`) all seems to go well.
However - `du -h <vfat partition>` reports 3.1G being used whilst `du -h <ext3 copy directory>` reports that there is 3.0G being used.
Did something fail to copy or is this difference due to filesystem differences?
Thanks...


Mike

Hi Mike,

First of all, you're more likely to make friends if you don't post to this list in anything other than plain text. HTML and MS-RTF formatted e-mail is a no-no :) Ta.

Now as for your question about ext3 versus vfat (or FAT32), I think what you are seeing is simply the result of different block sizes on the two file systems. FAT32 usually has around 4kb/block whereas ext3 usually has 512bytes/block (ie, 0.5kb). This is significant, because only ONE file can occupy a single block so if you have a lot of small files on FAT32, each one will occupy at least 4kb, even if it's 1byte long. The same 1byte file on ext3 will only occupy 512bytes, a saving of about 75% :)

Even if your files are bigger than 4kb, unless they fit exactly into 4kb boundaries, you get wastage. Consider a file 8193bytes long, that's 2x4kb blocks, plus 1 byte....that one byte has to occupy a single block. So your 8kb+1 file actually takes up 12kb. The same file on ext3 (512byte blocks) would be 17 blocks = 8.5kb :) See how it works?

The bigger the files, the less the block size is a problem, but on 3Gb, 100Mb difference wouldn't be uncommon. If you're still concerned, use "tar" instead of "cp" and turn the verify option on. Something like this is a good start:
cd <source> ; tar -cvfW <dest>/backup.tar


Then if you want to extract the backup at the destination:
cd <dest> ; tar -xvfW backup.tar

NOTE: you can't use "verify" (-W) option with tar when using STDIN/STDOUT - you have to be working with a tar file. In other words, you can't do it in one step like this:
cd <dest> ; tar -cW <source> | tar -xW ### NO! NO! THIS WONT WORK!! ##


Hope all this make sense :)

Cheers,

James
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to