220 likes | 320 Views
Chapter 12. Important Files and Directories File Types Filesystems mount umount fstab fsck tune2fs RAID filesystems. Important Files and Directories. .bash_profile – individual user shell script .bashrc – bash initialization script /dev/null – bit bucket /dev/pts – pseudoterminals
E N D
Chapter 12 • Important Files and Directories • File Types • Filesystems • mount • umount • fstab • fsck • tune2fs • RAID filesystems
Important Files and Directories • .bash_profile – individual user shell script • .bashrc – bash initialization script • /dev/null – bit bucket • /dev/pts – pseudoterminals • /dev/zero – writes zeros to a file system • /etc/aliases – mail system aliases
Important Files and Directories, cont. • /etc/at.allow – allows users to use the “at” • /etc/at.deny - denies users to use the “at” • /etc/cron.allow – allows users to use the “cron” • /etc/cron.deny - denies users to use the “cron” • /etc/dumpdates – shows list of times the dump command was used • /etc/fstab – filesystem mount table, list of mountable file systems
Important Files and Directories, cont. • /etc/group – lists groups on system • Each user has his own group • Other groups listed in this file • /etc/hosts – hosts file list of ip addresses/hosts • /etc/inittab – initialization table • id:runlevel:action:process • initdefault runlevel • respawn • wait/nowait
Important Files and Directories, cont. • /etc/motd – message of the day • /etc/mtab – table of mounted volumes • /etc/netgroup – checks permissions on remote mounts and logins • /etc/nsswitch.conf – order of resolving addresses • /etc/pam.d – authentication methods used by PAM • /etc/printcap – printer configuration file
Important Files and Directories, cont. • /etc/passwd – list of users information: userid:pw(X):UID:GID:finger info:homedir:shell X points to the shadow password file which is readable only by root passwd file is world readable for logins shell may be a program • /etc/shadow – contains userids and encrypted passwords (MD5 hash)
Important Files and Directories, cont. • /etc/protocols – protocol numbers, aliases • /etc/rc.d – holds system init scripts • /etc/resolv.conf – holds domain info and DNS server ip addresses • /etc/services – list of services and port #s • /etc/sysconfig – holds hierarchy of system configuration files • /proc – the processor directory where all processes occur
Important Files and Directories, cont. • /sbin/shutdown – shutdown utility • swap – swap space for virtual memory manager • /usr/share/magic – holds magic number associated with every file • /var/log – holds system log files • /var/log/messages – file that the system logger puts system messages in
File Types • Ordinary files • Symbolic links • Special files • FIFO special files (named pipes) • Sockets • Block and character devices • Raw devices
Ordinary files • Most are ASCII text but some binaries • Inodes – data structure that holds file information (size, creation date, last accessed date, last modified, location, etc.) • The . and .. directory entries • Symbolic links – do not share inodes as hard links do, only way to link over different file systems
Special Files • Device files – block and character • Block devices read a block at a time, disks • Character devices stream data, memory, printing, console, audio, com ports
FIFO Special files • Also called a named pipe • Used to establish connections between processes not from the same parent process • Printing uses pipes • You use the lpr process to send it to a different process not owned by you, the printer process • Sockets – pipes between different computers which allows for networking
Major and minor device numbers • The major number represents a class of hardware • The minor number represents the iteration of that class of hardware • See the dev directory: brw-rw----- 1 root disk 3, 0 May 5 2005 hda1
Raw devices • The character device form of a block device: • Direct I/O with no buffering • One-to-one link between system calls and hardware requests • Device-dependent restrictions on I/O • The fsck utility uses the block devices as character devices for better efficiency
File Systems • 0 Empty 1c Hidden Win95 FA 70 DiskSecure Mult bb Boot Wizard hid • 1 FAT12 1e Hidden Win95 FA 75 PC/IX be Solaris boot • 2 XENIX root 24 NEC DOS 80 Old Minix c1 DRDOS/sec (FAT- • 3 XENIX usr 39 Plan 9 81 Minix / old Lin c4 DRDOS/sec (FAT- • 4 FAT16 <32M 3c PartitionMagic 82 Linux swap c6 DRDOS/sec (FAT- • 5 Extended 40 Venix 80286 83 Linux c7 Syrinx • 6 FAT16 41 PPC PReP Boot 84 OS/2 hidden C: da Non-FS data • 7 HPFS/NTFS 42 SFS 85 Linux extended db CP/M / CTOS / . • 8 AIX 4d QNX4.x 86 NTFS volume set de Dell Utility • 9 AIX bootable 4e QNX4.x 2nd part 87 NTFS volume set df BootIt • a OS/2 Boot Manag 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access • b Win95 FAT32 50 OnTrack DM 93 Amoeba e3 DOS R/O • c Win95 FAT32 (LB 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor • e Win95 FAT16 (LB 52 CP/M 9f BSD/OS eb BeOS fs • f Win95 Ext'd (LB 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT • 10 OPUS 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/ • 11 Hidden FAT12 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b • 12 Compaq diagnost 56 Golden Bow a7 NeXTSTEP f1 SpeedStor • 14 Hidden FAT16 <3 5c Priam Edisk a8 Darwin UFS f4 SpeedStor • 16 Hidden FAT16 61 SpeedStor a9 NetBSD f2 DOS secondary • 17 Hidden HPFS/NTF 63 GNU HURD or Sys ab Darwin boot fd Linux raid auto • 18 AST SmartSleep 64 Novell Netware b7 BSDI fs fe LANstep • 1b Hidden Win95 FA 65 Novell Netware b8 BSDI swap ff BBT
mount:Mounts a Filesystem • The mount command by itself lists all mounted filesystems • Can be used to mount other filesystems • mount –a mounts all filesystems in fstab file • You may specify type (-t) but must specify location and filesystem: mount –t vfat /dev/hdb2 /mnt/windowscdrive Or mount /mnt/cdrom (if already in fstab)
umount • Unmounts filesystems already mounted
fstab Keeps track of filesystems • Used to mount filesystems at boot time • Six fields; Name – device name (/dev/cdrom, bull:/pub) Mount point – directory (should be empty) Type – type of file system (ext3, iso9660, nfs) Options – auto, noauto, owner, nosuid, ro, rw Dump – backup order Fsck – fsck order
fsck • Like scandisk or chkdsk in MSDOS • Must be used on unmounted volume (except for / filesystem which can’t be unmounted) • Can force with fsck –f • Automatically done at shutdown
tune2fs • Used to set up a ext2 files system, can be used to convert from ext2 to ext3 • Schedules fsck checks on a filesystem based on times mounted or length of time since last fsck
RAID filesystems • Redundant array of independent/inexpensive disks • Used for fault tolerance or performance or both • Raid 0 – striping across 2 or more drives for performance • Raid 1 – disk mirror or duplexing, fault tolerance • Raid 5 – striping over 3 or more disks for performance and fault tolerance