Disks and-filesystems

Embed Size (px)

Citation preview

  1. 1. A Primer for Beginners Paul W. Frields Presented by Red Hat, Inc. Licensed under a Creative Commons Attribution-ShareAlike (BY-SA) 3.0 license. http://creativecommons.org/by-sa/3.0/ Linux File Systems
  2. 2. Today's Topics Disks and partitions Logical Volume Management (LVM) File system formats Concentration is on practical use by home/desktop users
  3. 3. Disks and Partitions
  4. 4. What kind of disks? SATA most laptops and home desktops) IDE, SCSI mainly outdated Fibre Channel, Infiniband, and others high end In most cases, your hard disk is probably the device node /dev/sda
  5. 5. RAID Redundant Array of Inexpensive Disks Combine two or more disks into a group that is managed together Sacrifices storage capacity for fault tolerance Avoid for today this is an hour on its own!
  6. 6. What are partitions? Divide your disk into usable areas A map/table at the top describes the layout In complex setups (>4 partitions), it becomes a linked list Most dual-boot systems fall into this category Each successive table points to another table further down the disk, and so on...
  7. 7. You need three /boot used to bootstrap the GRUB loader and kernel swap used by the kernel to shift older data out of RAM when memory gets tight / (also called root) everything else can be stored here
  8. 8. Everything in root? Linux does not have a C: drive, D: drive... Everything is unified under top level / folder Under this, /bin, /etc, /var, etc. How you break up file systems under this is up to you lets look at reasons for and against...
  9. 9. Why break things up? Guard against out of space problems that might affect the running system Lets you re-install OS without touching data (try that on Windows with just a C: drive!)
  10. 10. Why not? Complexity of understanding partitions Complexity of management Figuring out where you ran out of space Figuring out where you need more space But, I have a 640 GB drive, it cant be full!
  11. 11. Whats on your disk? (df)
  12. 12. Installer defaults Depends on the Linux distro Most installers pick a good default DONT worry about it if you dont have to DO note the layout so you can understand implications
  13. 13. Disks tool
  14. 14. LVM Logical Volume Management Turns storage into areas that can be flexibly adjusted after the fact Dont use this for /boot or swap Some installers use by default Generally a good idea since you may want to reallocate space later Adds a level of abstraction (complexity)
  15. 15. LVM concepts PV (physical volume) a partition or disk thats been added to the LVM pool VG (volume group) one or more PVs connected under a single name and managed together LV (logical volume) a portion of a VG which is formatted with a file system (like a partition would be)
  16. 16. From disks to LVs
  17. 17. LVM utilities pvscan, pvs, pvcreate, pvremove, pvchange... vgscan, vgs, vgcreate, vgchange, vgextend, vgreduce, vgremove, vgsplit... lvscan, lvs, lvcreate, lvchange, lvextend, lvreduce, lvresize, lvremove, lvrename... lvm shell utility
  18. 18. LVM system files Boot time use of LVM defined in /etc/lvm directory /etc/lvm/lvm.conf general configuration /etc/lvm/backup/vg_name backup of VG definition (sizes, locations) CAREFUL! /etc/lvm/archive stores previous definitions of VGs
  19. 19. Whats on your disk? (LVM)
  20. 20. Formatted file systems Live on a partition or LVM logical volume (LV) Provide orderly arrangement of files Usually hierarchical (folders, subfolders) Store file data and metadata (timestamps, security details, size, etc.) Examples are ext3fs, ext4fs, btrfs, NTFS, FAT varieties
  21. 21. Linux and other OSs Linux reads and writes most other OS file systems out of the box The opposite is not necessarily true! You can get drivers for Linux file systems for Windows, MacOS
  22. 22. FAT and NTFS Used primarily by Windows Also removable media where manufacturer cant guess your OS (85-90% case) NTFS is needed for larger storage (>4 GB)
  23. 23. HFS+ and beyond Apple MacOS Older HFS is quite rare nowadays but still supported in Linux (moving to reaonly)
  24. 24. ext3 and ext4 Standard Linux file systems Older ext2 not used as much anymore although its basically compatible with ext3 ext3 added journaling capability ext4 supports much larger file systems
  25. 25. What is btrfs? Pronounced better or butter eff ess Uses more modern file system design similar to e.g. XFS to achieve higher levels of scalability and performance for modern workloads Still adding features and stability Chances are you wont need to decide to use; your distro will pick if/when necessary
  26. 26. File system utilities Show disk free space (df) Show disk usage by files (du) Make a file system (mkfs) File system check/repair (fsck) Mount/unmount file system (mount/umount) The mount utility also shows curent mounts
  27. 27. Mounts All separate formatted file systems, when mounted, are part of the single hierarchy A file system can be mounted on any directory as a mount point System defined mounts (used at boot) in the /etc/fstab file
  28. 28. Whats on your disk? (mounts)
  29. 29. Summary Disks can be divided up into partitions Partitions can be combined and split into LVM storage Partitions or LVM logical volumes are mounted on the system to store files
  30. 30. Questions? Licensestatementgoeshere.Seehttps://fedoraproject.org/wiki/Licensing#Content_Licensesforacceptablelicenses. [email protected] Contact: