mount and umount
Asheville Joe
josephj at main.nc.us
Sun Sep 21 17:42:35 EDT 2003
I have a removeable ide hard disk as hdb1. I want to write a script to
access it for backup (a copy of my fstab is included below. I wanted to
test if it was mounted, and, if not, mount it. To try it out, I went
into an Xterm.
I su'd and mounted it -
mount /dev/hdb1 /mount/portable. I did a cd /mnt/portable and wrote a
small junk file to it and that worked. So far so good. Then, I did a
cd .. and umount /dev/hdb1.
I tried that again and it told it was not mounted (as expected). BUT, I
then did an ls /mnt/portable and it still worked! I even copied another
small junk file to it (although I had to su for it to work, which I
don't understand).
I thought that when I unmounted the device, trying to access, let alone
write to /mnt/portable would fail and generate an error. It didn't!
What don't I understand (about this in particular :) )?
How do you test to see if a device is mounted (or accessible?) ?
Joe
/etc/fstab:
/dev/hda7 / ext3 defaults 1 1
/dev/hda6 /boot ext2 defaults 1 2
none /dev/pts devpts mode=0620 0 0
/dev/hda9 /home ext3 defaults 1 2
none /mnt/cdrom supermount
dev=/dev/scd0,fs=auto,ro,--,iocharset=iso8859-1,codepage=850,umask=0 0 0
/dev/hda1 /mnt/dos_hda1 vfat
iocharset=iso8859-1,codepage=850,umask=0,defaults 0 0
/dev/hda5 /mnt/dos_hda5 vfat
iocharset=iso8859-1,codepage=850,umask=0,defaults 0 0
none /mnt/floppy supermount
dev=/dev/fd0,fs=auto,--,iocharset=iso8859-1,sync,codepage=850,umask=0 0 0
/dev/hdb1 /mnt/portable ext3 rw,user,noauto,exec,suid 0 0
none /proc proc defaults 0 0
/dev/hda8 swap swap defaults 0 0
----------------------------------
"I can assure you the flying saucers, given that they exist, are not
constructed by any power on earth." --Harry S. Truman; White House Press
Conference, Washington DC, April 4, 1950.
More information about the nflug
mailing list