Previous Page | Next Page

  1. Introduction
  2. About Linux
  3. Installation and getting started
  4. Logging in and out
  5. Basic Linux Commands
  6. Linux Files and File Permissions
  7. Linux Directory Structure
  8. Finding Files
  9. Linux Help
  10. Setting Time
  11. Devices
  12. Tips
  13. Accessing Other Filesystems
  14. Accessing Removable Media
  15. Making and Managing Filesystems
  16. Emergency Filesystems and Procedures
  17. LILO and Runlevels
  18. Init
  19. Environment, Shell Selection, and Startu
  20. Linux Kernel
  21. Package Installation and Printing
  22. Configuration, Logging and CRON
  23. Keys and Terminal Configuration
  24. Sound Configuration
  25. Managing Users
  26. Passwords
  27. Process Control
  28. Configuration and Diagnostic Tools
  29. Overall Configuration
  30. Using PAM
  31. Basic Network Setup
  32. Tools and Terms
  33. Novell and Printing
  34. Inetd Services
  35. Xinetd Services
  36. Other Network Services
  37. FTP and Telnet
  38. Samba
  39. Identd (auth)
  40. X Configuration
  41. X Use
  42. Using X Remotely
  43. X Documentation
  44. DNS
  45. DHCP and BOOTP
  46. Apache
  47. NFS
  48. PPP
  49. Mail
  50. Routing
  51. IP Masquerading
  52. Proxy Servers and ipchains
  53. UUCP
  54. News
  55. NIS
  56. Network Security
  57. Secure Shell
  58. Text Processing
  59. Shell Programming
  60. Emacs
  61. VI
  62. Recommended Reading
  63. Credits

Linux System Setup

Linux Filesystem Access Types

For a list of programs used to work with filesystems, see the section "Making amd Managing Filesystems". To access other filesystems you must first create them or determine what is currently on your computer. This example assumes you already have filesystems on your computer such as DOS, Windows, or Other Linux partitions you want to access.

  1. Use one of two methods to determine what partitions are on each drive
    1. Type "fdisk /dev/hda" for drive 1, "fdisk /dev/hdb" for drive2. then type p to see a list of each partition. Type q to exit.
    2. An alternate method to do this step assuming you can boot to the filesystem using LILO is:
      1. Type "less /etc/lilo.conf"
      2. Look for the label used by lilo to select dos, such as "dos" and use the associated device. The line on my system is "other=/dev/hda1" so I will use device "/dev/hda1". The disadvantage here is that this method will not allow determination of file systems with no operating system such as partitions that hold data.
  2. Make directories for mount points for each of the other filesystems. For another Linux install such as Debian or Slackware, Type "mkdir /debian" or "mkdir /slackw" For a foreign operating system partition such as DOS or Windows98, "type "mkdir /dos" or "mkdir /win98".
  3. Type "mount t msdos /dev/hda1 /dos" where /dev/hda1 is where the dos partition is. Type "mount /dev/hda4 /win98" to mount the windows filesystem or mount "/dev/hda3 /slackw". Your filesystems may be on other partitions than those shown in examples here.
  4. You can unmount when done: "umount /dev/hda1", however the exit scripts unmounts all file systems when the system is shutdown.

The following line in /etc/fstab will cause the system upon bootup to mount an msdos partition on /dev/hda1 on the directory /dos:

	/dev/hda1	/dos	vfat		defaults   0 0

This works because one of the startup script files "/etc/rc.sysinit" includes a line "mount -a -t nonfs,smbfs,ncpfs,proc". This command mounts all filesystems listed in the file "/etc/fstab". You could set the filesystem type to msdos. Read the file, /usr/src//linux/fs/filesystems.c to find a list of supported filesystems with your kernel. The file /etc/mtab and /proc/mounts each keep a record of currently mounted filesystems on your system. Read the mount man page for more information.

Another useful command is "hdparm -g /dev/hda" which is used to determine hard drive geometry (sectors, heads, cylinders).


Mounting other partitions or operating systems at startup

To mount other partitions at startup modify the "/etc/fstab" file. Each line in the file refers to a different filesystem. Fields are separated by whitespace. The primary filesystems must be mounted first, so they must be in correct order. Your native partition for the system you are running should be listed first. The fields are as follows:

  1. The name of the device such as "/dev/hda1"
  2. The mount point. Use "/" for root. Other typical mount points are "/dos" for DOS, "swap" or "none" for the swap partition, and "/mnt/floppy" for "/dev/fd0" (the floppy drive).
  3. The type of filesystem. They are: mini, ext, ext2(linux native), xiafs, msdos, hpfs, ntfs, fat32, iso9660(CD-ROM), nfs, swap (for swap space).
  4. The mount options for use with the filesystem. Each filesystem type has different mount options. Read the mount man page to see possible options. ro= read only, user- allows normal users to mount the device.
  5. The frequency the filesystem needs to be dumped (backed up) by the dump command. For ext2, normally make it 1, for others make it 0. 0 or nothing means it is not dumped. If 1, it is backed up during a system backup.
  6. A number telling the order in which the filesystems should be checked at reboot time by the fsck program. Your root should be 1, others are in ascending order or 0 to not be checked.

To determine your hard drive's partitions and see what each partition holds which operating system, you may use the fdisk program. Just make sure you don't change your disk information. You can use the 'p' command to see a list of current partitions, then you can add them to your fstab file. Note: In order for the mount to succeed, you must have created the mount point subdirectory (except for root).

I like to install multiple copies of Linux on one computer for three reasons.

  1. The second copy can serve as a backup to the first. If I totally screw up one copy of Linux, by changing kernels, etc, I can still get to the filesystem from the other system and straighten out my problems.
  2. I can learn about other linux packages.
  3. If a compile of a package fails on one system such as Redhat, I can try it on another system such as Slackware and it will probably work.

The fstab file

A typical /etc/fstab file:

/dev/hda2/ext2defaults 1 1
/dev/hdb1/dataauto defaults0 0
/dev/hda1/dosvfatdefaults0 0
/dev/hda3 /slackw ext2 defaults0 0
/dev/hda4swapswap defaults0 0
/dev/cdrom/mnt/cdromiso9660noauto,owner,ro 0 0
/dev/fd0/mnt/floppyext2noauto,owner0 0
none/proc procdefaults0 0
none/dev/ptsdevptsgid=5,mode=6200 0

These are the options:

  • defaults - Use the default options of rw, suid, dev,exec,auto, nouser, and async.
  • auto - Auto detect the type of filesystem.
  • noauto - The -a option will not mount the filesystem.
  • owner
  • ro - Read only
  • rw - Read and write allowed
  • user - Users have permission to mount this filesystem
  • users - Allows a user to mount and another user to unmount the filesystem

The /proc directory is required for tracking processes in memory (RAM). The directories /data, /dos, and /slackw in this example must exist or their mounts will fail. The entries for the floppy and cdrom allow them to be automatically dismounted if they are mounted during shutdown. The option, "noauto" in their entries, keeps these devices from being mounted at startup.

Note:
If you install an OS that wipes LILO, you can use the fdisk utility to toggle the bootable flag (change the boot partition). This can help, if the OS that wiped LILO can toggle this partition to a Linux filesystem.