Gentoo Archives: gentoo-user

From: Tom H <tomh0665@×××××.com>
To: Gentoo User <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Weird "df" output
Date: Thu, 26 Nov 2015 12:57:58
Message-Id: CAOdo=SwTv4L9-1BrBqT02p9-wsZ7ONqGmc3AjaUd2QG-QxhvBg@mail.gmail.com
In Reply to: [gentoo-user] Weird "df" output by waltdnes@waltdnes.org
1 On Thu, Nov 26, 2015 at 12:10 AM, <waltdnes@××××××××.org> wrote:
2 >
3 > I'll admit that my system setup is a bit unusual. A long time ago, in
4 > a place far away, hard drives were small, compared to today's standards.
5 > The usual unix practice of multiple seprate partitions was not feasable
6 > for me, but I did want to keep root on its own partition. So I
7 > compromised with a small / partition, with empty /home, /opt, /var,
8 > /usr, and /tmp directories. Their real equivalents are bind-mounted
9 > from a much larger partition. I just re-did my oldest machine. It has
10 > a primary partition 1, which covers the entire hard drive. The /
11 > partion on /dev/sda5 is approximately 500 megabytes (YES!). There's a
12 > 3.8 gigabyte swap partion /dev/sda6, and the rest of the drive is
13 > /dev/sda7. Here's the relevant portion of /etc/fstab...
14 >
15 > /dev/sda5 / ext2 noatime,async 0 1
16 > /dev/sda7 /home ext3 noatime,async 0 1
17 > /home/bindmounts/opt /opt auto bind 0 0
18 > /home/bindmounts/var /var auto bind 0 0
19 > /home/bindmounts/usr /usr auto bind 0 0
20 > /home/bindmounts/tmp /tmp auto bind 0 0
21 > /dev/sda6 none swap sw 0 0
22 >
23 > ...and the output from "df"...
24 >
25 > Filesystem 1K-blocks Used Available Use% Mounted on
26 > /dev/root 495944 49416 420928 11% /
27 > devtmpfs 10240 0 10240 0% /dev
28 > tmpfs 310080 356 309724 1% /run
29 > shm 1550384 0 1550384 0% /dev/shm
30 > cgroup_root 10240 0 10240 0% /sys/fs/cgroup
31 > /dev/sda7 476205120 292365556 159643008 65% /opt
32 >
33 > ...showing /dev/sda7 mounted on /opt !?!? mc (Midnight Commander) shows
34 > 152 of 454 gigabytes free on all of /home, /opt, /var, /usr, and /tmp,
35 > which is correct, since they're all really bindmounts from /dev/sda7.
36 > The / partition (/dev/sda5) has 411 of 484 megabytes free. The machine
37 > works OK, but the "df" output is a head-scratcher. I've re-booted a
38 > couple of times, with no change.
39
40 If the same filesystem's mounted two or more times, then df shows the
41 shortest mountpoint.
42
43 In your case, /home /opt /tmp /usr /var are mounts of /dev/sda7 so
44 /opt is shown, because it's the first mountpoint lexically-speaking.
45
46 If you use "-a", then /home will be displayed too.