-
Senior Member
registered user
/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
-
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.
-
Senior Member
registered user
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
-
By Aldago in forum General Support
Replies: 1
Last Post: 10-01-2004, 11:50 AM
-
By cmidkiff in forum Hdd Install / Debian / Apt
Replies: 1
Last Post: 05-13-2004, 03:15 PM
-
By bob58 in forum General Support
Replies: 0
Last Post: 04-01-2004, 02:18 PM
-
By lothario in forum Networking
Replies: 0
Last Post: 03-15-2004, 01:32 AM
-
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
-
Forum Rules

🔀 Juniper Networks EX2300-C-12P 12× Gigabit PoE+ • 2× 10G SFP+ Compact Switch ⚡
$109.99

Juniper EX2300 12-Port Gigabit PoE+ Managed Network Switch P/N: EX2300-C-12P
$149.99

Juniper EX3400-24P 24-Port PoE+ GbE + 4-Port 1/10Gb SFP Switch
$245.00

Juniper Networks Mist Wireless Access Points, Model AP45
$59.99

Juniper MX204 +JUNOS and Dual Power Supply
$7299.99

Juniper Networks AP33-US Indoor Wifi6 (US Version) 5GHz: 4x4:4; 2.99
$24.99

Juniper EX2300-C 12 Port Compact Gigabit Switch EX2300-C-12p Discounted Cosmetic
$79.86

Juniper EX3400-48T-AFI Ethernet Network Switch 48x1GbE 4x10GbE SFP+ 2x40GbE QSFP
$139.00

Juniper Networks EX3400-24T 24-Port Ethernet Switch w/Power Cord
$174.99

Juniper Networks EX2300-48P 48-Port Gigabit PoE Managed Ethernet Switch
$79.99