Gaëtan Lehmann
2009-Dec-21 16:48 UTC
[zfs-discuss] directory size on compressed file system on Solaris 10
Hi, On opensolaris, I use du with the -b option to get the uncompressed size of a directory): root at opensolaris:~# du -sh /usr/local/ 399M /usr/local/ root at opensolaris:~# du -sbh /usr/local/ 915M /usr/local/ root at opensolaris:~# zfs list -o space,refer,ratio,compress data/local NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD REFER RATIO COMPRESS data/local 228G 643M 249M 394M 0 0 394M 2.51x on root at opensolaris:~# which du /usr/gnu/bin/du but on Solaris 10, there is no such option. So what is the best way to get the uncompressed size of a directory on Solaris 10? Regards, Ga?tan -- Ga?tan Lehmann Biologie du D?veloppement et de la Reproduction INRA de Jouy-en-Josas (France) tel: +33 1 34 65 29 66 fax: 01 34 65 29 09 http://voxel.jouy.inra.fr http://www.itk.org http://www.mandriva.org http://www.bepo.fr -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 203 bytes Desc: Ceci est une signature ?lectronique PGP URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20091221/e1ff20b8/attachment.bin>
Matthew Ahrens
2009-Dec-21 18:28 UTC
[zfs-discuss] directory size on compressed file system on Solaris 10
Ga?tan Lehmann wrote:> > Hi, > > On opensolaris, I use du with the -b option to get the uncompressed size > of a directory): > > root at opensolaris:~# du -sh /usr/local/ > 399M /usr/local/ > root at opensolaris:~# du -sbh /usr/local/ > 915M /usr/local/ > root at opensolaris:~# zfs list -o space,refer,ratio,compress data/local > NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD > REFER RATIO COMPRESS > data/local 228G 643M 249M 394M 0 0 > 394M 2.51x on > root at opensolaris:~# which du > /usr/gnu/bin/du > > but on Solaris 10, there is no such option. > > So what is the best way to get the uncompressed size of a directory on > Solaris 10?Install GNU du on solaris 10? Although the answer will be just as (in)accurate as GNU du on solaris 10. Note that it reports the compression ratio as 915/399 = 2.29x, actual is 2.51x. This could be due to sparse files, or metadata like directories, whose "apparent size" (st_size) is not what GNU du expects. Took me a minute to realize you were talking about the space used under a subdirectory, not the space consumed by the directory itself! I guess I''m the only one creating 400MB directories :-) --matt
Joerg Schilling
2009-Dec-21 19:23 UTC
[zfs-discuss] directory size on compressed file system on Solaris 10
Matthew Ahrens <Matthew.Ahrens at sun.com> wrote:> Ga?tan Lehmann wrote: > > > > Hi, > > > > On opensolaris, I use du with the -b option to get the uncompressed size > > of a directory): > > > > root at opensolaris:~# du -sh /usr/local/ > > 399M /usr/local/ > > root at opensolaris:~# du -sbh /usr/local/ > > 915M /usr/local/ > > root at opensolaris:~# zfs list -o space,refer,ratio,compress data/local > > NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD > > REFER RATIO COMPRESS > > data/local 228G 643M 249M 394M 0 0 > > 394M 2.51x on > > root at opensolaris:~# which du > > /usr/gnu/bin/du > > > > but on Solaris 10, there is no such option. > > > > So what is the best way to get the uncompressed size of a directory on > > Solaris 10? > > Install GNU du on solaris 10? Although the answer will be just as > (in)accurate as GNU du on solaris 10. Note that it reports the compressionHow about: find . -type f -ls | awk ''{ sum += $7} END {print sum}'' J?rg -- EMail:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 Berlin js at cs.tu-berlin.de (uni) joerg.schilling at fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
Gaëtan Lehmann
2009-Dec-21 19:46 UTC
[zfs-discuss] directory size on compressed file system on Solaris 10
Le 21 d?c. 09 ? 19:28, Matthew Ahrens a ?crit :> Ga?tan Lehmann wrote: >> Hi, >> On opensolaris, I use du with the -b option to get the uncompressed >> size of a directory): >> root at opensolaris:~# du -sh /usr/local/ >> 399M /usr/local/ >> root at opensolaris:~# du -sbh /usr/local/ >> 915M /usr/local/ >> root at opensolaris:~# zfs list -o space,refer,ratio,compress data/ >> local >> NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV >> USEDCHILD REFER RATIO COMPRESS >> data/local 228G 643M 249M 394M 0 >> 0 394M 2.51x on >> root at opensolaris:~# which du >> /usr/gnu/bin/du >> but on Solaris 10, there is no such option. >> So what is the best way to get the uncompressed size of a directory >> on Solaris 10? > > Install GNU du on solaris 10?That''s an option of course, but I''d prefer something that I can use installing any extra program.> Although the answer will be just as (in)accurate as GNU du on > solaris 10. Note that it reports the compression ratio as 915/399 = > 2.29x, actual is 2.51x. This could be due to sparse files, or > metadata like directories, whose "apparent size" (st_size) is not > what GNU du expects.At least it gives a not so bad estimation :-) And the compression ratio includes the data in the snapshots, so it may be inaccurate in that case also. The actual compression ratio, given on the last snapshot, is 2.41x. Ga?tan -- Ga?tan Lehmann Biologie du D?veloppement et de la Reproduction INRA de Jouy-en-Josas (France) tel: +33 1 34 65 29 66 fax: 01 34 65 29 09 http://voxel.jouy.inra.fr http://www.itk.org http://www.mandriva.org http://www.bepo.fr -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 203 bytes Desc: Ceci est une signature ?lectronique PGP URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20091221/5592cf9f/attachment.bin>
Gaëtan Lehmann
2009-Dec-21 20:10 UTC
[zfs-discuss] directory size on compressed file system on Solaris 10
Le 21 d?c. 09 ? 20:23, Joerg Schilling a ?crit :> Matthew Ahrens <Matthew.Ahrens at sun.com> wrote: > >> Ga?tan Lehmann wrote: >>> >>> Hi, >>> >>> On opensolaris, I use du with the -b option to get the >>> uncompressed size >>> of a directory): >>> >>> root at opensolaris:~# du -sh /usr/local/ >>> 399M /usr/local/ >>> root at opensolaris:~# du -sbh /usr/local/ >>> 915M /usr/local/ >>> root at opensolaris:~# zfs list -o space,refer,ratio,compress data/ >>> local >>> NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV >>> USEDCHILD >>> REFER RATIO COMPRESS >>> data/local 228G 643M 249M 394M >>> 0 0 >>> 394M 2.51x on >>> root at opensolaris:~# which du >>> /usr/gnu/bin/du >>> >>> but on Solaris 10, there is no such option. >>> >>> So what is the best way to get the uncompressed size of a >>> directory on >>> Solaris 10? >> >> Install GNU du on solaris 10? Although the answer will be just as >> (in)accurate as GNU du on solaris 10. Note that it reports the >> compression > > How about: > > find . -type f -ls | awk ''{ sum += $7} END {print sum}''sounds good root at opensolaris:~# find /usr/local/ -ls | awk ''{sum += $7} END {print sum/1024**2}'' 914.039 but maybe a little longer to write root at opensolaris:~# echo "du -sbh ." | wc -c 10 root at opensolaris:~# echo "find . -ls | awk ''{sum += $7} END {print sum/1024**2}''" | wc -c 53 Thanks! Ga?tan -- Ga?tan Lehmann Biologie du D?veloppement et de la Reproduction INRA de Jouy-en-Josas (France) tel: +33 1 34 65 29 66 fax: 01 34 65 29 09 http://voxel.jouy.inra.fr http://www.itk.org http://www.mandriva.org http://www.bepo.fr -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 203 bytes Desc: Ceci est une signature ?lectronique PGP URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20091221/10b9ee45/attachment.bin>