Top Banner
1 itec 400 Unix File Systems George Vaughan Franklin University
34

itec 400 Unix File Systems

Jan 07, 2016

Download

Documents

Jolene

itec 400 Unix File Systems. George Vaughan Franklin University. Topics. Types of File Systems Basic File System Administration Logical Volume Managers Disk Striping RAID and Disk Mirroring Samba Using MS-DOS floppies with Solaris/Linux. Types of File Systems. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: itec 400 Unix File Systems

1

itec 400Unix File Systems

George Vaughan

Franklin University

Page 2: itec 400 Unix File Systems

2

Topics

• Types of File Systems

• Basic File System Administration

• Logical Volume Managers

• Disk Striping

• RAID and Disk Mirroring

• Samba

• Using MS-DOS floppies with Solaris/Linux

Page 3: itec 400 Unix File Systems

3

Types of File Systems

• Historical Unix File Systems– Unix System V (s5fs)

• Used to be predominant Unix Files System• Traded performance for space efficiency (small block size [1

or 2K]• critical structures not replicated

– BSD Fast File System (FFS)• Better performance than s5fs• Larger block size [4k or 8k]• block sharing between files.• attempt to locate blocks of file near each other• organize partition in cylinder groups• improved reliability by replication of super block• Complicated disk geometry made fsck very slow.

Page 4: itec 400 Unix File Systems

4

Types of File Systems

• Modern Unix File Systems– Journal-ed File Systems

• maintains a log of changes using transaction entries

• If system crashes, journal log entries are replayed to reconstruct data.

– BSD Soft Updates• similar to journal approach• file system changes are maintained in memory as

metadata.• maintains dependency information

Page 5: itec 400 Unix File Systems

5

Types of File Systems

• Default File Systems on Unix/Linux1

FreeBSD Linix

(RH)

Linux

(SuSE)

Solaris

Type ufs ext3 reiserfs ufs

Journaled? Soft-updates

yes yes yes

Page 6: itec 400 Unix File Systems

6

Basic File System Administration

• Basic File System Administration includes:– Creating Disk Partitions– Formatting Disk Partitions– Creating File Systems– Checking File Systems– Creating Mount Points– Mounting File Systems– Unmounting File Systems

• The following slides illustrate basic file system administration using a floppy disk drive and Red Hat Linux

Page 7: itec 400 Unix File Systems

7

Creating Disk Partitions

• fdisk - used for creating, deleting and administering disk partitions

0014: # fdisk /dev/hda0015: Command (m for help): p0016: 0017: Disk /dev/hda: 255 heads, 63 sectors, 2434 cylinders0018: Units = cylinders of 16065 * 512 bytes0019: 0020: Device Boot Start End Blocks Id System0021: /dev/hda1 * 1 765 6144831 c Win95 FAT32 (LBA)0022: /dev/hda2 766 2359 12803805 83 Linux

0023: /dev/hda3 2360 2434 602437+ 82 Linux swap

Page 8: itec 400 Unix File Systems

8

Formatting Disk Partitions

• Line 1: format the floppy using fdformat0001 # fdformat /dev/fd0

0002 Double-sided, 80 tracks, 18 sec/track. Total capacity 1440 kB.

0003 Formatting ... done

0004 Verifying ... done

Page 9: itec 400 Unix File Systems

9

Creating File Systems

• Line 7: Make file system using mkfs0007 # mkfs -t ext2 -m 0 /dev/fd0 1440

0008 mke2fs 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09

0009 Filesystem label=

0010 OS type: Linux

0011 Block size=1024 (log=0)

0012 Fragment size=1024 (log=0)

0013 184 inodes, 1440 blocks

0014 0 blocks (0.00%) reserved for the super user

Page 10: itec 400 Unix File Systems

10

Creating File Systems

0015 First data block=10016 1 block group0017 8192 blocks per group, 8192 fragments per group0018 184 inodes per group0019 0020 Writing inode tables: done0021 Writing superblocks and filesystem accounting information: done0022 0023 This filesystem will be automatically checked every 39 mounts or0024 180 days, whichever comes first. Use tune2fs -c or -i to override.

Page 11: itec 400 Unix File Systems

11

Checking File Systems

• Line 26: Use fsck to check newly created file system

0026 # fsck /dev/fd0

0027 Parallelizing fsck version 1.23 (15-Aug-2001)

0028 e2fsck 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09

0029 /dev/fd0: clean, 13/184 files, 44/1440 blocks

Page 12: itec 400 Unix File Systems

12

Mounting and Unmounting File Systems

• Unix has a logical single file directory structure, starting with the root.

• Logical directory tree may be composed of many directory trees on many file systems.

• The tree can be expanded by adding additional file systems to mount points.

• A mount point can be any directory on the existing logical directory tree.

Page 13: itec 400 Unix File Systems

13

Mounting and Unmounting File Systems

• ‘mount’ command used to add the directory system to the existing logical directory tree.

• ‘umount’ command used to remove a file system from existing logical tree.

• Any files in a directory that serves as a mount point are obscured when a filesystem is mounted at that point.

• Any files in a directory that serves as a mount point will re-appear when the filesystem at that mount point is unmounted.

Page 14: itec 400 Unix File Systems

14

Mounting and Unmounting File Systems

• To mount a filesystem you need:– to create a mount point (if one does not exist)– use the mount command

• mount device mount_point– device: a disk or disk partition (/dev/hda3, /dev/fd0)– mount_point: an existing directory in the logical tree

Page 15: itec 400 Unix File Systems

15

Creating Mount Points

• Line 31-32: create the mount point0031 # cd /mnt

0032 # mkdir mySpace

Page 16: itec 400 Unix File Systems

16

Mounting File Systems0034 # mount0035 /dev/hda2 on / type ext3 (rw)0036 none on /proc type proc (rw)0037 usbdevfs on /proc/bus/usb type

usbdevfs (rw)0038 none on /dev/pts type devpts

(rw,gid=5,mode=620)0039 none on /dev/shm type tmpfs (rw)0040 /dev/hdb2 on /home type ext2 (rw)0041 /dev/hdb1 on /mnt/msdos/d type

msdos (rw)0042 none on /proc/sys/fs/binfmt_misc

type binfmt_misc (rw)

• Line 34: ‘mount’ with no arguments shows currently mounted filesystems

Page 17: itec 400 Unix File Systems

17

Mounting File Systems0044 # mount /dev/fd0 /mnt/mySpace0045 0046 # mount0047 /dev/hda2 on / type ext3 (rw)0048 none on /proc type proc (rw)0049 usbdevfs on /proc/bus/usb type usbdevfs (rw)0050 none on /dev/pts type devpts

(rw,gid=5,mode=620)0051 none on /dev/shm type tmpfs (rw)0052 /dev/hdb2 on /home type ext2 (rw)0053 /dev/hdb1 on /mnt/msdos/d type msdos (rw)0054 none on /proc/sys/fs/binfmt_misc type

binfmt_misc (rw)0055 /dev/fd0 on /mnt/mySpace type ext2 (rw)

• Line 44: Mount the new fs• Line 55: mount command

shows new fs

Page 18: itec 400 Unix File Systems

18

Using File Systems

• Line 61: copy a file into new fs

• Line 65: Check out the space on new fs0061 # cp /etc/inittab /mnt/mySpace/george

0062 # ls

0063 inittab

0064

0065 # df /mnt/mySpace

0066 Filesystem 1k-blocks Used Available Use% Mounted on

0067 /dev/fd0 1412 16 1396 2% /mnt/mySpace

Page 19: itec 400 Unix File Systems

19

Unmounting File Systems

• Line 69: We attempt to unmount the file system /dev/fd0.• Line 70: the filesystem is busy so we can’t unmount.• Line 73: list of processes using /dev/fd0.0069 # umount /dev/fd00070 umount: /mnt/mySpace: device is busy0071 0072 # fuser -u -m /dev/fd00073 /dev/fd0: 13038c(gvaughan) 13192c(gvaughan) 13195c(gvaughan)

Page 20: itec 400 Unix File Systems

20

Unmounting File Systems

• Line 75: use fuser to kill processes using filesystem.

• Line 77: unmount filesystem (no complaints this time)

0075 # fuser -k -m /dev/fd0

0076 /dev/fd0: 13038c 13192c 13195c

0077 # umount /dev/fd0

Page 21: itec 400 Unix File Systems

21

Filesystem Config File

• Filesystems can be configured to be mounted at boot.

• The config file is: /etc/fstab• Must specify such things as:

– device name– mount point– file system type

• ‘mount -a’ can be used to mount all fs’s in /etc/fstab.

Page 22: itec 400 Unix File Systems

22

Disk Drive

• A Disk Drive is composed of 1 or more (usually more) stacked platters.

• Each platter has 2 surfaces.

• Each Surface has a r/w head.

Page 23: itec 400 Unix File Systems

23

File Systems and Disks (Traditional View)

• A partition is a logical subset of a drive

• A drive may have 1 or more concentric partitions (cylinders)

• A partition is logically 3 dimensional (cylinders: area of ring x platters x 2).

• One filesystem per partition

• partitions cannot be dynamically resized.

Page 24: itec 400 Unix File Systems

24

File Systems and Disks (Logical Volume Managers)

• A Volume Group is composed of one or more disk drives (or UNIX partitions).

• Each disk drive is broken up into LVM partitions of standard size (4MB).

• A volume group can be split into logical volumes (which can also be span multiple drives).

Page 25: itec 400 Unix File Systems

25

File Systems and Disks (Logical Volume Managers)

• There is a 1 to 1 mapping between a file system and a logical volume.

• Therefore, a file system can span more than 1 disk drive.

• Logical volumes can be dynamically resized.

• With LVM, we mount logical volumes instead of disk partitions.

• Supported by most Unix/Linux distributions including Solaris and Redhat.

Page 26: itec 400 Unix File Systems

26

Disk Striping

• Used in configurations involving multiple physical disk drives into one logical drive

• Can be used to improve performance.

• Can be used to support very large files.

• Files are spread across physical drives so different parts of the file can be read/written to concurrently.

• Supported by Solaris, Linux and others…

Page 27: itec 400 Unix File Systems

27

Disk Mirroring and Raid

• A configuration involving multiple physical drives to maintain multiple copies of files.

• RAID - Redundant Array of Independent Disks.• Replication of data is at the O.S. or even at the

controller level. Application does not worry.• Sometimes 3 sets are maintained to resolve

discrepancies.• Supported by Solaris, Linux and others…

Page 28: itec 400 Unix File Systems

28

RAID

• RAID – Redundant Array of Independent (Inexpensive) Disks.

• A set of techniques for grouping disks together for performance and/or fault tolerance.

• Filesystem is spread across grouped disks• There are many ways to group RAID

disks; these groupings are called RAID Levels.

Page 29: itec 400 Unix File Systems

29

RAID Levels

• There are many RAID Levels – some are shown below:

Level Objective Notes 0 Performance Disk striping at block level

No redundancy Supported by Red Hat

1 Fault Tolerance Disk Mirroring Supported by Red Hat

4 Performance and Fault Tolerance

Block level striping with an extra drive dedicated to parity

Dedicated parity disk can slow done write operations

5 Performance and Fault Tolerance

Byte level striping Distributed parity information Most popular RAID Level Supported by Red Hat

Page 30: itec 400 Unix File Systems

30

RAID

RAID Tutorial– The link below provides a nice interactive

tutorial on RAID:– http://www.acnc.com/raid.html

Page 31: itec 400 Unix File Systems

31

Network File System (NFS)

• NFS allows filesystems to be shared across multiple computers.

• Computers do not need to be of same manufacturer of version of Unix/Linux.

• NFS protocol designed by SUN in mid 1980’s.

• Supported by Solaris, Linux and others…

Page 32: itec 400 Unix File Systems

32

Samba

• Samba - an application (server) that runs on Unix/Linux.

• Samba allows Unix/Linux filesystems to look like MS drives.

• MS machine thinks it is mapping an MS drive.

• Great for allowing Unix/Linux machine to act as MS file server.

Page 33: itec 400 Unix File Systems

33

Using MS-DOS Floppies With Linux

1. fdformat /dev/fd0

2. mkfs -t msdos /dev/fd0

3. mount /dev/fd0 /mnt/floppy

4. do whatever with /mnt/floppy…

5. umount /mnt/floppy

6. eject floppy

Page 34: itec 400 Unix File Systems

34

References

1. Essential System Administration, Aeleen Frisch, 20022. Linux Administration Handbook, Evi Nemeth, et. al.,

20023. http://www.csd.uch.gr/~hy345/mirror/class_notes/brow

n_98/lectures/file1.pdf4. http://www.linuxgazette.com/issue55/florido.html5. http://www.usenix.org/publications/library/

proceedings/usenix2000/general/seltzer.html6. http://wlug.westbo.se/faq/Linux-FAQ-4.html

7. http://www.acnc.com/raid.html8. http://www.webopedia.com/TERM/R/RAID.html