Difference between revisions of "Fstab"
(update all the fstab's and use findmnt rather than mount to check settings)
|Line 187:||Line 187:|
== Other resources ==
== Other resources ==
* [http://www.tuxfiles.org/linuxhelp/fstab.html tuxfiles]
* [http://www.kernel.org/pub/linux/docs/device-list/devices.txt Full device listing including block device]
*[http://www.kernel.org/pub/linux/docs/device-list/devices.txt Full device listing including block device]
* [http://www.pathname.com/fhs/2.2/index.html Filesystem Hierarchy Standard]
*[http://www.pathname.com/fhs/2.2/index.html Filesystem Hierarchy Standard]
* [http://www.askapache.com/web-hosting/super-speed-secrets.html 30x Faster Web-Site Speed] (Detailed tmpfs)
*[http://www.askapache.com/web-hosting/super-speed-secrets.html 30x Faster Web-Site Speed] (Detailed tmpfs)
Revision as of 16:44, 10 August 2011
The Template:Filename file contains static filesystem information. It defines how storage devices and partitions are to be mounted and integrated into the overall system. It is read by the Template:Codeline command to determine which options to use when mounting a specific device or partition.
The Template:Filename file contains the following fields separated by a space or tab:
<file system> <dir> <type> <options> <dump> <pass>
- <file system> - the partition or storage device to be mounted.
- <dir> - the mountpoint where <file system> is mounted to.
- <type> - the file system type of the partition or storage device to be mounted. Many different file systems are supported: Template:Codeline and Template:Codeline. The Template:Codeline type lets the mount command guess what type of file system is used. This is useful for removable devices such as cdroms and dvds.
- <options> - the options of the filesystem to be used. Note that some options are filesystem specific. Some of the most common options are:
- Template:Codeline - Mount automatically at boot, or when the command Template:Codeline is issued.
- Template:Codeline - Mount only when you tell it to.
- Template:Codeline - Allow execution of binaries on the filesystem.
- Template:Codeline - Disallow execution of binaries on the filesystem.
- Template:Codeline - Mount the filesystem read-only.
- Template:Codeline - Mount the filesystem read-write.
- Template:Codeline - Allow any user to mount the filesystem. This automatically implies Template:Codeline, unless overridden.
- Template:Codeline - Allow any user in the users group to mount the filesystem.
- Template:Codeline - Allow only root to mount the filesystem.
- Template:Codeline - Allow the owner of device to mount.
- Template:Codeline - I/O should be done synchronously.
- Template:Codeline - I/O should be done asynchronously.
- Template:Codeline - Interpret block special devices on the filesystem.
- Template:Codeline - Don't interpret block special devices on the filesystem.
- Template:Codeline - Allow the operation of suid, and sgid bits. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.
- Template:Codeline - Block the operation of suid, and sgid bits.
- Template:Codeline - Don't update inode access times on the filesystem. Can help performance (see atime options).
- Template:Codeline - Do not update directory inode access times on the filesystem. Can help performance (see atime options).
- Template:Codeline - Update inode access times relative to modify or change time. Access time is only updated if the previous access time was earlier than the current modify or change time. (Similar to noatime, but doesn't break mutt or other applications that need to know if a file has been read since the last time it was modified.) Can help performance (see atime options).
- Template:Codeline - The Template:Codeline option to flush data more often, thus making copy dialogs or progress bars to stay up until all data is written.
- Template:Codeline - the default mount options for the filesystem to be used. The default options for Template:Codeline are: Template:Codeline.
- <dump> - used by the dump utility to decide when to make a backup. Dump checks the entry and uses the number to decide if a file system should be backed up. Possible entries are 0 and 1. If 0, dump will ignore the file system; if 1, dump will make a backup. Most users will not have dump installed, so they should put 0 for the <dump> entry.
- <pass> - used by fsck to decide which order filesystems are to be checked. Possible entries are 0, 1 and 2. The root file system should have the highest priority 1 - all other file systems you want to have checked should have a 2. File systems with a value 0 will not be checked by the fsck utility.
There are three ways to identify a partition or storage device in Template:Filename: by its kernel name descriptor, label or UUID. The advantage of using UUIDs or labels is that they are not dependent on the disks order. This is useful if the storage device order in the BIOS is changed, or if you switch the storage device cabling. Also, sometimes the BIOS may occasionally change the order of storage devices. Read more about this in the persistent block device naming article.
You can get the kernel name descriptors using Template:Codeline. The kernel names are listed in the first row:
See the file example.
In order to use labels, the devices or partitions must have unambiguous labels. Labels should be unambiguous to prevent any possible conflicts - each label should be unique. To label a device or partition, see this article. To list all devices and partitions with their labels, you can use the command Template:Codeline. In Template:Filename you prefix the device label with Template:Codeline :
All partitions and devices have a unique UUID. They are generated by the make-filesystem utilities (Template:Codeline) when you create the filesystem. To list all devices and partitions with their UUID, you can also use Template:Codeline. In Template:Filename you prefix the device UUID with Template:Codeline :
Tips and tricks
In case your swap partition doesn't have an UUID, you can add it manually. This happens when the UUID of the swap is not shown with the Template:Codeline command. Here are some steps to assign a UUID to your swap:
Identify the swap partition:
# swapon -s
Disable the swap:
# swapoff /dev/sda7
Recreate the swap with a new UUID assigned to it:
# mkswap -U random /dev/sda7
Activate the swap:
# swapon /dev/sda7
You can use the escape character "\" followed by the 3 digit octal code "040" to emulate spaces in a path:
The use of Template:Codeline, Template:Codeline or Template:Codeline can help disk performance for ext2, ext3, and ext4 filesystems. Linux by default keeps a record (writes to the disk) every times it reads from the disk Template:Codeline. This was more purposeful when Linux was being used for servers; it doesn't have much value for desktop use. The worst thing about the default Template:Codeline option is that even reading a file from the page cache (reading from memory instead of the disk) will still result in a disk write! Using the Template:Codeline option fully disables writing file access times to the disk every time you read a file. This works well for almost all applications, except for a rare few like Mutt that need the such information. For mutt, you should only use the Template:Codeline option. Using the Template:Codeline option enables the writing of file access times only when the file is being modified (unlike Template:Codeline where the file access time will never be changed and will be older than the modification time). The Template:Codeline option disables the writing of file access times only for directories while other files still get access times written. The best compromise might be the use of Template:Codeline in which case programs like Mutt will continue to work, but you'll still have a performance boost because files will not get access times updated unless they are modified.
tmpfs is a temporary filesystem that resides in memory and/or your swap partition(s), depending on how much you fill it up. Mounting directories as tmpfs can be an effective way of speeding up accesses to their files, or to ensure that their contents are automatically cleared upon reboot.
By default, a tmpfs partition has its maximum size set to half your total RAM, but this can be customized. Note that the actual memory/swap consumption depends on how much you fill it up, as tmpfs partitions don't consume any memory until it is actually needed.
You may or may not want to specify the size here, but you should leave the Template:Codeline option alone in these cases to ensure that they have the correct permissions (1777). In the example above, Template:Filename will be set to use up to half of your total RAM. To explicitly set a maximum size, use the Template:Codeline mount option: Template:File
See the mount command man page for more information.
Reboot for the changes to take effect. Note that although it may be tempting to simply run Template:Codeline to make the changes effective immediately, this will make any files currently residing in these directories inaccessible (this is especially problematic for running programs with lockfiles, for example). However, if all of them are empty, it should be safe to run Template:Codeline instead of rebooting (or mount them individually).
To use tmpfs for Template:Filename and Template:Filename, you can simply symlink them to Template:Filename. Make sure to close anything important before doing this, because you will have to reboot, and daemons may not stop cleanly.
- Persistent block device naming
- Writing on a FAT32 partition as a normal user
- NTFS Write Support
- Firefox Ramdisk
- Using tmpfs for /var/*