Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 637288 Details for
Bug 709351
df command should suppress duplicates
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
deduplicating df proof of concept (in Perl)
df.pl (text/plain), 1.28 KB, created by
Michal Schmidt
on 2012-11-02 21:33:36 UTC
(
hide
)
Description:
deduplicating df proof of concept (in Perl)
Filename:
MIME Type:
Creator:
Michal Schmidt
Created:
2012-11-02 21:33:36 UTC
Size:
1.28 KB
patch
obsolete
>#!/usr/bin/perl -w >use strict; >use warnings; >use Filesys::Df; > >my @table; # array of mount entries >my %preferred; # "major:minor" -> mount entry > >open(MI, "</proc/self/mountinfo") or die; >while (<MI>) { > /^(\d+) (\d+) (\d+):(\d+) (\S+) (\S+) (\S+) ([^-]*)- (\S+) (\S+) (\S+)/ or die; > my %entry = ( > id => $1, > parent => $2, > major => $3, > minor => $4, > root => $5, > mntpoint => $6, > mntopts => $7, > fields => $8, > type => $9, > source => $10, > sbopts => $11 > ); > > next if $entry{type} eq "autofs"; > > # Store entry > push(@table, \%entry); > > # Have one preferred entry per block device. If this b.d. already has > # an entry linked, prefer the entry with the shorter root path. > my $key = "$entry{major}:$entry{minor}"; > if (not defined $preferred{$key} or > length(${$preferred{$key}}{root}) > length($entry{root})) { > $preferred{$key} = \%entry; > } >} > >printf("%-30s %9s %9s %9s %3s%% %s\n", > "Filesystem", "1K-blocks", "Used", "Available", "Use", "Mounted on"); >foreach my $ent(@table) { > > # Skip bind mounts > my $key = "$$ent{major}:$$ent{minor}"; > next if $ent != $preferred{$key}; > > my $df = df($$ent{mntpoint}); > next if not defined $df; > > printf("%-30s %9d %9d %9d %3d%% %s\n", > ${$ent}{source}, $$df{blocks}, $$df{used}, $$df{bavail}, $$df{per}, $$ent{mntpoint}); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 709351
: 637288