![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Ubuntu 9.10 is out!!!
When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu. The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely. |
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||||||||||||||||||||||
|
Ubuntu Guru
![]() |
![]() Understanding fstab Sorry this is such a long post. I added much of this information to the Ubuntu wiki. update May 2009 : tbuss kindly converted this post to a pdf which is available here. The pdf can be downloaded if you log into scribd. You may use openid to log in, so should be easy if you also have an account at launchpad. Ubuntu Wiki : fstab There are essentially 5 sections:
Scroll down to the section you need. Introduction If you simply want a gui tool to manage your partitions (/etc/fstab) try Pysdm. ![]() /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.pysdm Screen Shot /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:
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/<NAME> as the mount point. Syntax: Quote:
Code:
pmount /dev/dsa1 data To unmount: Code:
pumount <NAME>
Configure pmount for internal drives To show your partitions/usb devices, first plug in your usb card. To list your mounted partitions: Code:
mount Code:
sudo fdisk -l First connect all your devices, then: Code:
ls /dev/disk/by-uuid -alh fstab Syntax Quote:
/dev/hdxy or /dev/sdxy. 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 informationNote: 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 Code:
ls /dev/disk/by-id -lah Code:
ls /dev/disk/by-uuid -lah The format to use instead of the device name in the fstab file is: LABEL=<label> (Where <label> is the volume label name, ex. "data"). UUID=<uuid> (Where <uuid> is some alphanumeric (hex) like fab05680-eb08-4420-959a-ff915cdfcb44). Again, IMO, using a label has a strong advantage with removable media (flash drives). See How to use Labels below. For udev: udev does the same thing as LABEL, but I find it more complicated. See How to udev for a very nice how to on udev. Mount point. This is where the partition is mounted or accessed within the "tree" (ie /mnt/hda1). You can use any name you like. In general
Examples:
To make a mount point: Code:
sudo mkdir /media/usb auto: The file system type (ext3, iso9660, etc) it detected automatically. Usually works. Used for removable devices (CD/DVD, Floppy drives, or USB/Flash drives) as the file system may vary on these devices. Linux file systems: ext2, ext3, jfs, reiserfs, reiser4, xfs, swap. Windows: vfat = FAT 32, FAT 16 ntfs= NTFS Note: For NTFS rw ntfs-3g CD/DVD/iso: iso9660 To mount an iso image (*.iso NOT CD/DVD device):Network file systems: This section assumes the server and client are already setup. nfs Example: Quote:
More detailed information on nfssmb (samba) : Samba mounts can be performed very easily via gui tools (See Ubuntu Wiki Setting up Samba). If you mount a samba share with the gui tools it will be placed in ~/.gvfs , a hidden directory in your home directory. This section is limited to fstab and you will need a fstab entry to mount samba shares at boot. smbfs is now depreciated for cifs : http://linux-cifs.samba.org/ cifs still uses a credentials file to avoid the need to enter a password. If you do not use a credentials file, you will mount a samba share with sudo and enter your username and password in a terminal. Quote:
samba_user = samba user (on server).samba_user_password = samba user password (on server).
smbfs : depreciated, but similar. Quote:
More detailed information on see : The Official Samba 3.2.x HOWTO and Reference Guidesshfs : Network shares over ssh http://ubuntu.wordpress.com/2005/10/...m-using-sshfs/ Code:
sshfs#user@server:/share fuse user,allow_other 0 0
Options: Ubuntu 8.04 now defaults to "relatime". For a discussion of this option see : http://lwn.net/Articles/244829/ defaults = rw, suid, dev, exec, auto, nouser, and async. Options for a separate /home : nodev,nosuid,relatime My recommended options for removable (USB) drives are in green. auto= mounted at boot noauto= not mounted at boot user= when mounted the mount point is owned by the user who mounted the partition users= when mounted the mount point is owned by the user who mounted the partition and the group users ro= read only rw= read/write VFAT/NTFS: Ownership and permissios of vfat / ntfs are set at the time of mounting. This is often a source of confusion. uid= Sets owner. Syntax: may use user_name or user ID #. gid= sets group ownership of mount point. Again may use group_name or GID #. umask can be used to set permissions if you wish to change the default. Syntax is "odd" at first. To set a permissions of 777, umask=000 To set permissions of 700, umask=077 Best is to set directories with executable permissions and file with read write. To do this, use fmask and dmask (rather then umask): dmask=027 fmask=137 With these options files are not executable (all colored green in a terminal w/ ls) Linux native file systems: Use defaults or users. To change ownership and permissions, mount the partition, then use chown and chmod. Note: Warning re: sync and flash devices: Warning Additional Options: (From wiki.linuxquestions.org/wiki/Fstab):
Dump Dump: Dump field sets whether the backup utility dump will backup file system. If set to "0" file system ignored, "1" file system is backed up. Fsck order Fsck: Fsck order is to tell fsck what order to check the file systems, if set to "0" file system is ignored. See also: Tuning the Filesystem Check at Bootup Fstab Examples Quote:
How to Label Linux: How the label and the UUID are set depends on the file system type used. It can normally be set when creating/formatting the file system and the file system type usually has some tool to change it later on (e.g. e2tunefs,xfs_admin,reiserfstune,etc.) Labels Mke2fs/e2label/tune2fs: Note: For either ext2 or ext3 file systems. WARNING: mke2fs will reformat your partition and set a label at the same time. This will delete any data on the target partition. To set a label without reformatting use e2label or tune2fs
ReiserFS: Use reiserfstune: Code:
reiserfstune --l <Label> <device> Note:That is a small "L" and not the number 1.JFS: Use jfs_tune: Code:
jfs_tune -L <Label> <device> Code:
jfs_tune -l <device> Note:That is a small "L" and not the number 1.XFS: Use xfs_admin: Code:
sudo xfs_admin -L <Label> <device> Code:
xfs_admin -l <device> Note:That is a small "L" and not the number 1.FAT (Windows partitions): Use mtools to label a FAT partition:
NTFS (Windows partitions): Thanks to rudyj for pointing out the oversight.Use ntfsprogs: First install ntfsprogs: Code:
sudo aptitude install ntfsprogs Then:
============== END OF LABEL =============== Examples of fstab options ********* FAT ********** FAT partitions are easy to share between Linux and Windows as both OS will read FAT "out of the box" without additional installation or configuration. In this example I will use /mnt/data as my mount point. Code:
sudo mkdir /mnt/data Quote:
Quote:
********* Linux Native File Systems ********** In this example I will use ext3, but this holds true for ext2, reiserfs, jfs, and xfs. Code:
sudo mkdir /mnt/ext3 Quote:
============== END OF EXAMPLES =============== References Partitioning: Basic partitioning Mount: How to mount filesystems in Linux Ubuntu Automatically Mount Partitions man mount Mount Other Filesystems Fstab: fstab wiki How to edit and understand /etc/fstab Tuning the Filesystem Check at Bootup Labels: How to use Labels udev: How to udev NTFS: ntfs-3g Zip dirve how-to: How to Zip Drive nfs: How to set up NFS How to NFS v4 Debian/Ubuntu NFS Guide Short but sweeeet ! Mount Windows Sares: Mount Windows shares permanently Samba: Setting up Samba How to mount smbfs shares permanently bodhi.zazen
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999 ![]() Last edited by bodhi.zazen; 4 Weeks Ago at 02:32 PM.. Reason: Updated cifs and info on behavior with mount points |
||||||||||||||||||||||||
|
|
|
|
|
#2 |
|
Dark Roasted Ubuntu
![]() Join Date: Aug 2005
Location: Canada
Beans: 1,082
|
Re: How to fstab
Thanks for the detailed walkthrough!
I'm sure the UUID info will come in handy once Edgy hits. |
|
|
|
|
|
#3 |
|
May the Ubuntu Be With You!
![]() Join Date: Apr 2006
Beans: 1,252
|
Re: How to fstab
Great works man, this is a must
__________________
WARNING : Post with explicit contents
Join to "STOP monolithic all-in-one unmanageable application" The wiki is your friend |
|
|
|
|
|
#4 |
|
I Ubuntu, Therefore, I Am
![]() |
Re: How to fstab
Thanks for the comprehensive guide. I'll be pointing people here.
__________________
What's a blub programmer? Registered Linux user #419974 My projects: |
|
|
|
|
|
#5 |
|
Way Too Much Ubuntu
![]() |
Re: How to fstab
swell bodhi.zazen,
Thats grand detailing there, Thank You.
__________________
Love Abhinya (\_./) (O.-) (> <) |
|
|
|
|
|
#6 |
|
Chocolate-Covered Ubuntu Beans
![]() Join Date: Oct 2005
Location: Fribourg,Switzerland
Beans: 2,202
|
Re: How to fstab
Great job! Thanks a lot,bodhi.zazen!
__________________
my JAMENDO * The XY sex-determination system is the sex-determination system found in humans and Z was my donor! * Tarot and Poya Sutra | * # 12755 |
|
|
|
|
|
#7 | ||
|
Dark Roasted Ubuntu
![]() Join Date: Nov 2006
Location: There and back again
Beans: 1,039
|
Re: How to fstab
I learned howto mount my hfsplus at startup.
Quote:
Quote:
Last edited by Gen2ly; December 4th, 2006 at 10:27 PM.. |
||
|
|
|
|
|
#8 | |||
|
Ubuntu Guru
![]() |
Re: How to fstab
Quote:
Try: Code:
ls /dev/disk/by-label -lh If so... try this fstab entry: Quote:
If not... try this fstab entry: Quote:
Gentoo wiki How to hfsplus Gentoo wiki how to IPOD Ubuntu Forums hfsplus If you would be so kind as to post the solution I will update this "how-long" as xpod calls it
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999 ![]() |
|||
|
|
|
|
|
#9 |
|
Ubuntu addict and loving it
![]() Join Date: Jun 2006
Location: The Netherlands
My beans are hidden!
Ubuntu 9.10 Karmic Koala
|
Re: How to fstab
Well bodhi,you're a busy man.
I definitely bookmark this one,it should come handy some day. Thank you very much for this howto.
__________________
Resistance is futile.....you will be assimilated! Registered Linux User 418427. #Ubuntu User 3226# |
|
|
|
|
|
#10 |
|
First Cup of Ubuntu
![]() Join Date: Dec 2006
My beans are hidden!
|
Re: How to fstab
great guide, helped me a lot
there is also options not mentioned in guide but i found them in some examples: nls, iocharset for correct encodeing file names. I don't know anything more about them. Anyway when i tryed to use a cd where filenames had special characters (Polish), but instead of them there were non-alphabetical signs. So i used this entry in fstab and it helped Code:
/dev/hdd /media/cdrom0 udf,iso9660 utf8,user,noauto 0 0 |
|
|
|
| Bookmarks |
| Tags |
| fstab, mount |
| Thread Tools | |
| Display Modes | |
|
|