Mount updates /proc/mount but not /etc/mtab, making partition not show up in df, mount listing

2

I'm on RHEL 6. I created some partitions using parted, formatted them using mke2fs, and mounted them using mount. I also added them to /etc/fstab. However, they do not show up in the mount or df listings.

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/vda1              20G  1.9G   17G  10% /
tmpfs                  58G     0   58G   0% /dev/shm

$ mount
/dev/vda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

$ cat /etc/mtab
/dev/vda1 / ext4 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0

However, the partitions do show up as mounted in /proc/mounts:

$ cat /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,nosuid,relatime,size=60487100k,nr_inodes=15121775,mode=755 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
/dev/vda1 / ext4 rw,relatime,barrier=1,data=ordered 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=2265,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=2265,timeout=300,minproto=5,maxproto=5,indirect 0 0
/dev/vdb1 /mnt ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdc1 /disks/vdc1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdd1 /disks/vdd1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vde1 /disks/vde1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdf1 /disks/vdf1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdg1 /disks/vdg1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdh1 /disks/vdh1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdi1 /disks/vdi1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdj1 /disks/vdj1 ext4 rw,relatime,barrier=1,data=ordered 0 0
/dev/vdk1 /disks/vdk1 ext4 rw,relatime,barrier=1,data=ordered 0 0

Overwriting /etc/mtab with the above makes df work:

# cat /proc/mounts > /etc/mtab

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                 20G  1.9G   17G  10% /
devtmpfs               58G  232K   58G   1% /dev
tmpfs                  58G     0   58G   0% /dev/shm
/dev/vda1              20G  1.9G   17G  10% /
/dev/vdb1             2.7T  202M  2.6T   1% /mnt
/dev/vdc1             2.7T  201M  2.6T   1% /disks/vdc1
/dev/vdd1             2.7T  201M  2.6T   1% /disks/vdd1
/dev/vde1             2.7T  201M  2.6T   1% /disks/vde1
/dev/vdf1             2.7T  201M  2.6T   1% /disks/vdf1
/dev/vdg1             2.7T  201M  2.6T   1% /disks/vdg1
/dev/vdh1             2.7T  201M  2.6T   1% /disks/vdh1
/dev/vdi1             2.7T  201M  2.6T   1% /disks/vdi1
/dev/vdj1             2.7T  201M  2.6T   1% /disks/vdj1
/dev/vdk1             2.7T  201M  2.6T   1% /disks/vdk1

This moves me past the immediate problem, but I would still like to understand why mount didn't update /etc/mtab correctly. Any thoughts?

Edit: As requested, output of fdisk -l:

$ sudo fdisk -l

Disk /dev/vda: 21.5 GB, 21474836480 bytes
43 heads, 16 sectors/track, 60963 cylinders
Units = cylinders of 688 * 512 = 352256 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00054b77

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1               3       60964    20970496   83  Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/vdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdb: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdc: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdc1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdd'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdd: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdd1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vde'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vde: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vde1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdf'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdf: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdf1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdg'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdg: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdg1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdh'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdh: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdh1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdi'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdi: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdi1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdj'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdj: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdj1               1      267350  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/vdk'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vdk: 3000.0 GB, 2999999004672 bytes
255 heads, 63 sectors/track, 364729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vdk1               1      267350  2147483647+  ee  GPT
mount
df
asked on Server Fault Apr 23, 2013 by Leons • edited Sep 29, 2016 by Josip Rodin

1 Answer

1

This happened to me after I made the mistake of editing /etc/mtab manually. There's a reason why every manual in existence says - just don't do that :) The edit itself was innocuous - I had renamed an LVM volume group of a mounted logical volume, and needed a trivial update to its mtab entry so that mount -a would stop reporting spurious errors. The problem was that my editor left a simple backup file at /etc/mtab~.

All mount(8) invocations stopped updating mtab, and started taking ~30 seconds to run, which was rather suspicious. Sadly it didn't even print a warning, it took a strace to figure this out:

% sudo strace mount /something
[...]
link("/etc/mtab~.10889", "/etc/mtab~")  = -1 EEXIST (File exists)
open("/etc/mtab~", O_WRONLY)            = 3
[...]
unlink("/etc/mtab~.10889")              = 0
[...]

It did that set of link() and open() calls in a loop, but eventually gave up and did the unlink() of its temporary file.

The solution was simply to manually remove that backup in /etc/mtab~.

answered on Server Fault Sep 30, 2016 by Josip Rodin • edited Sep 30, 2016 by Josip Rodin

User contributions licensed under CC BY-SA 3.0