Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1 of 5
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
Print
View all
Sven Vermeulen
Author
What is fstab?
Grant Goodyear
Author
Under Linux, all partitions used by the system must be listed in /etc/fstab. This file contains the
mount points of those partitions (where they are seen in the file system structure), how they should
be mounted and with what special options (automatically or not, whether users can mount them or
not, etc.)
Roy Marples
Author
Creating /etc/fstab
/etc/fstab uses a special syntax. Every line consists of six fields, separated by whitespace
(space(s), tabs or a mixture). Each field has its own meaning:
The first field shows the partition described (the path to the device file)
The second field shows the mount point at which the partition should be mounted
The third field shows the filesystem used by the partition
The fourth field shows the mount options used by mount when it wants to mount the
partition. As every filesystem has its own mount options, you are encouraged to read the
mount man page (man mount) for a full listing. Multiple mount options are commaseparated.
The fifth field is used by dump to determine if the partition needs to be dumped or not. You
can generally leave this as 0 (zero).
The sixth field is used by fsck to determine the order in which filesystems should be
checked if the system wasn't shut down properly. The root filesystem should have 1 while
the rest should have 2 (or 0 if a filesystem check isn't necessary).
Important: The default /etc/fstab file provided by Gentoo is not a valid fstab file. You have to create your
own /etc/fstab.
Code Listing 1.1: Opening /etc/fstab
# nano -w /etc/fstab
Let us take a look at how we write down the options for the /boot partition. This is just an example,
if you didn't or couldn't create a /boot, don't copy it.
Daniel Robbins
Author
Chris Houser
Author
Jerry Alexandratos
Author
Seemant Kulleen
Gentoo x86 Developer
Tavis Ormandy
Gentoo Alpha Developer
Jason Huebel
Gentoo AMD64
Developer
Guy Martin
Gentoo HPPA developer
Pieter Van den Abeele
Gentoo PPC developer
Joe Kallar
Gentoo SPARC
developer
John P. Davis
Editor
Pierre-Henri Jondot
Editor
Eric Stockbridge
Editor
In our default x86 partitioning example, /boot is usually the /dev/sda1 partition, with ext2 as
8/22/2010 12:34 AM
2 of 5
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
Rajiv Manglani
Editor
/boot
ext2
defaults
Jungmin Seo
Editor
1 2
Some users don't want their /boot partition to be mounted automatically to improve their system's
security. Those people should substitute defaults with noauto. This does mean that you need to
manually mount this partition every time you want to use it.
Add the rules that match your partitioning scheme and append rules for your CD-ROM drive(s), and
of course, if you have other partitions or drives, for those too.
Now use the example below to create your /etc/fstab:
Stoyan Zhekov
Editor
Jared Hudson
Editor
Colin Morey
Editor
Jorge Paulo
Editor
/boot
none
/
ext2
swap
ext3
defaults,noatime
sw
noatime
1 2
0 0
0 1
/dev/cdrom
/mnt/cdrom
auto
noauto,user
0 0
proc
shm
/proc
/dev/shm
proc
tmpfs
defaults
nodev,nosuid,noexec
0 0
0 0
auto makes mount guess for the filesystem (recommended for removable media as they can be
created with one of many filesystems) and user makes it possible for non-root users to mount the
CD.
To improve performance, most users would want to add the noatime mount option, which results
in a faster system since access times aren't registered (you don't need those generally anyway).
Carl Anderson
Editor
Jon Portnoy
Editor
Zack Gilburd
Editor
Jack Morgan
Editor
Benny Chuang
Editor
Erwin
Editor
Joshua Kinard
Editor
Tobias Scherbaum
Editor
Xavier Neys
Editor
One of the choices the user has to make is name his/her PC. This seems to be quite easy, but lots
of users are having difficulties finding the appropriate name for their Linux-pc. To speed things up,
know that any name you choose can be changed afterwards. For all we care, you can just call your
system tux and domain homenetwork.
Code Listing 2.1: Setting the host name
Joshua Saddler
Editor
Gerald J. Normandin Jr.
Reviewer
Donnie Berkholz
Reviewer
# nano -w /etc/conf.d/hostname
(Set the HOSTNAME variable to your host name)
HOSTNAME="tux"
Ken Nowack
Reviewer
Lars Weiler
Contributor
Second, if you need a domainname, set it in /etc/conf.d/net. You only need a domain if your
ISP or network administrator says so, or if you have a DNS server but not a DHCP server. You don't
need to worry about DNS or domainnames if your networking is setup for DHCP.
8/22/2010 12:34 AM
3 of 5
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
Note: If you choose not to set a domainname, you can get rid of the "This is hostname.(none)" messages at
your login screen by editing /etc/issue. Just delete the string .\O from that file.
If you have a NIS domain (if you don't know what that is, then you don't have one), you need to
define that one too:
Code Listing 2.3: Setting the NIS domainname
# nano -w /etc/conf.d/net
(Set the nis_domain variable to your NIS domain name)
nis_domain_lo="my-nisdomain"
Note: For more information on configuring DNS and NIS, please read the examples provided in /etc/conf.d
/net.example. Also, you may want to emerge openresolv to help manage your DNS/NIS setup.
This blank configuration will automatically use DHCP for any net.*
scripts in /etc/init.d. To create a more complete configuration,
please review /etc/conf.d/net.example and save your configuration
in /etc/conf.d/net (this file :]!).
To enter your own IP address, netmask and gateway, you need to set both config_eth0 and
routes_eth0:
Code Listing 2.6: Manually setting IP information for eth0
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
routes_eth0=( "default via 192.168.0.1" )
8/22/2010 12:34 AM
4 of 5
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
Please read /etc/conf.d/net.example for a list of all available options. Be sure to also read
your DHCP client manpage if you need to set specific DHCP options.
If you have several network interfaces repeat the above steps for config_eth1, config_eth2,
etc.
Now save the configuration and exit to continue.
If you have several network interfaces, you need to create the appropriate net.eth1, net.eth2
etc. initscripts for those. You can use ln to do this:
Code Listing 2.9: Creating extra initscripts
# cd /etc/init.d
# ln -s net.lo net.eth1
# rc-update add net.eth1 default
8/22/2010 12:34 AM
5 of 5
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
System Information
Gentoo uses /etc/rc.conf for general, system-wide configuration. Open up /etc/rc.conf and
enjoy all the comments in that file :)
Code Listing 3.2: Opening /etc/rc.conf
# nano -w /etc/rc.conf
Take special care with the KEYMAP variable. If you select the wrong KEYMAP, you will get weird
results when typing on your keyboard.
When you're finished configuring /etc/conf.d/keymaps, save and exit.
Gentoo uses /etc/conf.d/clock to set clock options. Edit it according to your needs.
Code Listing 3.4: Opening /etc/conf.d/clock
# nano -w /etc/conf.d/clock
If your hardware clock is not using UTC, you need to add CLOCK="local" to the file. Otherwise
you will notice some clock skew.
You should define the timezone that you previously copied to /etc/localtime so that further
upgrades of the sys-libs/timezone-data package can update /etc/localtime
automatically. For instance, if you used the GMT timezone, you would add TIMEZONE="GMT"
When you're finished configuring /etc/conf.d/clock, save and exit.
Please continue with Installing Necessary System Tools.
[ << ] [ < ] [ Home ] [ > ] [ >> ]
The contents of this document are licensed under the Creative Commons - Attribution / Share Alike license.
Copyright 2001-2010 Gentoo Foundation, Inc. Questions, Comments? Contact us.
8/22/2010 12:34 AM