Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Maybe it is a "sparse file". You can find a definition on the Wikipedia. A common example on many systems is the file /var/log/lastlog
Code:
$ ls -l /var/log/lastlog
-rw-r--r-- 1 root tty 292584 2008-01-06 12:11 /var/log/lastlog
$ du /var/log/lastlog
28 /var/log/lastlog
You can also try the following test using the command find: cd to the directory where the file is stored, then do
Code:
# the following will print the allocated (total) space
find . -name disk.vdi -printf "%s\n"
# the following will print the actual size if sparse
find . -name disk.vdi -printf "%k\n"
Maybe it is a "sparse file". You can find a definition on the Wikipedia. ...
That's totally it, thanks. I'm currently copying the file (over USB 1) around with 'cp -ax' and I'm glad that cp supports sparse files (saved quite some time ).
Code:
$ ls -lh disk.vdi
-rw------- 1 fr fr 8.1G 2007-08-29 15:53 disk.vdi
$ du -h disk.vdi
4.2G disk.vdi
I don't know any other *NIX utility to do that. On the other hand you can always use a programming language like C or Python. Here is a simple example in Python
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.