"Filesystem is mounted" message, but it's not

Help
Mikel Ward
2007-12-30
2012-11-28
  • Mikel Ward
    Mikel Ward
    2007-12-30

    I am trying to migrate my existing install from /dev/hda onto a RAID 1 consisting of /dev/hda1 and /dev/hdc1.

    I created a partition /dev/hdc1 that used all of /dev/hdc, created the RAID set as /dev/md0 using missing and /dev/hdc1, created the ext3 file system, changed fstab and grub.conf and rebooted using the RAID as the root file system.

    I realized I forgot to allow for a separate swap partition, so I am trying to shrink /dev/md0 and /dev/hdc1.

    I tried to resize md0 online, but I got an error about on-line resizing not being supported, so I rebooted with hda1 as the root file system and md0 unmounted, but I got the same error.

    $ sudo ./resize2fs /dev/md0 154191806s
    resize2fs 1.40.2 (12-Jul-2007)
    Filesystem at /dev/md0 is mounted on /; on-line resizing required
    On-line shrinking from 19537648 to 19273975 not supported.

    $ mount | grep md0

    $ mount | grep ' / '
    /dev/hda1 on / type ext3 (rw)

    I get the same message whether I use e2fsprogs 1.39 (from CentOS/RHEL) or 1.40.2 (from SF.net), except for the number of sectors, which they seem to count differently.  I am currently trying 154191806 (512 byte) sectors to get a size of 77095903 (1024 byte) blocks to match the existing size of hda1.  If I mount md0 on /raid, df shows me it's only 23% full.

    $ sudo fdisk -lu /dev/hdc

    Disk /dev/hdc: 80.0 GB, 80026361856 bytes
    16 heads, 63 sectors/track, 155061 cylinders, total 156301488 sectors
    Units = sectors of 1 * 512 = 512 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/hdc1              63   156301487    78150712+  fd  Linux raid autodetect

    $ sudo fdisk -lu /dev/hda

    Disk /dev/hda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
    Units = sectors of 1 * 512 = 512 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/hda1   *          63   154191869    77095903+  83  Linux
    /dev/hda2       154191870   156296384     1052257+  82  Linux swap / Solaris

    $ sudo mount /dev/md0 /raid

    $ df -Pk /raid
    Filesystem         1024-blocks      Used Available Capacity Mounted on
    /dev/md0              76922848  16479548  56535772      23% /raid

    Why am I seeing this error message?  Is it safe to proceed?  Is the way I'm trying to resize my RAID file system correct?

     
    • Mikel Ward
      Mikel Ward
      2007-12-30

      It turns out this is because /dev/root is pointing at /dev/md0, and that's one of the checks resize2fs does.  This is strange, because md0 isn't mounted as the root file system.  Both grub.conf and fstab use /dev/hda1.

      $ ll /dev/root /dev/md0 /dev/hda1
      brw-r----- 1 root disk 3, 1 Dec 30 20:31 /dev/hda1
      brw-r----- 1 root disk 9, 0 Dec 30 20:31 /dev/md0
      brw------- 1 root root 9, 0 Dec 30 20:31 /dev/root

      I'm not yet sure how to fix this.

       
    • Mikel Ward
      Mikel Ward
      2007-12-30

      The system was wrongly reporting that hda1 was mounted on /, when it was in fact md0.  I discovered this by mounting /dev/hda1 on /mnt to check it was that same as / and noticing that it wasn't!

      Grub was actually using the grub.conf file from boot on hda1, which still had root=/dev/md0, but fstab had /dev/hda1, so it was booting from /dev/md0, then I'm guessing the mount -a command in the system initialization screwed up /etc/mtab by trying to mount /dev/hda1 as /.