Entries
Entry overview
The File_Fstab_Entry class represents all the information available about a particular entry in a Fstab file.
Entry properties
The entry has a number of properties which represent the information in the fstab file.
- $device
This is the path to the block device for this entry. $device, $uuid, and $label are mutually exclusive; only one of the three may be set.
- $uuid
The UUID of the device.
- $label
The label for this device.
- $mountPoint
The directory this device is mounted on.
- $fsType
The type of filesystem on $device.
- $mountOptions
Array of mount options for this device.
- $dumpFrequency
How often / if this filesystem should be backed up by dump.
- $fsckPassNo
Order of / if this device should be checked by fsck when the system boots.
You may want to read fstab(5) for more information about what these fields mean.
Finding entries
There are a number of ways of finding a specific entry from the fstab. You may find based on device, mountpoint, filesystem label, or UUID.
Finding by device
To find by device, you want to use the getEntryForDevice() function. The single argument this function accepts is the path to the block device for an entry.
Пример 39-1. Get entry by device
|
Finding by path (mountpoint)
You may want to find a device based on the path it is mounted on; for example, you may want to get the entry for /cdrom, without caring if the CD device is /dev/hdb, /dev/cdrom, or some other device. To do this, use the getEntryForPath() function.
Пример 39-2. Get entry by path
|
Finding by UUID
Some systems use a filesystem UUID to specify the device to mount. A UUID may look like this: b46ad2ee-01f3-4041-96ca-91d35d059417. The getEntryForUUID() function handles this.
Пример 39-3. Get entry by UUID
|
Finding by label
Some filesystems allow you to specify a textual label to a filesystem. For example, you may label your root device rootdev, the device you mount on /home could be named homedirs and so forth. File_Fstab supports getting entries based on the device label. This is accomplished by using the getEntryForLabel() function.
Пример 39-4. Get entry by label
|
Adding entries
In addition to reading fstab files, you may modify them as well.
Пример 39-5. Add an entry for a floppy disk
|
Пред. | Начало | След. |
Introduction | Уровень выше | Saving |