Kurt Jaeger
2007-Aug-12 12:24 UTC
Patch for FreeBSD 6.2 fstat(1) to support unionfs (at least a little bit)
Hi! fstat(1) from FreeBSD 6.2 can not display information about files which reside in a unionfs[1], as can be seen in this example[2]: USER CMD PID FD MOUNT INUM MODE SZ|DV R/W pi less 31028 root - - ?(unionfs) - pi less 31028 wd - - ?(unionfs) - pi less 31028 jail - - ?(unionfs) - pi less 31028 text - - ?(unionfs) - pi less 31028 0 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 1 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 2 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 3 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 r pi less 31028 4 - - ?(unionfs) - This patch[3] fixes it, as can be seen in this other example[4]: USER CMD PID FD MOUNT INUM MODE SZ|DV R/W pi less 31028 root /vserv/vserv3.nepustil.net 4804764 drwxrwxr-x 512 r unionupper /usr pi less 31028 wd /vserv/vserv3.nepustil.net 5042109 drwx------ 1536 r unionupper /usr pi less 31028 jail /vserv/vserv3.nepustil.net 4804764 drwxrwxr-x 512 r unionupper /usr pi less 31028 text /vserv/vserv3.nepustil.net 5159119 -r-xr-xr-x 109300 r unionlower /usr pi less 31028 0 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 1 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 2 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 3 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 r pi less 31028 4 /vserv/vserv3.nepustil.net 5042526 -rw------- 702 r unionupper /usr The filesytems involved: f6# df [...] Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad0s1e 43938150 20634736 19788362 51% /usr [...] <below>:/vserv/template/stage2 87876300 64572886 19788362 77% /vserv/vserv3.nepustil.net devfs 1 1 0 100% /vserv/vserv3.nepustil.net/dev [...] were mounted with the following command: /sbin/mount -t unionfs -o noatime,below,copymode=transparent /vserv/template/stage2 /vserv/vserv3.nepustil.net /sbin/mount_devfs devfs /vserv/vserv3.nepustil.net How to apply: cd /tmp/ fetch http://c0mplx.org/src/fstat-unionfs-patch/patch-20070812 cd /usr patch < /tmp/patch-20070812 cd /usr/src/usr.bin/fstat/ make install TODO: support other filesystems besides UFS as lower filesystems [1] http://people.freebsd.org/~daichi/unionfs/ [2] http://c0mplx.org/src/fstat-unionfs-patch/before [3] http://c0mplx.org/src/fstat-unionfs-patch/patch-20070812 [4] http://c0mplx.org/src/fstat-unionfs-patch/after See also: http://c0mplx.org/src/fstat-unionfs-patch/ -- pi@c0mplx.org +49 171 3101372 13 years to go !