550 likes | 706 Views
Filesystem administration. Unit objectives Identify types of device files in the /dev directory Mount and unmount floppys and CD-ROMs Create, mount, and unmount partitions Monitor free space, check for errors, and use hard disk quotas. Topic A: The /dev directory and device files.
E N D
Filesystem administration Unit objectives • Identify types of device files in the /dev directory • Mount and unmount floppys and CD-ROMs • Create, mount, and unmount partitions • Monitor free space, check for errors, and use hard disk quotas
The /dev directory • Device file • File that represent a specific hardware device on the system • Typically found in the /dev directory
Device types • Block devices • transfer data in large units • Can transfer information must faster than character devices • Character devices • Transfer data one data bit at a time
Device File numbers • Major number • Used by the kernel to identify what device driver to call to interact properly with a given category of hardware • Minor number • Used by the kernel to identify which specific hardware device, within a given category, to use a driver to communicate with
Removable Media • Much the same as fixed in the way the space is accessed • Can be removed
Filesystems • Filesystem • The organization of a physical storage medium used to store and retrieve data • Superblock • Inode table • Data block • Linux Works with lots of filesystems
Formatting • The process where a filesystem is placed on a disk drive • ldformat • Low level format-for floppy • mkfs • Creates filesystem structure • -t defines which filesystem • mke2fs • Specifically for ext2 and ext3
Mounting and mount points • Mounting • Process used to associate a device with a directory in the directory tree • Mount point • Directory in the file tree to which a device is mounted
Mounting a floppy • mount shows currently mounted directories • fuser –u /mnt/flopppy • See if anyone is using the directory • mount –t ext2 /dev/fdo /mnt/floppy • /dev/fdo is the device file for the floppy • /mnt/floppy is the mount point
Using mount with /etc/fstab • fstab file • Automatically mounts devices at boot time • Consulted when user doesn’t specify full mount commands • Six fields • Device, mount point, type, mount options, dump#, fsck#
Using mount with /etc/fstab • Fstab hints • Options • ro, rw, noatuo • Dump# • 1 specifies system should be backed up • Fsck# • Is filesystem checked at boot time • 0-not checked • 1-checked first • 2-checked second
Mounting devices • When booted, a filesystem on the hard drive is mounted to the / (root) directory • Root directory • Contains the most files that start up the operating system • Should have enough free space to prevent errors and slow performance
Unounting devices • umount /mnt/floppy • Unmount the mount point
Using CD-ROMs • Most CD-ROM drives act as a normal IDE hard disk • Use one of four configurations • Primary master (/dev/hda) • Primary slave (/dev/hdb) • Secondary master (/dev/hdc) • Secondary slave (/dev/hdd)
IDE Hard disks • Low cost • Uses one of four configurations, each of which has a different device file • Primary master (/dev/hda) • Primary slave (/dev/hdb) • Secondary master (/dev/hdc) • Secondary slave (/dev/hdd)
SCSI hard disks • Well-suited to Linux servers • Large storage space • High access speeds
SCSI hard disks • Device files associated with SCSI hard disks • First SCSI hard disk drive (/dev/sda) • Second SCSI hard disk drive (/dev/sdb) • Third SCSI hard disk drive (/dev/sdc) • Fourth SCSI hard disk drive (/dev/sdd) • Fifth SCSI hard disk drive (/dev/sde) • Sixth SCSI hard disk drive (/dev/sdf)
Hard disk partitioning • Partition • A physical division of a hard disk drive • Minimum of two • Root • Swap • Better to use more • Segregate different types of data • Allow more than one type of filesystem • Reduce the chance filesystem corruption will render a system unusable • Speed up access to data
Creating hard disk partitions • Disk Druid • easy-to-use partitioning tool • designed for installation only • Fdisk • Used to create partitions after installation • Key Fdisk Filesystem Types • 82 Linux swap • 83 Linux • 85 Linux extended • fdisk –l shows current partition scheme
Monitoring Filesystems • df (disk free) command • The easiest method for monitoring free space • Shows used and free blocks • df –h • Shows used and free space in MB [epapates@localhost ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 3.3G 2.0G 1.1G 65% / /dev/hda1 99M 16M 78M 17% /boot tmpfs 125M 0 125M 0% /dev/shm
Checking filesystems • Filesystem corruption • Errors in a filesystem structure that prevent the retrieval of stored data • Syncing • Process of writing data from RAM to the hard disk • Bad blocks • Areas of a storage medium that cannot be used
Checking filesystems • Filesystems should be unmoutned before running fsck • For / filesystem, do the check in single user mode (runlevel 1) • Can also use e2fsck for ext2 or ext3 filesystems • More options
Hard disk quotas • Soft limits • Limit imposed that can be exceeded for a certain period of time • Hard limit • Limit imposed that cannot be exceeded
Chapter summary • Identified structure and types of device files in the /dev directory, • Learned about filesystems, mounted and unmounted floppy disks and CD-ROMs • Created hard disk partitions, mounted and unmounted hard disk partitions • Monitored filesystem free space, checked for errors, used hard disk quotas
Sample Questions A Linux system will not boot, even in singleuser mode, but hard drive indicate that the drive is working properly. Which of the following should be to repair the file system? A. Use the custom tool provided by the hard drive manufacturer. B. Use a bootable Linux medium to boot into Linux and run fsck. C. Use a bootable Linux medium to boot into Linux and run fdisk. D. Reinstall Linux from the original install drive and apply all patches.
Sample Questions A Linux system will not boot, even in singleuser mode, but hard drive indicate that the drive is working properly. Which of the following should be to repair the file system? A. Use the custom tool provided by the hard drive manufacturer. B. Use a bootable Linux medium to boot into Linux and run fsck. C. Use a bootable Linux medium to boot into Linux and run fdisk. D. Reinstall Linux from the original install drive and apply all patches. Answer: B
Sample Questions Which of the following fstab entries will mount a Samba share at boot time? A. servername:sharename /mountdirectory smbfs username=windowsusername,password=windowspassword 0 0 B. //servername/sharename /mountdirectory smbfs username=windowsusername,password=windowspassword 0 0 C. //servername/sharename /mountdirectory sambafs username=windowsusername,password=windowspassword 0 0 D. smbmount //servername/sharename /mountdirectory o username=windowsusername,password=windowspassword
Sample Questions Which of the following fstab entries will mount a Samba share at boot time? A. servername:sharename /mountdirectory smbfs username=windowsusername,password=windowspassword 0 0 B. //servername/sharename /mountdirectory smbfs username=windowsusername,password=windowspassword 0 0 C. //servername/sharename /mountdirectory sambafs username=windowsusername,password=windowspassword 0 0 D. smbmount //servername/sharename /mountdirectory o username=windowsusername,password=windowspassword Answer: B
Sample Questions Which of the following is a valid entry for /etc/fstab? A. /dev/hd1 /mnt/hda1 ntfs defaults,noatime,notail 0 0 B. /dev/hdb1 /mnt/hdb1 ext3 defaults,noatime,notail 0 0 C. /dev/hda1 /proc/hda1 ntfs defaults,noatime,notail 0 0 D. /dev/hdb1 /mnt/hdb1 reiser defaults,noatime,notail 0 0
Sample Questions Which of the following is a valid entry for /etc/fstab? A. /dev/hd1 /mnt/hda1 ntfs defaults,noatime,notail 0 0 B. /dev/hdb1 /mnt/hdb1 ext3 defaults,noatime,notail 0 0 C. /dev/hda1 /proc/hda1 ntfs defaults,noatime,notail 0 0 D. /dev/hdb1 /mnt/hdb1 reiser defaults,noatime,notail 0 0 Answer: B
Sample Questions At boot time, the computer reported that there are problems with inodes and blocks. What is the problem, and how is it corrected? A. The boot sector is corrupt and needs to be replaced. B. The file system has become corrupt and needs to be repaired. C. The partition table has become corrupt and needs to be repaired. D. The drive is configured using an improper file system and needs to be reformatted.
Sample Questions At boot time, the computer reported that there are problems with inodes and blocks. What is the problem, and how is it corrected? A. The boot sector is corrupt and needs to be replaced. B. The file system has become corrupt and needs to be repaired. C. The partition table has become corrupt and needs to be repaired. D. The drive is configured using an improper file system and needs to be reformatted. Answer: B.
Sample Questions When the command mke2fs j is run, what type of system is created? A. ext2 B. ext3 C. jfs D. xfs
Sample Questions When the command mke2fs j is run, what type of system is created? A. ext2 B. ext3 C. jfs D. xfs Answer: B
Sample Questions You want to know how much space is being occupied by your user's home directories. Which of the following will provide you with this information? A. du l /home B. du b /home C. du m /home D. du c /home
Sample Questions You want to know how much space is being occupied by your user's home directories. Which of the following will provide you with this information? A. du l /home B. du b /home C. du m /home D. du c /home Answer: D.
A customer has installed a new IDE hard drive in a Linux system. The drive has been partitioned and formatted with the ext2 file system. She is complaining that the new drive must be mounted manually every time the computer is booted. What needs to be done? A. Use a utility to edit fstab. B. Add the proper drive module to the kernel. C. Add the drive information to the /dev directory. D. Change the runlevel to reflect the number of partitions in the system.