CSIS 82 Tutorial: Disks and File Systems Gagne Ch8 Prime Directive: Everything is a file – Ordinary files ( data, text, any format) Directory files ( like folders that contain other folders and files) Special files ( devices such as floppy drive, terminal, sound card, keyboard) File System Directories each top level dir is a file system, & could be made into a partition (see Lecture notes for description of each top level dir) use find, which or whereis to determine location of a file or utility Filesystem is the way the data are organised and stored (in physical level) on disks Common Filesystems in Linux 1. Ext2/ext3 2. ReiserFS 3. Swap 4. NFS 5. Vfat 6. /proc filesystem /proc File System lives in RAM ls -1 / ( shows proc has 0 size) ls /proc lots of stuff cat /proc/cpuinfo Information about CPU hardware cat /proc/interrupts Information about hardware interrupts cat /proc/meminfo Information about memory statistics, physical and swap cat /proc/sound Sound card's configuration kcore system's memory compare ls /proc with ps ax | cut –c1-5 /proc can be used to improve performance (chapter 26) /lost+found File System where bad blocks go when detected by fsck Monitoring disk usage df gives information on every mounted file system df –T –h -T Identify file system type, -h Human readable df /usr/local just looks at individual file systems gdiskfree Gnome graphical disk monitor KDiskFree KDE—find under system menu inode df -i for each file/dir a small data block stores permission, creation, access time and location on disk—Limited number for each file system Shows the inodes used & available on disk Mouting and Unmounting File Systems In order to access any filesystem under Linux, you must mount it on a certain directory. mount -t type device mount-point where type is the type name of the filesystem, device is the physical device where the filesystem resides (the device file in /dev), and mount-point is the directory on which to mount the filesystem. You have to create the mount-point directory before issuing mount mount -t vfat /dev/hda2 /mnt/windows To mount a windows hda2 FAT32 partition (dual boot) mount -t iso9660 -r /dev/cdrom /mnt/cdrom mount [with no args] tells what filesystem are mounted umount Unmount a filesystem: makes the filesystem no longer available from its mount point. need to do before running fsck disk checking umount <mount_dir>, e.g. umount mnt/windows cat /etc/fstab view mount instructions used at bootup. Each line in this file is of the format: device mount-point type options /dev/hda2 /mnt/windows vfat defaults At boot time mount –a command is called that mounts everything listed in /etc/fstab usermount graphical tool lets you mount, unmount and format devices fdisk Lets you create new file systems/partitions … major disk operation requires back up Quotas disk quotas keep users from expanding outside limits To activate disk quotas, in /etc/fstab add ,usrquota after defaults for / partition quotacheck –uagv Builds a quota database for all users repquota –av Reports on quotas & limits (hard, soft, grace) To always report on quotas at boot: add to /etc/rc.d/rc.local the following line: /usr/sbin/quotacheck -augv /sbin/shutdown –r now reboot quotas are now activated quotaoff -auvg Turn off quotas for group and user quotaon -auvg Turn on quotas edquota –u guest edquota –t guest edquota –p guest tux Allows you to set quotas for a user such as guest Allows you to set grace period Clones settings for guest and applies to user tux quota –v Lets a user know what their quota status is Add to /etc/profile script so everyone sees at log in