Certification

Linux Filesystem Management UNIT 2

Linux Filesystem Management

1

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. UNIT 2: Objectives

Upon completion of this unit you should be able to: · Explain how is data accessed and maintained · Understand the filesystem hierarchy · Manage the filesystem hierarchy · Understand virtual filesystems and swap · Monitor filesystems · Add a hard drive

2

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. UNIT 2: Agenda

· Initial device access · Partitions and device preparation · Filesystem basics · The filesystem hierarchy · Initializing the filesystem hierarchy · Virtual devices · Monitor Filesystem Usage · Adding a New Drive

3

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. System Initialization: Device Recognition

· · Executable code to load · Space for partition table information, including: · Partition id or · Starting cylinder for partition · Number of cylinders for partition

4

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc.

· An extended partition points to additional partition descriptors · Total maximum number of partitions supported by the kernel: · 63 for IDE drives · 15 for SCSI drives

5

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Partitions

· Create partitions using: · · · Disk Druid – Used by Anaconda (only available during install) · GNU parted - Advanced partition manipulation (create, copy, resize, etc.)

6

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: Filesystem Basics

· Filesystems and the Filesystem Hierarchy

· /, /etc, /lib, /bin, /sbin, /dev · must all be on the same partition

· /tmp, /usr, /usr/local, /home, /var, /opt · May be on separate partitions

7

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: Filesystem Creation

· · mkfs.ext2, mkfs., mkfs., mkfs.msdos · Specific filesystem utilities may be called directly · mke2fs [options] device

8

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Journaling for ext2 filesystems: ext3

· ext3 is essentially an ext2 filesystem that uses a journal for transaction atomicity · ext3 filesystems can be created natively or easily converted from ext2 · ext3 has three journalling modes: · ordered (the default, journals only meta-data) · journaled (journals data as well as meta-data) · writeback (not atomic, but allows for a quicker )

9

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. ReiserFS and JFS

· Advanced journaling filesystems · Large filesystem and file sizes supported · efficient storage of files in directories · Improvements to efficiency of file storage on disk · Still under development for Linux · ReiserFS tools · mkreiserfs, reiserfsck, debugreiserfs, resize_reiserfs · JFS tools · mkfs., fsck.jfs, xpeek, extendfs

1 0

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: The Filesystem Hierarchy

· [options] device mnt_point · device points to the filesystem · mount_point points to the files

1 1

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: mount options

· -t vfstype (vfat, ext2, ext3, iso9660, etc.) · -o options · Default options for the ext2 filesystem: · rw, suid, dev, exec, auto, nouser, and async

1 2

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: mount, by example

· Sample filesystem requirements met using options

1 3

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: Connecting Network Resources

· Mounting NFS resources · Mounting SMB resources

1 4

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: /etc/

· Configuration of the filesystem hierarchy · Used by mount, fsck, and other programs · Maintains the hierarchy between system reboots · May use filesystem volume labels in the device field

1 5

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: Unmounting Filesystems

· umount [options] device | mnt_point · A filesystem "in use" may not be unmounted · Use the remount option to change a mounted filesystem's options "atomically"

1 6

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Managing Data: The Auto-Mounter

· Mount points controlled by a daemon process · automounter monitors access to these directories and mounts the filesystem on request · Filesystems automatically unmounted after a specified interval of inactivity

1 7

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. ext2/ext3 Filesystem Attributes

· ext2 and ext3 support attributes that affect the manipulation of file data · lsattr displays file attributes · chattr changes file attributes · Some attributes are not currently supported by the Linux kernel

1 8

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Virtual Memory Files

· Swap space is a supplement to system RAM · Basic setup involves: · Create swap partition or file · special signature using mkswap · Add appropriate entries to /etc/fstab · Activate swap space with swapon -a

1 9

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Filesystem Maintenance

· Maintaining consistency with fsck · Filesystems checked boot up · sulogin session started if errors are severe

2 0

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Filesystem Maintenance (cont.)

· tune2fs · dumpe2fs · debugfs · Resize2fs / parted

2 1

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Determining Filesystem Usage

· displays filesystem status on mounted filesystems · displays directory entries and the number of datablocks assigned to them

2 2

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. Adding a Drive

· Physically connect the new drive · Create partitions · Create filesystems for new partitions, or · Write signature to new swap partitions · Optionally create disk label · Create any needed mount points · Add new entries to /etc/fstab

2 3

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc. End of Unit 2

Questions and answers Summary What tools are available for partitioning? What two ways can swap space be implemented? How does the automounter operate? What are some tools to monitor filesystem usage?

2 4

Rev RH133-9.0-1 Copyright © 2003 Red Hat, Inc.