Mounting : Making It Permanent

Making It “Stick”

So you’ve mounted the new hard drive at /newhome. But what will happen the next time you reboot?

It’ll be gone. Darn.

How do you make this change stick? There are two ways.

The first is to make a change to a very critical system file, /etc/fstab. This is the “file system table” file.

BACK UP THIS FILE BEFORE YOU CHANGE ANYTHING.

Under most distros, you can directly edit /etc/fstab. This is a a touchy idea, because there are more changes that need to be made than just the addition of text. (What do you suppose these are?)

Some newer distros use the utility fstab-sync. This utility is flatly mandatory under any system that has a Hardware Abstraction Layer (HAL). It’s run by the HAL daemon upon boot, and is rarely if ever invoked from the command line.

However, under some circumstances you may need to disable this automated mounting process. Do this by changing the attributes of /etc/fstab:

chattr +i /etc/fstab

For manual permanent mounting, you’ll need to add a line to /etc/fstab:

/dev/hdc1 /newhome ext3 defaults 0 2

  • The first field points to the device, in this case hard drive C.
  • The second field names the point to which this device will mount, here /newhome.
  • The third field names the type of file system. Under some circumstance (depending on kernel configuration) you can use auto.
  • The fourth field specifies any mount options. You can accept the system defaults with defaults.
  • The fifth field has to do with file system dumps. If the new mount doesn’t need to be included in dumps, 0 is the option to use.
  • The sixth field is used by the fsck utility (similar to ScanDisk in Windows).
    • 1 indicates this is part of the root file system, and should be scanned first.
    • 2 indicates file systems other than the root system, and
    • 0 will cause fsck to ignore this mount.

—> READ THE MAN PAGE FOR MOUNT!

(When would you want fsck to ignore a mount?)

 

Making It “Stick” – Quick and Dirty

There’s another way to mount a device. You can run the mount command as part of your boot process. (When would you want to do this, and why?)

Simply add the mount command to the end of the file /etc/rc.local:

mount -t ext3 /dev/hdc1 /newhome

(When does this file run?)