0

I don't understand why the following filesystem shows up in /etc/fstab, but not using df -a:

/dev/sdb1 /var/log/apache_logs          reiserfs    user,noauto,rw,exec,suid,user_xattr        0       2

I've verified that the folder /var/log/apache_logs does indeed exist and can be accessed.

Shouldn't the df -a command list ALL filesystems?

$ df -a
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/ghost-root
                       7583436   1252188   5946020  18% /
proc                         0         0         0   -  /proc
none                         0         0         0   -  /sys
none                         0         0         0   -  /sys/fs/fuse/connections
none                         0         0         0   -  /sys/kernel/debug
none                         0         0         0   -  /sys/kernel/security
udev                    254652       164    254488   1% /dev
none                         0         0         0   -  /dev/pts
none                    254652         0    254652   0% /dev/shm
none                    254652        52    254600   1% /var/run
none                    254652         0    254652   0% /var/lock
none                    254652         0    254652   0% /lib/init/rw
/dev/sdc1               198321      5763    182319   4% /tmp
/dev/sda5               233335     12670    208217   6% /boot
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/mapper/ghost-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda5 during installation
UUID=f9f46813-a78a-42e8-a007-53308212ee26 /boot           ext2    defaults        0       2
/dev/sdb1 /var/log/apache_logs          reiserfs    user,noauto,rw,exec,suid,user_xattr        0       2
/dev/sdc1 /tmp         ext2        noexec,nosuid,rw                    0       0
/dev/mapper/ghost-swap_1 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
$ 
  • Only "root" can do that, so I cannot do it, since I'm an ordinary user. Still, that wouldn't answer why df -a doesn't show all filesystems? – Shuzheng May 20 at 11:24
3

Note that the filesystem mount options in /etc/fstab include the noauto option. As a result it will not be mounted automatically at boot time, nor with mount -a.

It will only be mounted with a specific mount /dev/sdb1 or mount /var/log/apache_logs command. Apparently this command has not been issued yet.

df -a will list all mounted filesystems - including pseudo filesystems like /proc or /sys, and also duplicate and inaccessible mounted filesystems, but not unmounted filesystems.

There's also the user option, indicating that even a regular user can mount that specific filesystem into that specific mountpoint, and only the user that mounted it (or root of course) can unmount it again.

  • thank you. You write "Apparently this command has not been issued yet."; But why can I cd to /var/log/apache_logs then? Is it just because the filesystem already has a directory called that? – Shuzheng May 20 at 11:27
  • In order to mount a filesystem, there must be a directory that will be used as a mount point; but when the filesystem is not mounted, the mount point will be just an ordinary directory, and that is probably what you're seeing. Frankly, having /var/log/apache_logs be an user-mountable directory is rather an odd choice; I wonder why it's done that way. – telcoM May 20 at 11:36
  • do you have any idea why I get the following error, when trying to mount the reiserfs filesystem: $ mount -t reiserfs /dev/sdb1 /var/log/apache_logs mount: only root can do that? Shouldn't it be possible because of the user option? – Shuzheng May 20 at 11:59
  • In order to mount it as a non-root user, you must specify only either the device or the mount point, not both of them, and no filesystem type nor other options. If you specify all the things on the command line, then the mount command won't even look into /etc/fstab, and will always require you to be root. – telcoM May 20 at 13:05
  • it works thank you. However, the filesystem is mounted R/W/X only for root, but R/X for my user. Is there any way to mount it as R/W/X for my user? Doesn't the rw in user,noauto,rw,exec,suid,user_xattr imply it should be mounted as R/W? – Shuzheng May 20 at 13:20
3

df shows mounted filesystems. Your fstab line has noauto in it, so it isn't mounted automatically. Presumably it wasn't mounted at the time you ran df. The user option indicates it's probably meant to be mounted manually by a user other than root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.