On Wed, Nov 07, 2012 at 10:40:39AM +0100, Tomas M wrote:
> > So, it seems aufs allocates some 'invisible' data on the tmpfs and never
> > frees it.
>
> That may be the xino file, which is stored on the first writable
> branch as a deleted file.
And it probably should not be created and live forever for each deleted file,
right?
Can I do anything about that 'xino file'?
>But then it would probably report its size on tmpfs alone as well, strange.
The blocks are reported by 'df' on the tmpfs under aufs. Not by 'df', but this
is
to be expected if the file is deleted.
As the file is not used in the user space, I was not able to see it with any
utility (like lsof).
When trying to make deleted files on the tmpfs (open a file, write to it,
delete, but not close; also: delete, mmap, close) no such space leak was found –
the space was recovered as soon as the file stopped being used by anything..
> Try to put the xino file on some other filesystem.
On a physical, ext4 file system the problem does not occur:
[root@test /tmp]# mkdir /mnt/rw
[root@test /tmp]# df /mnt/rw
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 248895 6259 229784 3% /mnt
[root@test /tmp]# mount -t aufs -n -o "br:/mnt/rw:/rootfs_ro/usr" none
"/tmp/mnt"
[root@test /tmp]# df /mnt ; du -skx /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 248895 6268 229775 3% /mnt
99 /mnt
[root@test /tmp]# dd if=/dev/zero of=/tmp/mnt/test bs=1024 count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.00773374 s, 13.2 MB/s
[root@test /tmp]# df /mnt ; du -skx /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 248895 6369 229674 3% /mnt
199 /mnt
One extra block used is being shown by 'df'…
[root@test /tmp]# rm /tmp/mnt/test
[root@test /tmp]# df /mnt ; du -skx /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 248895 6268 229775 3% /mnt
99 /mnt
…but it is freed when the file is removed.
[root@test /tmp]# dd if=/dev/zero of=/tmp/mnt/test bs=1024 count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.00292483 s, 35.0 MB/s
[root@test /tmp]# df /mnt ; du -skx /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 248895 6369 229674 3% /mnt
199 /mnt
[root@test /tmp]# rm /tmp/mnt/test
[root@test /tmp]# df /mnt ; du -skx /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 248895 6268 229775 3% /mnt
99 /mnt
No leak, even when the operations are repeated.
Unfortunately, I need aufs on a tmpfs – no physical writable file system may be
available on that system.
> Also try to remount the aufs like
> $ mount -o remount /tmp/mnt
> and try df again.
No change:
[root@test /tmp]# df /tmp/rw ; du -skx /tmp/rw
Filesystem 1K-blocks Used Available Use% Mounted on
none 252908 12 252896 1% /tmp/rw
0 /tmp/rw
[root@test /tmp]# df /tmp/rw ; du -skx /tmp/rw
[root@test /tmp]# dd if=/dev/zero of=/tmp/mnt/test bs=1024 count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.00160995 s, 63.6 MB/s
[root@test /tmp]# rm /tmp/mnt/test
[root@test /tmp]# dd if=/dev/zero of=/tmp/mnt/test bs=1024 count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.00271015 s, 37.8 MB/s
[root@test /tmp]# rm /tmp/mnt/test
[root@test /tmp]# df /tmp/rw ; du -skx /tmp/rw
Filesystem 1K-blocks Used Available Use% Mounted on
none 252908 20 252888 1% /tmp/rw
0 /tmp/rw
[root@test /tmp]# mount -o remount /tmp/mnt
[root@test /tmp]# df /tmp/rw ; du -skx /tmp/rw
Filesystem 1K-blocks Used Available Use% Mounted on
none 252908 20 252888 1% /tmp/rw
0 /tmp/rw
But unmounting and re-mounting the aufs does free the missing 8 blocks:
[root@test /tmp]# umount /tmp/mnt
[root@test /tmp]# mount -t aufs -n -o "br:/tmp/rw:/rootfs_ro/usr" none
"/tmp/mnt"
[root@test /tmp]# df /tmp/rw ; du -skx /tmp/rw
Filesystem 1K-blocks Used Available Use% Mounted on
none 252908 12 252896 1% /tmp/rw
0 /tmp/rw
But this is not even a usable work-around, as I won't be able to unmount a file
system which is in use.
Greets,
Jacek
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d