Results 1 to 3 of 3

Thread: /etc/mtab out of sync

Hybrid View

  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
  •  


Windows XP, Vista, 8.1, Linux Knoppix, Office XP,  (6 CDS) picture

Windows XP, Vista, 8.1, Linux Knoppix, Office XP, (6 CDS)

$10.00



KNOPPIX 9.1 Linux Install & Live DVD 32bit & 64bit picture

KNOPPIX 9.1 Linux Install & Live DVD 32bit & 64bit

$19.99



KNOPPIX USB DVD OS , BEST OF ALL HIGHLY RECOMENDED picture

KNOPPIX USB DVD OS , BEST OF ALL HIGHLY RECOMENDED

$11.99



Knoppix Live GNU Linux System 9.1 on Bootable CD / DVD / USB Flash Drive picture

Knoppix Live GNU Linux System 9.1 on Bootable CD / DVD / USB Flash Drive

$5.99



Knoppix Linux Bootable OS v8.6

Knoppix Linux Bootable OS v8.6 "Original Live Operating System" 16G USB Stick

$20.85



Knoppix NSM 1.2 picture

Knoppix NSM 1.2

$8.00



VINTAGE SOFTWARE | KNOPPIX STD 0.1 (SECURITY TOOLS DISTRIBUTION) picture

VINTAGE SOFTWARE | KNOPPIX STD 0.1 (SECURITY TOOLS DISTRIBUTION)

$7.57



Knoppix Linux Bootable OS v8.6

Knoppix Linux Bootable OS v8.6 "Original Live Operating System" 32G USB Stick

$21.42



Hamshack Live DVD-ROM picture

Hamshack Live DVD-ROM

$7.00



Knoppix 5.0.1 ULTRA RARE Linux DVD - Linux Pro Extra August 2006 picture

Knoppix 5.0.1 ULTRA RARE Linux DVD - Linux Pro Extra August 2006

$33.98