[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Hide rootfs filesystem in df

From: Voelker, Bernhard
Subject: RE: Hide rootfs filesystem in df
Date: Mon, 24 Sep 2012 13:35:49 +0000

Robert Milasan wrote:

> Hello, I've seen lately on a lot of distros using systemd that when
> running "df" there is also a filesystem rootfs.

Thanks for reminding on this. This issue was previously mentioned
as a side note in the ML conversion about suppressing duplicate

> This filesystem is available in /proc/mounts or /proc/self/mounts, but
> before systemd usually /etc/mtab was generated at boot times by the
> booting scripts. Now most distros link /etc/mtab to /proc/self/mounts
> so this "rootfs" filesystem is also there. This filesystem
> is actually the root filesystem "/" so you will be having the same
> filesystem twice but with different names, lets say.
> "rootfs" should not be available or viewable when user is running "df".
> The user could do "df -x rootfs", but seems pointless to always run it
> like that, so I create a small patch for df which will ignore "rootfs":
> Index: coreutils-8.16/src/df.c
> ===================================================================
> --- coreutils-8.16.orig/src/df.c
> +++ coreutils-8.16/src/df.c
> @@ -465,6 +465,9 @@ get_dev (char const *disk, char const *m
>    char* cell;
>    size_t field;
> +  if (STRNCMP_LIT (fstype, "rootfs") == 0)
> +    return;
> +
>    if (me_remote && show_local_fs)
>      return;
> The patch is simple, but if someone knows how to make this better,
> please do. I'm not really a developer nor a coder :)

Thanks for the patch.
The actual patch won't be so small, because the user would
want to see rootfs if "df -a" is used or when she
explictly calls df for the mount point.

> This has been tested on openSUSE 12.1 and 12.2.
> Also on openSUSE even mount command doesn't show this "rootfs"
> filesystem, so "df" shouldn't also.

I'm also using OpenSuSE and can't understand why they're
distributing such an old version (8.16 from Mar 26th 
while 8.19 is out) in the new 12.2 distro.

Have a nice day,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]