1 / 22

CPSC 665 Spring 2004 File Systems

CPSC 665 Spring 2004 File Systems. Philip Mattingly. Agenda. Background of disks and commands Overview of disks Overview of file systems Volume Management Backup and recovery NFS File Types. Background of disks. Disks are just block devices that have a lot of blocks.

africa
Télécharger la présentation

CPSC 665 Spring 2004 File Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CPSC 665 Spring 2004File Systems Philip Mattingly

  2. Agenda • Background of disks and commands • Overview of disks • Overview of file systems • Volume Management • Backup and recovery • NFS • File Types

  3. Background of disks • Disks are just block devices that have a lot of blocks. • Disks can be broken into partitions or groupings of blocks. • Access control is done via acl on /dev/block_device or at file system level • File system is bridge between human interface and block management • /dev/hdxy, /dev/sdxy, /dev/md##

  4. A Disk…

  5. Partitions.. (commands) • Fdisk (most Linux’s) • /dev/sda (entire disk) • /dev/sda4 (partition 4 on disk) • Command commands • P – print • N – new partition • T – type definition • W – write partition map to disk • Disk Druid / Partition Magic (graphical) • Format (Solaris)

  6. GNU’s Parted • Partition management for disks • Commands – parted /dev/sda <cmds> • Mkfs – make file system on partition • Mkpart primary start end – creates partition • Mkpartfs primary ext2 start end – part and file system • Move partition start end – moves partition to new location • Resize partition start end – changes partition size • Rm partition – deletes partition • Print – prints partition map

  7. How do block devices work • Open – prepares for I/O • Strategy – start a read or write operation and return • Bread() - read call from kernel • Bwrite() - write call from kernel • Close – finalizes I/O operations • Dump – write all physical memory to device • Psize – return size of partition or block size

  8. Overview of File Systems • Large Number of File Systems for Linux • Compatability • Ufs, minix, bfs, msdos, fat, fat32, ntfs, sysv • Proc, ramfs, cromfs, iso9660, hfs, joliet, udf (cd and dvd) • Network • Afs, coda, nfs, smbfs (CIFS/SMB), ncp (novell) • Disk • Ext, ext2, ext3 • Reiserfs

  9. What is a File System • A filename is a string describing the contents of a file or device. • A directory is a relationship putting filenames into a structured order, typically hierarchial. • A file system is a mapping of filenames, directories, file contents, and mappings to physical locations.

  10. No, really. What is a File System • Superblock – control data for file system • Inode – information for the kernel on a file • Owner, timestamp, size, block mapping, block count, reference count, flags, mode, generation number • Directory – information for the user on a file • File name, inode mapping, file type (special, file, directory), pointer to next directory entry • Pointer to next superblock • Block allocation table • Data blocks

  11. File System Topics • More advanced file systems journal • Log or transaction of activities • Designed for fast recovery after offline • File locking for multi-access systems • File system clustering • Caching of information • Memory mapped files • Superblocks in memory to reduce latency • Read ahead operations

  12. File System Commands • mount/umount – mounting a file system • backup/restore – copying and restoring data • dd command – digital dump • tar command – copying files • rsync command – maintaining copies

  13. File System OS Configuration • /etc/fstab • LABEL=/ / ext3 defaults 1 1 • /dev/hda7 swap swap defaults 0 0 • /dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0 • /dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0 • /dev/hda1 /winxp ntfs defaults 2 2 • /dev/hda5 /share ntfs defaults 3 3 • /dev/hda8 /data ntfs defaults 4 4 • /dev/hdb1 /mysql reiserfs defaults 6 6 • /dev/cdrom1 /mnt/cdrom1 iso9660 noauto,owner,kudzu,ro 0 0 • cedar:/software/5.8 /usr/local nfs defaults 0 0

  14. How are file systems different • Directory layout and formats • FAT – 8.3 filename restrictions • Symbolic links • Linear list of filenames or b-tree ordering • Block mappings and location • Block sizes • One large map or small maps • Journaling • Resolution, transaction, write through

  15. Volume Management • What if we impose a layer between the block devices and the file system to virtualize blocks? • Virtual mapping of blocks independent of devices • Advanced operations can be performed • RAID • Striping • Mirroring • Parity • Security • Data Compression and Decompression

  16. RAID Operations • Hardware RAID • All operations are preformed on the adaptor card • The Volume is emulated as and other block device to the OS. Usually a /dev/sdx • Software RAID • All operations are preformed in the kernel • Linux has native software RAID support • /etc/raidtab • Address device as /dev/md0 • /sbin/mkraid /dev/md0

  17. Software RAID Configuration • Must be compiled into kernel • RAID and LVM option • Raidtools package must be installed (user space commands) • Commands • Mkraid – create raid relationship • Raidhotadd – add device to raid array • Raidhotremove – remove device from raid array • Raidstart – start raid management • Raidstop – stop raid management

  18. What does RAID software do? • For every write to /dev/md0, it figures out what to do to /dev/sd??. • Mirroring, translates into two writes • Concatenation, translates virtual block numbers into physical block numbers on physical devices • Striping, same as concatenation just more complex • Parity, same as mirroring and striping just with parity write and check

  19. What is LVM • What is Logical Volume Manager • Similar to RAID but another layer to obscure devices • Instead of talking to /dev/sda2, we talk to /dev/vol01 • /dev/vol01 might be one or more disks. It can be a logical or physical grouping. • We can take 10 – 80G disks to make one 800G volume or 400G mirrored volume • Volumes can shrink, deallocate, grow, or be reassigned without changing the filesystem

  20. NFS • Sun’s Distributed File System • Has been ported to many OS’s • Based on RPC (remote procedure call) • Host based security model ( IP validates access ) • Share Options • Read only (ro) • Read write (rw) • Tcp/udp

  21. Popular NFS Options • Ro/rw • Proto (tcp/udp) • Nosuid • Vers • Quota • Hard/soft (hard client continues to reconnect) • Nointr (no interrupts by keyboard) • Grpid • Bg • actimeo

  22. NFS commands / files • Commands • Share/Unshare • Shareall/Unshareall • Files • /etc/fstab or /etc/vfstab • /etc/exports/ or /etc/dfs/dfstab

More Related