180 likes | 349 Views
Workbook 5: The Linux Filesystem. OS515: 2010. The basic anatomy of a regular file. What’s in an inode ?. Ownership information. Links: The number of dentries that refer to this inode. Permissions. Blocks: The amount of disk space consumed.
E N D
Workbook 5: The Linux Filesystem OS515: 2010
What’s in an inode? Ownership information Links: The number of dentries that refer to this inode Permissions Blocks: The amount of disk space consumed Access: Last time the file was readModify: Last time the file data changedChange: Last time the inode data changed
File types • In Unix there is an expression “Everything is a file” • Types help us identify the function of the file
Comparing Links Hard Links Soft Links • Cannot hard link directories • Hard links have no concept of "original" and "copy “ • Hard links must refer to files in the same filesystem • Can soft link directories • Soft links have a concept of "referrer" and "referred". Removing the "referred" file results in a dangling referrer • Soft links may span filesystems (partitions)
Disks, File Systems, and Mounting • Linux allows low level access to disk drives through device nodes in the /dev directory. /dev/fd0 =
Filesystems • While devices hold the data they must be prepared and made available
File Systems • Filesystems are created with some variant of the mkfs command • The default filesystem of Red Hat Enterprise Linux 5.2 is the ext3 filesystem /sbin/mkfs.ext2 /dev/fd0
Mounting Filesystems • The mount command is used to map the root directory of a disk's (or a disk partition's) filesystem to an already existing directory. That directory is then referred to as a mount point. • The umount command is used to unmount a filesystem from a mount point. • The df command is used to report filesystem usage, and tables currently mounted devices. mount /dev/fd0 /media/floppy mount /dev/hdb3 /data
Mounting Issues • By default, only the root user can mount and unmount devices (console users are the exception) • A filesystem can only be unmounted if it is considered "non-busy“ • The GNOME graphical environment runs an automounter, which keeps an eye on the CD/ROM drive, and will automatically mount the filesystem of any newly inserted disk • In order to improve performance, the kernel buffers all block device (harddrive) interactions so you must umount to ensure these buffers are flushed to disk
Advanced File Commands • locate and find • Used to locate/find files within the file system. Locate and find work in different ways • gzip and bzip2 • Used to compress/decompress a datastream • tar • Used to create an archive of files (early uses were to archive files to tape), and can be used with zgip/bzip2 to create compressed archives.