Results 1 to 3 of 3

Thread: /etc/mtab out of sync

  1. #1
    Senior Member registered user
    Join Date
    Jul 2006
    Posts
    122

    /etc/mtab out of sync

    I've ran into this before on another distro. But for the life of me I cant remember the fix..

    The root of the problem is I suppose that when things are umounted they are not removed from the mtab... so after awhile you end up with a mtab thats stuffed full of mount entries. I tried to "band-aid" this by ' echo "" >/etc/mtab ' at startup followed by ' ./etc/init.d/mtab.sh start ' after all filesystems where setup...

    This sort of fixes the problem except its still alittle out of sync.... for instance my root is /dev/sda1. But this entry is not present in mtab... so ofcoarse the system reports /dev/sda1 as unmounted.

    All and all this is a small problem for me since this is just a portable system that I use away from home..... but still an anonyance.

    Any ideas?... hrmm.. maybe just ` ln -s /proc/mounts /etc/mtab ` ?

    Thanks,
    -Justin
    One Mynds Eye

  2. #2
    Junior Member
    Join Date
    Jan 2007
    Location
    Melbourne, Fl
    Posts
    2
    The hack I came up with (following also the ISO boot thread with ruymbeke's binaries) is to tack onto linuxrc in minirt.gz the following just before the call to exit():

    # SMartin - HACK below just forces unmount of ntfs drive
    # we are booting from (if we are booting from one)
    # and gets mtab back in sync if its messed up.
    /sbin/umount.ntfs ${LOOP_SOURCE} > /dev/null 2>&1
    cat /proc/mounts > /etc/mtab



    Good luck.
    I can provide a minirt.gz for you if need be.

  3. #3
    Senior Member registered user
    Join Date
    Jul 2006
    Posts
    122
    Thanks for the reply

    That works very well for rebuilding a mtab from scratch but still the root of the problem lies in the mtab NEVER being updated by umount (maybe a bug in umount but I doubt it). So umounted drives are simply left in the mtab to collect until the user clears the file and rebuilds it.

    I didnt notice for afew days after installing 5.1... I issued ' mount ' just to check to see what was mounted and got a screen full of stuff ....LOL

    From what I've been reading gthe past few days alot modern distros are moving away from a file based mtab to a simple symlink to /proc/mounts since its basicly impossible from /proc/mounts to get out of sync since it is the kernels view of the mounted filesystems....

    I tried this and its working quite well except for one very small issue I've found so far.

    I have a smiple bash script called " diskfree " that parses the output of ' df ' and returns it in a nice, readable format.
    Code:
    #!/bin/sh
    
    DISC=$1
    
    if [ "$DISC" ]; then
      CHECK=`mount | grep $DISC ` ;
      if [ "$CHECK" ]; then
        PARTITION=`df -h |grep $DISC |awk '{print $1}'` ;
        SIZE=`df -h|grep $DISC|awk '{print $2}'` ;
        USED=`df -h|grep $DISC|awk '{print $3}'` ;
        FREE=`df -h|grep $DISC|awk '{print $4}'` ;
        echo "Partition: $PARTITION" ;
        echo "Total size: $SIZE" ;
        echo "Used space: $USED" ;
        echo "Free space: $FREE" ;
      else echo $DISC is not mounted or does not exist!
      fi
    else echo "You must specify a device. (Example: /dev/hda1)"
    fi


    if I issue ` diskfree /dev/sda1 ' i get:
    Code:
    onemyndseye@exodus:~$ diskfree /dev/sda1
    df: `/dev/.static/dev': Permission denied
    df: `/dev/.static/dev': Permission denied
    df: `/dev/.static/dev': Permission denied
    df: `/dev/.static/dev': Permission denied
    Partition: /dev/sda1
    Total size: 17G
    Used space: 11G
    Free space: 7.0G
    onemyndseye@exodus:~$
    Or ` df ` .... I get:
    Code:
    onemyndseye@exodus:~$ df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    rootfs                17823516  10491092   7332424  59% /
    udev                     10240        88     10152   1% /dev
    /dev/sda1             17823516  10491092   7332424  59% /
    df: `/dev/.static/dev': Permission denied
    none                    147456         0    147456   0% /dev/shm

    But the little burp goes away if issued by root:
    Code:
    root@exodus:/home/onemyndseye# df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    rootfs                17823516  10491092   7332424  59% /
    udev                     10240        88     10152   1% /dev
    /dev/sda1             17823516  10491092   7332424  59% /
    /dev/sda1             17823516  10491092   7332424  59% /dev/.static/dev
    none                    147456         0    147456   0% /dev/shm

    This may can be fixed by reconfiguring udev in some way but unfortunatley my experience is limited with udev itself..... If you ` chmod 0755 /dev/.static ` it goes away all together...... But I do not know is this is a sane fix .... also this fix does not persist across a reboot for me....so it would have to be added to a script to-be-exec'ed at bootime.

    Take Care,
    -Justin
    One Mynds Eye

Similar Threads

  1. Horizontal Sync
    By Aldago in forum General Support
    Replies: 1
    Last Post: 10-01-2004, 11:50 AM
  2. 3.4 HDInstall fstab/mtab overwritten during boot?
    By cmidkiff in forum Hdd Install / Debian / Apt
    Replies: 1
    Last Post: 05-13-2004, 03:15 PM
  3. MTAB file
    By bob58 in forum General Support
    Replies: 0
    Last Post: 04-01-2004, 02:18 PM
  4. time sync with ntp server(s)
    By lothario in forum Networking
    Replies: 0
    Last Post: 03-15-2004, 01:32 AM
  5. LCD panel says: Sync out of Range
    By Leeb in forum General Support
    Replies: 9
    Last Post: 01-22-2004, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Dell 6P85J 4TB ST4000NM0063 7.2k 6Gb/s 3.5” SAS SED Hard Drive with Tray picture

Dell 6P85J 4TB ST4000NM0063 7.2k 6Gb/s 3.5” SAS SED Hard Drive with Tray

$39.99



Seagate ST8000DM004 8TB 3.5

Seagate ST8000DM004 8TB 3.5" 6Gb/s 256MB SATA HDD P/N: 2CX188-300 Tested

$149.99



Western Digital HUS726T4TAL5204 4TB 7.2K SAS 12Gb/s 3.5

Western Digital HUS726T4TAL5204 4TB 7.2K SAS 12Gb/s 3.5" 512e HDD NetApp X375A

$64.00



(ST8000NM0045) SEAGATE ENTERPRISE 8TB 7200RPM 4Kn SATA 6Gb/s 3.5

(ST8000NM0045) SEAGATE ENTERPRISE 8TB 7200RPM 4Kn SATA 6Gb/s 3.5" HARD DRIVE

$199.99



Seagate ST500DM009 BarraCuda 500 GB 3.5

Seagate ST500DM009 BarraCuda 500 GB 3.5" SATA III Desktop Hard Drive

$14.99



HGST Ultrastar 7K4000 3TB 7200RPM SATA III 3.5

HGST Ultrastar 7K4000 3TB 7200RPM SATA III 3.5" Hard Drive HDD HUS724030ALA640

$39.99



Dell ST6000NM0034 1HT27Z-150 NWCCG 6TB SAS 3.5 7.2K ENTERPRISE SERVER DRIVE picture

Dell ST6000NM0034 1HT27Z-150 NWCCG 6TB SAS 3.5 7.2K ENTERPRISE SERVER DRIVE

$68.99



HGST HUA723030ALA640 3TB SATA 7200 RPM 3.5 in Enterprise HDD | 0F14044 (100%) picture

HGST HUA723030ALA640 3TB SATA 7200 RPM 3.5 in Enterprise HDD | 0F14044 (100%)

$45.00



DELL 2TB Enterprise HDD (7200RPM, 3.5

DELL 2TB Enterprise HDD (7200RPM, 3.5", SATA III, 128MB Cache) HUS722T2TALA600

$49.95



Seagate ST12000NM0127 12TB 256MB 7200RPM 3.5

Seagate ST12000NM0127 12TB 256MB 7200RPM 3.5" SATA 6.0Gb/s Enterprise Hard Drive

$318.99