[SOLVED] df and du give different results on DVD filesystem
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
df and du give different results on DVD filesystem
On debian 7.5,
Code:
$ mount /dev/sr0 /DVD
$ df -h /DVD
Filesystem Size Used Avail Capacity Mounted on
/dev/sr0 6.8G 6.8G 0 100% /DVD
$ du -h /DVD
25G /DVD/VIDEO_TS
25G /DVD
$ grep DVD /etc/fstab
/dev/sr0 /DVD iso9660 ro,noexec,user,nodev 1 2
$
The disc is a recent commercial dual layer video DVD (Jack Ryan: Shadow Recruit), not a Blu-Ray. It plays properly; I just don't see why du gives such a different size to df - in fact, it seems to be almost 4 times what the DVD can hold.
$ mount /dev/sr0 /DVD
$ df -h /DVD
Filesystem Size Used Avail Capacity Mounted on
/dev/sr0 6.8G 6.8G 0 100% /DVD
$ du -h /DVD
25G /DVD/VIDEO_TS
25G /DVD
$ grep DVD /etc/fstab
/dev/sr0 /DVD iso9660 ro,noexec,user,nodev 1 2
$
The disc is a recent commercial dual layer video DVD (Jack Ryan: Shadow Recruit), not a Blu-Ray. It plays properly; I just don't see why du gives such a different size to df - in fact, it seems to be almost 4 times what the DVD can hold.
Can anyone explain the difference?
it's important to know that du works on a file level, while df works on a file system level. In other words, du examines the directory entries and considers the size of all the files listed in it, while df just looks at the control structures of the file system, which only partially makes sense for ISO9660 - at least this file system has no free blocks by definition.
And what you see is obviously a bad trick used by some DVD producers: They deliberately produce weird directory structures, for instance by referencing the same file multiple times (very much like hard-linking) or by creating bogus directory entries that do not reference a valid file at all but pretend gigabytes of data. Try a 'ls -la /DVD/VIDEO_TS' to see what I mean.
The only purpose I can think of is probably to discourage people from ripping the DVD contents, or to make it harder for them anyway.
The first DVD where I encountered this trickery was Wall-E, which seemed to have over 60GB of data ...
This directory scrambling of DVDs has been around for years. It is a copy protection scheme.
that's what I said.
However, as a copy protection method it is pointless, because assuming you beat CSS and these other little tricks, you can always rip the DVD into an ISO file - and suddenly you don't have to bother about this file system shit.
it's important to know that du works on a file level, while df works on a file system level. In other words, du examines the directory entries and considers the size of all the files listed in it, while df just looks at the control structures of the file system, which only partially makes sense for ISO9660 - at least this file system has no free blocks by definition.
And what you see is obviously a bad trick used by some DVD producers: They deliberately produce weird directory structures, for instance by referencing the same file multiple times (very much like hard-linking) or by creating bogus directory entries that do not reference a valid file at all but pretend gigabytes of data. Try a 'ls -la /DVD/VIDEO_TS' to see what I mean.
The only purpose I can think of is probably to discourage people from ripping the DVD contents, or to make it harder for them anyway.
The first DVD where I encountered this trickery was Wall-E, which seemed to have over 60GB of data ...
[X] Doc CPU
This turned out to be the answer. I compared some of the files in the VIDEO_TS subdir, and, of 86 files, 38 were identical to at least five others. I ripped the DVD (I find it amusing that the very things done to discourage ripping actually encourage it) and replaced the copies with symbolic links. Playing the copy works as it should.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.