Mounting.


As mentioned before being able to mount (plug a device, for example a HDD, into the directory tree) any physical drive into any part of our directory tree is very useful. In this way we can gain temporary access to a floppy drive, CD-ROM or a HDD, but we can also mount this device permanently as well!

If you have a Suse Linux system you see in the / root directory two folders labelled floppy & cdrom, if you look in them you will see that they are both empty, that is because they are only directories & no device (physical drive) is mounted in those directories at the moment.

If you type mount /dev/fd0 /floppy you will "plug" the floppy drive into the root directory called floppy. You can then see the contents of the floppy & have full access to that drive. The same goes for the CD-ROM or any other physical drive. You will notice that once you have mounted a CD-ROM you can't remove the CD from the drive until you "unmount" the device. Linux will attach the contents of any device until you tell it otherwise, that goes equally for the CD-ROM. To "unmount" the floppy just type umount /dev/fd0. You can also permanently mount a HDD partition for example simply by using the yast tool (in the case of a Suse Linux), or by making an entry in the fstab (file system table) file in the /etc directory. Just edit the file with any text editor & reboot the computer. This is called defining a mount point.

For example you want to place to whole of the expanding website, which is located in the /usr/local/httpd/htdocs directory (by default), & give it a whole partition on a new HDD. This would help the speed of the whole server if you have lots of visitors. You would just have to add the following line into the file /etc/fstab.

/dev/hdb1      /usr/local/httpd/htdocs     ext2      defaults    1    2

The ext2 defines what file system is to be used on that device. If you try this you may get a big surprise after you reboot :o) , you may find that the directory /usr/local/httpd/htdocs is empty :o) lol. If you hadn't thought of copying the contents of the old /usr/local/httpd/htdocs directory onto the device hdb1 (i.e the first partition on the new HDD, hdb) before you rebooted then this device will be empty. The solution is that you mount the new device (hdb1) into a temporary directory, any directory will do, & then either move or copy the files onto the new device, "unmount" the device, & set the new mount point & reboot.

As you can see there are many benefits to be gained from mounting (or setting a mount point) particular directories onto other devices or drives, both in terms of server speed & security.



back a page    back to main index    forward a page
copyright 2001 Rob Hawke.
rob@highasakite.net