Gentoo Archives: gentoo-user

From: Paul Hartman <paul.hartman+gentoo@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] About interpreting output of df -h
Date: Wed, 15 Dec 2010 23:05:37
Message-Id: AANLkTi=ZLi5nN=7ug1LCZppiSutkPcCR2NzitEr0JRZ3@mail.gmail.com
In Reply to: [gentoo-user] About interpreting output of df -h by Harry Putnam
1 On Thu, Dec 2, 2010 at 3:53 PM, Harry Putnam <reader@×××××××.com> wrote:
2 > Can anyone tell me how determine what these kind of useless names
3 > really mean?
4 >
5 > From df -h
6 > Filesystem            Size  Used Avail Use% Mounted on
7 > rootfs                1.9G  283M  1.6G  15% /
8 > /dev/root             1.9G  283M  1.6G  15% /
9 >
10 > How are you supposed to tell what actual device these things are on.
11 >
12 > I know I can look in fstab... but that is something of a crap shoot
13 > since it is user configured.
14
15 And I think in this case it is related to the linux boot process,
16 where fstab doesn't even come into play yet anyway. In fact that's
17 probably the reason for the "makebelieve baloney" names, I would guess
18 (more on that later). :)
19
20 > So what commands will show real devices not makebelieve baloney, and
21 > allow me to see the usage devices are put to?
22
23 In addition to what others suggested (ls or readlink), you can use
24 stat, or you can look early-on in dmesg, for example mine shows this:
25 [ 7.139281] EXT4-fs (sda2): mounted filesystem with ordered data
26 mode. Opts: (null)
27 [ 7.153529] VFS: Mounted root (ext4 filesystem) readonly on device 8:2.
28
29 which seems pretty conclusive. In the case of rootfs and /dev/root you
30 can also probably just look at your kernel commandline:
31 $ cat /proc/cmdline
32 root=/dev/sda2 doscsi raid=noautodetect rootfstype=ext4
33 video=uvesafb:1280x720p-59,mtrr:2,ywrap
34
35 Which shows my root device as /dev/sda2 which matches what dmesg and
36 ls and readlink and stat tell me.
37
38 If your root is a device-mapper array or you're booting on a diskless
39 machine over the network or other more "exotic" configurations maybe
40 this info might not be so straightforward. In my case I have a normal
41 PC with a non-raid boot/root drive so it's easy.
42
43 > Why do we use these kind of names anyway?
44
45 Kernel documentation sheds some light on it. Check out
46 /usr/src/linux/Documentation/filesystems/ramfs-rootfs-initramfs.txt in
47 particular. The most relevant snippet from my brief perusal:
48
49 [snip]
50 What is rootfs?
51 ---------------
52
53 Rootfs is a special instance of ramfs (or tmpfs, if that's enabled), which is
54 always present in 2.6 systems. You can't unmount rootfs for approximately the
55 same reason you can't kill the init process; rather than having special code
56 to check for and handle an empty list, it's smaller and simpler for the kernel
57 to just make sure certain lists can't become empty.
58
59 Most systems just mount another filesystem over rootfs and ignore it. The
60 amount of space an empty instance of ramfs takes up is tiny.
61 [/snip]