4

This strange behavior begins a few day ago. This is df of all file system

michele@OptiPlex-360:~$ df
File system    1K-blocchi    Usati Disponib. Uso% Montato su
udev              1974808        8   1974800   1% /dev
tmpfs              397120     1340    395780   1% /run
/dev/sda1        45225008 14448892  28455736  34% /
none                    4        0         4   0% /sys/fs/cgroup
none                 5120        4      5116   1% /run/lock
none              1985596       80   1985516   1% /run/shm
none               102400       68    102332   1% /run/user
/dev/sda6       190822060 65912468 115193268  37% /media/volume1

Now I ask for sda1 and it gives me a wrong answer

michele@OptiPlex-360:~$ df /dev/sda1
File system    1K-blocchi Usati Disponib. Uso% Montato su
udev              1974808     8   1974800   1% /dev

instead sda6 works

michele@OptiPlex-360:~$ df /dev/sda6
File system    1K-blocchi    Usati Disponib. Uso% Montato su
/dev/sda6       190822060 65912468 115193268  37% /media/volume1

Well, what's wrong?

Ah, same issue I have on my other PC with same Ubuntu installed.

Additional output as muru asked for:

michele@OptiPlex-360:~$ mount | grep /dev/sda1
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
michele@OptiPlex-360:~$ df /
File system                                            1K-blocchi    Usati Disponib. Uso% Montato su
/dev/disk/by-uuid/2438603c-1bfd-4e79-9f6c-ad6575988aee   45225008 14448908  28455720  34% /

2 Answers2

3

My personal explanation to this effect is the following: df reads /proc/self/mountinfo file but doesn't find /dev/sda1 there.

I know it reads /proc/self/mountinfo because when I do strace df /dev/sda1 I get the following line in the output

open("/proc/self/mountinfo", O_RDONLY)  = 3

Now, if we examine that file, /dev/sda is not there, but it does find /dev/sdb there, which explains correct reports for those partitions.

================
xieerqi:
$ grep 'sda' /proc/self/mountinfo                                              

================
xieerqi:
$ grep 'sdb' /proc/self/mountinfo                                              
43 22 8:18 / /media/WINDOWS rw,nosuid,nodev,noatime - fuseblk /dev/sdb2 rw,user_id=0,group_id=0,allow_other,blksize=4096
49 22 8:21 / /media/xieerqi/0ca7543a-5463-4a07-8bbe-233a7b0bd625 rw,nosuid,nodev,relatime - ext4 /dev/sdb5 rw,data=ordered

Why it's not there ? I don't know. I can only provide what I've found.

But why does it report udev in the output ? df looks at filesystems, and /dev/sda1 is under /dev folder, which is where udev virtual filesystem is mounted. It's the same behavior if we'd call df FILE, like df /home or df /media/MYWINDOWSPARTITION/RANDOMFILE.txt

I would suggest reporting it as a bug or at least ask the GNU developers about this behavior (copied from man page )

REPORTING BUGS
       Report df bugs to bug-coreutils@gnu.org
       GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
       General help using GNU software: <http://www.gnu.org/gethelp/>
       Report df translation bugs to <http://translationproject.org/team/>

Edit

In addition, the df / behavior is explained again by /proc/self/mountinfo file having the following entry

22 0 8:1 / / rw,noatime,nodiratime - ext4 /dev/disk/by-uuid/86df21bf-d95f-435c-9
292-273bdbcba056 rw,errors=remount-ro,data=ordered

The root filesystem itself is mounted as /dev/dis/by-uuid/ACTUAL-UUID-NUMBER.

But I don't have explanation for df with no arguments reporting /dev/sda1 rather than the path to disk by uuid. Probably the reason is because /dev/dis/by-uuid/ACTUAL-UUID-NUMBER itself is a symlink to /dev/sda1, so it resolves it fully without arguments, but with arguments needs to search /proc/self/mountinfo file

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
0

That's normal (for the second output) as partitions are mounted by their uuid, not using device names (that's the older style) Some Linux distributions use the old style and some use the new ones. Here is a note to better explain the issue mount partitions by uuid

This mechanism protects against changing disk drive order of you swap disks inside your hardware. If you want, you can easily change this by specifying the device name in /etc/fstab.

hp cre
  • 63