Disk Administration.



Disks are typically divided into partitions. Each partition is usually backed in its entirety. Partitions are usually



/             Root partition, contains boot image, /etc/ /bin/ /lib/, usually static, mounted in single user mode, so must contain enough to fix up the system before going to multiuser mode.



/usr        Executable partition, contains executables that are useful in normal multiuser mode, and may not be mounted in single user mode.



/var         Application scratch/spool/database space. Some libraries live here too. Changes often. Links between here and /usr are a bit messy and usually a result of legacy.



/tmp        Temporary scratch space. Not backed up. Usually cleared when the machine boots up.



/home     Home user accounts. Backed up often. Can be mounted on a server machine.



swap         No file system on this one. Not backed up, ever. Entry in/etc/fstab is to let the kernel know what the swap device is.





Ideally, each of these is a separate partition on disk. The permanent disks are mounted at boot, and detailed in the file /etc/fstab (sometimes/etc/vfstab). Each line in here contains the buffered device file that refers to the partition on disk, where the partition is to be mounted, options about what type of file system is on the device, when to check (fsck, if the machine has not shut down correctly), the disk and in what order should it be needed, and other implementation dependent bits.

<my current recommendation is to have a 3-5Gb / partition, a swap partition about 1.5 to 2.5 times the amount of memory your machine has, and make the rest /home, Rex>





Typical file system formats are



ufs UNIX File System

sysv System 5 file system

ext{2} EXTended filesystem {version 2}

hpfs High Performance File System (OS2)

hfs MacIntosh File System

iso9660 CDROM data filesystem

FAT File Allocation Table, (floppies, windows partitions)

nfs Network File System

ncpfs Novell Netware file system

smbfs Samba network file system

<Now there are new journalling filesystems for linux.  ext3, reiserfs, xfs & jfs, Rex>

There are others not worth mentioning.



Each of these file systems are encountered in the normal day to day operation of UNIX systems. The last three are network file systems, mounted and visible on the computer, but actually residing elsewhere. The first (nfs) has been in use for many years, the second two are proprietary (Novell & Micro$oft). Only nfs implements the full set of UNIX file system attributes over the network.

These are



Owner permissions {read, write, execute}

Group permissions {read, write, execute}

World permissions {read, write, execute}

File type {Normal, Directory, Link, pipe, socket, block device, character device}

Owner {in /etc/passwd}

Group {in /etc/group}

Size

Last accessed time

Last modified time

Filename {up to FILENAME_MAX chars, usually 1k}

Number of hard links {at least one}

and sometimes an access control list.


Links are references to other files. They can be hard links, so that each link to the file appears identical (each link must be on the same partition), or soft links where the file actually points elsewhere (and can point anywhere, even off into space).

Pipes are file implementations of pipes just like in shells. One process opens a pipe and starts writing, another reading, and they can poke information in from each end and it comes out the other. Sockets are just the same except they can be inter-machine.

Access control lists are a mechanism where access to the file in question can be governed on an individual basis. Not all file systems implement this.