bdf , /etc/fstab , /etc/mnttab

Hi all,

Would like to know if it is possible to rearrange the order that mounts are displayed when the 'bdf' command is issued.

An example of what I mean is, currently I see the following ...

[mddev:/home/cameron]
$ bdf -l
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3     524288  211800  310104   41% /
/dev/vg00/lvol1    1048576  792464  254216   76% /stand
/dev/vg00/lvol7    4194304 2111048 2066992   51% /var
/dev/vg00/lvol6    5275648 4324952  943312   82% /usr
/dev/vg00/lvolu3   30736384 3901997 25157825   13% /u03
/dev/vg00/lvolu2   27033600 21665312 5034033   81% /u02
/dev/vg00/lvolu1   20480000 16962500 3298935   84% /u01
/dev/vg00/lvol5     229376  103248  125280   45% /tmp
/dev/vg00/lvol4    4620288 3775088  838648   82% /opt
/dev/vg00/lvol8    1048576  141744  899856   14% /home
/dev/vg00/lvolu4   5144576 2148221 2809135   43% /u04

But would prefer to see the mounts in the following order ...

Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3     524288  211800  310104   41% /
/dev/vg00/lvol6    5275648 4324952  943312   82% /usr
/dev/vg00/lvol7    4194304 2111048 2066992   51% /var
/dev/vg00/lvol4    4620288 3775088  838648   82% /opt
/dev/vg00/lvol8    1048576  141744  899856   14% /home
/dev/vg00/lvol1    1048576  792464  254216   76% /stand
/dev/vg00/lvol5     229376  103248  125280   45% /tmp
/dev/vg00/lvolu1   20480000 16962500 3298935   84% /u01
/dev/vg00/lvolu2   27033600 21665312 5034033   81% /u02
/dev/vg00/lvolu3   30736384 3901997 25157825   13% /u03
/dev/vg00/lvolu4   5144576 2148221 2809135   43% /u04

I had a play about and altered the order of items in the /etc/fstab with no change to the output order and have read that changing /etc/mnttab is not recommended or of any use. Whilst the example is for the local mounts, if a solution is possible then I'd also apply the same for NFS mounts too.

A strange query I'd admit, but curious to know if it is possible.

Cheers,
Cameron

The best solution would be to write a wrapper around bdf to sort the output the way you want.

Thanks Perderabo.

Any chance of a lead for understanding/creating a wrapper (never looked before).
Searching the forums, there are (of what I've searched so far) only references to wrappers.

Cheers,
Cameron

A wrapper is just a script that you call instead of the actual command (bdf) in your case. The script will modify your output as you wish, by internally calling stuff like sort/awk/whatever. Once you get the script in place, do not run bdf directly, but the always the script instead.

Cheers blowtorch.
Hadn't heard of the terminology prior.
Many thanks. :wink:

It occurred to me that a non-general solution is very easy. All you need is a control file with line numbers. You paste the control file on to the output from bdf, sort, then cut away the line numbers. I am not on an HP-UX system, so to demo this, first I need an ersatz bdf command.

$ export PATH=$PATH:.
$ cat bdf
#! /usr/bin/sed 1d
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3     524288  211800  310104   41% /
/dev/vg00/lvol1    1048576  792464  254216   76% /stand
/dev/vg00/lvol7    4194304 2111048 2066992   51% /var
/dev/vg00/lvol6    5275648 4324952  943312   82% /usr
/dev/vg00/lvolu3   30736384 3901997 25157825   13% /u03
/dev/vg00/lvolu2   27033600 21665312 5034033   81% /u02
/dev/vg00/lvolu1   20480000 16962500 3298935   84% /u01
/dev/vg00/lvol5     229376  103248  125280   45% /tmp
/dev/vg00/lvol4    4620288 3775088  838648   82% /opt
/dev/vg00/lvol8    1048576  141744  899856   14% /home
/dev/vg00/lvolu4   5144576 2148221 2809135   43% /u04
$
$
$
$ cat control
01
02
03
04
05
11
10
09
06
07
08
12
$
$
$
$ bdf
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3     524288  211800  310104   41% /
/dev/vg00/lvol1    1048576  792464  254216   76% /stand
/dev/vg00/lvol7    4194304 2111048 2066992   51% /var
/dev/vg00/lvol6    5275648 4324952  943312   82% /usr
/dev/vg00/lvolu3   30736384 3901997 25157825   13% /u03
/dev/vg00/lvolu2   27033600 21665312 5034033   81% /u02
/dev/vg00/lvolu1   20480000 16962500 3298935   84% /u01
/dev/vg00/lvol5     229376  103248  125280   45% /tmp
/dev/vg00/lvol4    4620288 3775088  838648   82% /opt
/dev/vg00/lvol8    1048576  141744  899856   14% /home
/dev/vg00/lvolu4   5144576 2148221 2809135   43% /u04
$
$
$
$ bdf | paste control - | sort -n | cut -f2
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3     524288  211800  310104   41% /
/dev/vg00/lvol1    1048576  792464  254216   76% /stand
/dev/vg00/lvol7    4194304 2111048 2066992   51% /var
/dev/vg00/lvol6    5275648 4324952  943312   82% /usr
/dev/vg00/lvol5     229376  103248  125280   45% /tmp
/dev/vg00/lvol4    4620288 3775088  838648   82% /opt
/dev/vg00/lvol8    1048576  141744  899856   14% /home
/dev/vg00/lvolu1   20480000 16962500 3298935   84% /u01
/dev/vg00/lvolu2   27033600 21665312 5034033   81% /u02
/dev/vg00/lvolu3   30736384 3901997 25157825   13% /u03
/dev/vg00/lvolu4   5144576 2148221 2809135   43% /u04
$

Thanks Perderabo.

Will try it out on the dev box tomorrow when it's light again.
And thanks also for keeping the question in mind.

Cheers,
Cameron