For some reason, the output format for
df changed after a recent kernel update in Ubuntu 14.04.
When I run
df -hl to show all mounted filesystems, the output looks like this:
bwvdnbro@wixie:~/Projects$ df -hl Filesystem Size Used Avail Use% Mounted on udev 12G 4.0K 12G 1% /dev tmpfs 2.4G 1.3M 2.4G 1% /run /dev/sda1 1.8T 1.3T 395G 78% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 12G 168K 12G 1% /run/shm none 100M 44K 100M 1% /run/user /dev/md0p1 3.6T 1.4T 2.1T 40% /media/bwvdnbro/raid
However, when I only want to show one specific device, e.g.
/, the output changes to
bwvdnbro@wixie:~/Projects$ df -hl / Filesystem Size Used Avail Use% Mounted on /dev/disk/by-uuid/90cd5449-2cbf-4f32-89fe-d66e9fb5f8ee 1.8T 1.3T 395G 78% /
This is annoying, since it makes the first line too long to fit in a standard terminal window.
Is there any way to control the output format for
Filesystem and make it also show
/dev/sda1 instead of the full UUID when using
df for a single device?
So I did some more research on different nodes running different kernel versions, and it turns out the problem is not with
df, but rather with
/proc/self/mountinfo, the file that
df reads. For old kernel versions, this file contains the device name, while the newer versions list the UUID instead.
So the question is: how does the full
df -hl command convert the UUID to the device name, and is there a way to reproduce this behaviour when running
df -hl /?