[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fs translators and fsck [Was: init scripts don't fsck extra partitio
From: |
Alfred M. Szmidt |
Subject: |
Re: fs translators and fsck [Was: init scripts don't fsck extra partitions] |
Date: |
Fri, 30 Dec 2005 23:45:31 +0100 |
The action of mounting a fs is intricated with the action of
checking it beforehand, that's what I'd like to express in some
way. Fstab does that on usual unices. The hurdish way of mounting
is rather setting a translator, so I'd rather see checking being
done at translator setting time. A manual settrans -a /foo
/hurd/ext2fs /dev/bar should probably not start a check, but usual
"administrative" passive translators should (on system startup, not
just when first accessed).
As I noted on IRC, I still think that putting the functionality into
either libdiskfs or settrans/mount is a bad idea. A script might end
up using these commands, and be run in the background. File-system
checking is an inherently interactive task. Just modifing
libdiskfs/mount/settrans to do this specific task in an interactive
manner on boot is overkill.
Having a special script that updates fstab is a good idea though; and
very simply to write. Infact, here is what I snatched from someone, I
do not remeber who, and this person can blame himself for not writying
his name in the header or adding a proper copyright blurb. :-) I have
modified it a bit, since I'll use if for the GNU system to have DMD
run it on first boot (when setting up inital system translators).
===File ~/detect-partitions=================================
#!/bin/bash
#
# This script detects and sets up ext2 and swap partitions and then
# puts them into /etc/fstab. requirements:
#
# devprobe, parted, settrans, cut, grep, echo, /hurd/storeio pipes
# working, and a writable /dev directory, and /dev/null
#
# swapon can be executed after this script.
fstab="/etc/fstab"
diskdetected=0
echo -n "Detecting disk partitions... "
# Probe for standard devices as listed in libparted.
disks=`devprobe hd0 hd1 hd2 hd3 hd4 hd5 hd6 hd7 sd0 sd1 sd2 sd3 sd4 sd5`
for disk in ${disks} ; do
if [ ! -b /dev/${disk} ]; then
MAKEDEV -D /dev ${disk}
parted -s /dev/${disk} print 2>/dev/null > /tmp/.partinfo
if [ $? != 0 ]; then
continue;
fi
slices=`cat /tmp/.partinfo | grep -e "ext2|ufs" | cut -f1 -d' '
2>/dev/null`
for slice in ${slices} ; do
if [ ! -b /dev/${disk}s${slice} ]; then
MAKEDEV -D /dev ${disk}s${slice}
diskdetected="1"
## FIXME: This is lame, and stupid.
mkdir -p /mnt/disks/${disk}/${slice}
echo -n " /dev/${disk}s${slice}"
echo "/dev/${disk}s${slice} /mnt/disks/${disk}/${slice}
ext2 ro 0 0" >> ${fstab}
fi
done
slices=`parted -s /dev/${disk} print | grep "linux-swap" | cut -f1 -d'
' 2>/dev/null`
for slice in ${slices} ; do
if [ ! -b /dev/${disk}s${slice} ]; then
MAKEDEV -D /dev ${disk}s${slice}
diskdetected=1
echo -n " /dev/${disk}s${slice}"
echo "/dev/${disk}s${slice} none swap sw
0 0" >> ${fstab}
fi
done
fi
done
if [ ${diskdetected} == 0 ]; then
echo " none."
else
echo
fi
exit 0
============================================================