One can use Label, UUID, besides the device nodes to mount a device.
More information can be found at http://ubuntuforums.org/showthread.php?t=283131
Understanding fstab
Sorry this is such a long post.
I added much of this information to the Ubuntu wiki.
Ubuntu Wiki : fstab
There are essentially 5 sections:
1. Introduction / Mount. 2. "fstab syntax" - Syntax and fstab options. 3. How to label, FAT and Linux file systems. 4. Examples, FAT and Linux native file systems. 5. References
Scroll down to the section you need.
Introduction
/etc/fstab is a system configuration file and is used to tell the Linux kernel which partitions (file systems) to mount and where on the file system tree.
/etc/mtab is an index of all mounted partitions/file systems.
Note: See references section at the end of this how to for useful links.
How to mount
The mount command and fstab go hand in hand:
1. Options for mount and fstab are similar. 2. If a device/partition is not listed in fstab ONLY ROOT may mount the device/partition. 3. Users can mount a removable device using pmount. 4. Users may mount a device/partition if the device is in fstab with the proper options.
How to mount Mount Partitions Automatically (At BOOT). Filesystems and Mounting Thanks Hermanzone
mount has a multitude of options. Manpage: man mount
pmount: Pmount allows a user to mount removable media. pmount uses /media/ as the mount point.
Syntax: Quote: pmount Example: Code:
pmount /dev/dsa1 data
This creates a directory "data" in /media (mount point is /media/data) and mounts your removable device there.
To unmount: Code:
pumount
Note: pmount does not like to mount to an existing directory in /media.
* For example, if you have a directory /media/usb ; pmount /dev/sda1 usb may fail. * If you are having problems with gnome-volume-manager or pmount check the contents of /media and delete directories as needed. * Obviously do not delete a directory in /media if a device is mounted to this mount point.
Configure pmount for internal drives
To show your partitions/usb devices, first plug in your usb card.
To list your mounted partitions: Code:
mount
To list all your partitions, mounted or not: Code:
sudo fdisk -l
To list all your partitions by UUID: First connect all your devices, then: Code:
ls /dev/disk/by-uuid -alh
============== END OF INTRODUCTION ===============
x will be a letter starting with a, then b,c,.... y will be a number starting with 1, then 2,3,....
Thus hda1 = First partition on the master HD.
See Basic partitioning for more information
Note: zip discs are always numbered "4". Example: USB Zip = /dev/sda4.
Note: You can also identify a device by udev, volume label (AKA LABEL), or uuid.
These fstab techniques are helpful for removable media because the device (/dev/sdxy) may change. For example, sometimes the USB device will be assigned /dev/sda1, other times /dev/sdb1. This depends on what order you connect USB devices, and where (which USB slot) you use to connect. This can be a major aggravation as you must identify the device before you can mount it. fstab does not work well if the device name keeps changing.
To list your devices, first put connect your USB device (it does not need to be mounted). By volume label: Code:
ls /dev/disk/by-label -lah
By id: Code:
ls /dev/disk/by-id -lah
By uuid: Code:
ls /dev/disk/by-uuid -lah
IMO, LABEL is easiest to use as you can set a label and it is human readable.
The format to use instead of the device name in the fstab file is:
Originally grub is installed in MRB of /dev/sda0. Since I want to replace the disk of /dev/sd0, need to install the same grub in /dev/sda1.
#sudo grub grub> setup (hd1) grub> quit
Install Grub ------------------ In order to install GRUB as your boot loader, you need to first install the GRUB system and utilities under your UNIX-like operating system (see Obtaining and Building GRUB). You can do this either from the source tarball, or as a package for your OS.
After you have done that, you need to install the boot loader on a drive (floppy or hard disk). There are two ways of doing that - either using the utility grub-install (see Invoking grub-install) on a UNIX-like OS, or by running GRUB itself from a floppy. These are quite similar, however the utility might probe a wrong BIOS drive, so you should be careful.
Also, if you install GRUB on a UNIX-like OS, please make sure that you have an emergency boot disk ready, so that you can rescue your computer if, by any chance, your hard drive becomes unusable (unbootable).
GRUB comes with boot images, which are normally put in the directory /usr/lib/grub/i386-pc. If you do not use grub-install, then you need to copy the files stage1, stage2, and *stage1_5 to the directory /boot/grub, and run the grub-set-default (see Invoking grub-set-default) if you intend to use `default saved' (see default) in your configuration file. Hereafter, the directory where GRUB images are initially placed (normally /usr/lib/grub/i386-pc) will be called the image directory, and the directory where the boot loader needs to find them (usually /boot/grub) will be called the boot directory.
Caution: Installing GRUB's stage1 in this manner will erase the normal boot-sector used by an OS.
GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD directly, so using it on a boot sector (the first sector of a partition) should be okay. But generally, it would be a good idea to back up the first sector of the partition on which you are installing GRUB's stage1. This isn't as important if you are installing GRUB on the first sector of a hard disk, since it's easy to reinitialize it (e.g. by running `FDISK /MBR' from DOS).
If you decide to install GRUB in the native environment, which is definitely desirable, you'll need to create a GRUB boot disk, and reboot your computer with it. Otherwise, see Installing GRUB using grub-install.
Once started, GRUB will show the command-line interface (see Command-line interface). First, set the GRUB's root device4 to the partition containing the boot directory, like this:
grub> root (hd0,0)
If you are not sure which partition actually holds this directory, use the command find (see find), like this:
grub> find /boot/grub/stage1
This will search for the file name /boot/grub/stage1 and show the devices which contain the file.
Once you've set the root device correctly, run the command setup (see setup):
grub> setup (hd0)
This command will install the GRUB boot loader on the Master Boot Record (MBR) of the first drive. If you want to put GRUB into the boot sector of a partition instead of putting it in the MBR, specify the partition into which you want to install GRUB:
grub> setup (hd0,0)
If you install GRUB into a partition or a drive other than the first one, you must chain-load GRUB from another boot loader. Refer to the manual for the boot loader to know how to chain-load GRUB.
After using the setup command, you will boot into GRUB without the GRUB floppy. See the chapter Booting to find out how to boot your operating systems from GRUB.