The df output has two distinct problems, which will have separate
solutions. 


Regarding the duplicate rootfs entry, I had thought (from d-i) that it
was possible to use pivot_root and then umount the initrd afterwards.
However, hpa tells me that the rootfs is the cwd for kernel threads so
cannot be unmounted. It might also be used as the hardcoded head of the
linked list of active mounts, if they haven't found a better data
structure yet in the kernel.. :P

So this seems to be a limitation of linux, and short of going back to a
/etc/mtab file, df needs to be fixed to either paper over the problem
with a special case exclude of the rootfs, or take one of the general
purpose approaches for hiding non-available filesystems that have been
discussed. Or violate the least surprise of every user who looks at df
and sees two root filesystems, but I personally don't think that is a
good option.


Regarding the ugly uuid display, a recent release of coreutils actually
made this worse.  It used to wrap long device paths:

tmpfs                  200M  340K  200M   1% /run/shm
/dev/disk/by-uuid/6a7e9145-b76d-4bcf-a243-67c65891549a
                        29G   27G  2.0G  93% /

But that's not really a fix, and was removed due to it breaking naive
scripts that did not use df -P.

The proper fix is to make klibc-utils's mount (and perhaps also
busybox's), do the same path canonicalization that /bin/mount does.
That canonicalization is why mounting by uuid does not normally cause
the problem:

joey@gnu:~>sudo mount /dev/disk/by-uuid/e55f93bc-53ce-4111-af1e-8feb07759362 
/mnt
joey@gnu:~>df /mnt
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       917G  737G  181G  81% /mnt
joey@gnu:~>sudo umount /mnt
joey@gnu:~>sudo mount --no-canonicalize 
/dev/disk/by-uuid/e55f93bc-53ce-4111-af1e-8feb07759362 /mnt
joey@gnu:~>df /mnt
Filesystem                                              Size  Used Avail Use% 
Mounted on
/dev/disk/by-uuid/e55f93bc-53ce-4111-af1e-8feb07759362  917G  737G  181G  81% 
/mnt

If klibc-utils somehow cannot be fixed, the only other option would be to
make df try to canonicalize paths, but that would be problimatic to get
right (imagine running df in a chroot without /dev etc). Also, it would
not fix anything else that displays mounted devices, such as perhaps GUI
programs.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to