Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Debian GNU/Linux Reference Guide
Prev Home Next

3.1.11 Creating filesystems


3.1.11.1 Hard disk partition

I prefer to use different partitions for different directory trees to limit damage upon system crash. E.g.,

     /          == (/ + /boot + /bin + /sbin)
                == 50MB+
     /tmp       == 100MB+
     /var       == 100MB+
     /home      == 100MB+
     /usr       == 700MB+ with X
     /usr/local == 100MB

The size of the /usr directory is very dependent on X Window applications and documentation. /usr/ can be 300MB if one runs a console terminal only, whereas 2GB–3GB is not an unusual size if one has installed many Gnome applications. When /usr/ grows too big, moving out /usr/share/ to a different partition is the most effective cure. With the new large prepackaged Linux 2.4 kernels, / may need more than 200MB.

For example, the current status of my Internet gateway machine is as follows (output of the df -h command):

     Filesystem            Size  Used Avail Use% Mounted on
     /dev/hda3             300M  106M  179M  38% /
     /dev/hda7             100M   12M   82M  13% /home
     /dev/hda8             596M   53M  513M  10% /var
     /dev/hda6             100M  834k   94M   1% /var/lib/cvs
     /dev/hda9             596M  222M  343M  40% /usr
     /dev/hda10            596M  130M  436M  23% /var/cache/apt/archives
     /dev/hda11            1.5G  204M  1.2G  14% /var/spool/squid

(The large area reserved for /var/spool/squid/ is for a proxy cache for package downloading.)

Following is fdisk -l output to provide an idea of partition structure:

     # fdisk -l /dev/hda # comment
     
     /dev/hda1             1        41    309928+   6  FAT16 # DOS
     /dev/hda2            42        84    325080   83  Linux # (not used)
     /dev/hda3   *        85       126    317520   83  Linux # Main
     /dev/hda4           127       629   3802680    5  Extended
     /dev/hda5           127       143    128488+  82  Linux swap
     /dev/hda6           144       157    105808+  83  Linux
     /dev/hda7           158       171    105808+  83  Linux
     /dev/hda8           172       253    619888+  83  Linux
     /dev/hda9           254       335    619888+  83  Linux
     /dev/hda10          336       417    619888+  83  Linux
     /dev/hda11          418       629   1602688+  83  Linux

A few unused partitions exist. These are for installing a second Linux distribution or as expansion space for growing directory trees.


3.1.11.2 Mount filesystems

Mounting the above filesystems properly is accomplished with the following /etc/fstab:

     
     # /etc/fstab: static filesystem information.
     #
     # filesystem    mount point     type    options                dump pass
     /dev/hda3       /               ext2    defaults,errors=remount-ro 0 1
     /dev/hda5       none            swap    sw                      0 0
     proc            /proc           proc    defaults                0 0
     /dev/fd0        /floppy         auto    defaults,user,noauto    0 0
     /dev/cdrom      /cdrom          iso9660 defaults,ro,user,noauto 0 0
     #
     # keep partitions separate
     /dev/hda7       /home           ext2    defaults                0 2
     /dev/hda8       /var            ext2    defaults                0 2
     /dev/hda6       /var/lib/cvs    ext2    defaults                0 2
     # noatime will speed up file access for read access
     /dev/hda9       /usr            ext2    defaults,noatime        0 2
     /dev/hda10      /var/cache/apt/archives ext2    defaults        0 2
     
     # very big partition for proxy cache
     /dev/hda11      /var/spool/squid ext2   rw                      0 2
     
     # backup bootable DOS
     /dev/hda1       /mnt/dos        vfat    rw,noauto               0 0
     # backup bootable Linux system (not done)
     /dev/hda2       /mnt/linux      ext2    rw,noauto               0 0
     #
     # nfs mounts
     mickey:/        /mnt/mickey     nfs     ro,noauto,intr          0 0
     goofy:/         /mnt/goofy      nfs     ro,noauto,intr          0 0
     # minnie:/ /mnt/minnie smbfs ro,soft,intr,credentials={filename} 0 2

For NFS, I use noauto,intr combined with the default hard option. This way, it is possible to recover from a hung process due to a dead connection using Ctrl-C.

For a Windows machine connected with Samba (smbfs), rw,auto,soft,intr may be good idea. See Samba configuration, Section 3.5.

For a floppy drive, using noauto,rw,sync,user,exec instead prevents file corruption after accidental disk eject before unmount, but this slows the write process.


3.1.11.3 Autofs mount

Key points to auto mount:

  • Load the vfat module to allow /etc/auto.misc to contain -fstype=auto:

         # modprobe vfat # prior to the floppy access attempt
          ... or to automate this setting,
         # echo "vfat" >> /etc/modules
          ... and reboot the system.
    
  • Set /etc/auto.misc as follows:

         floppy -fstype=auto,sync,nodev,nosuid,gid=100,umask=000 :/dev/fd0
          ... where gid=100 is "users".
    
  • Create cdrom and floppy links in /home/user, that point to /var/autofs/misc/cdrom and /var/autofs/misc/floppy respectively.

  • Add user to the "users" group.


3.1.11.4 NFS mount

The external Linux NFS server (goofy) resides behind a firewall (gateway). I have a very relaxed security policy on my LAN since I am the only user. To enable NFS access, the NFS server side needs to add /etc/exports as follows:

     # /etc/exports: the access control list for filesystems which may be
     #               exported to NFS clients.  See exports(5).
     /       (rw,no_root_squash)

This is needed to activate the NFS server in addition to installing and activating the NFS server and client packages.

For simplicity, I usually create a single partition of 2GB for an experimental or secondary lazy Linux install. I optionally share swap and /tmp partitions for these installs. A multipartition scheme is too involved for these usages. If only a simple console system is needed, 500MB may be more than sufficient.


Debian GNU/Linux Reference Guide
Prev Home Next

 
 
  Published under the terms of the GNU General Public License Design by Interspire