Linux: Managing File Systems - Paiet/Tech-Journal-for-Everything GitHub Wiki

  • Understanding partitioning systems
    • MBR Partitions
      • Primary Partitions
      • Extended Partitions
      • Logical Partitions
    • GPT Partitions
      • Does away with primary/extended/logical
      • 128 definable partitions by default
  • Partitioning a MBR disk
    • Using fdisk for MBR disks
      • sudo fdisk -l /dev/sdb
      • sudo fdisk /dev/sdb
      • p prints the file table
      • n creates a new partition
      • w writes changes
      • Sizes can be entered (+0M, -3000M, etc)
    • Using gdisk for GPT disks
      • sudo gdisk /dev/sdc
      • p prints the file table
      • n creates a new partition
      • w writes changes
    • Using parted for MBR, GPT, APM, and BSD
      • sudo parted /dev/sdb
      • print
      • mkpart
    • GUI Disks partition software
      • Part of GNOME
      • Applications -> Utilities -> Disks
  • Preparing a partition for use
    • Common filesystem types
      • ext2, ext3, ext4
      • btrfs (Preview)
      • ReiserFS
      • FAT, NTFS
      • ISO-9660, UDF
    • Creating a filesystem
      • Numerous utilities
        • Look in ls -la /usr/sbin/mk*
        • mkfs and its subordinates are just wrappers for utilities like mke2fs
      • sudo mkfs -t ext3 /dev/sdb1
      • sudo mkfs -t ext4 /dev/sdb1
      • sudo mkfs.ext3 /dev/sdb1
      • sudo mkfs.ext4 /dev/sdb1
    • Resizing filesystems
      • Possible using utilities like resize4fs
        • Unsupported
        • Not included in repositories
      • Only officially supported on LVM/DM partitions
    • Creating swap space
      • sudo mkswap /dev/sdb2
      • sudo swapon /dev/sdb2
  • Mounting and Unmounting Partitions
    • Using the mount command
      • mount [-alrsvw] [-t fstype] [-o options] [device] [mountpoint]
      • mount -a: Mount all filesystems in /etc/fstab
      • mount -r: Mount as read only
      • mount -w: Mount as read/write
      • mount -t: Specify the filesystem type
      • mount -o: Specify additional options
      • [device]: Specify the device filename that is to be mounted + /dev/fd0 + /dev/cdrom + /dev/hda4
      • [mountpoint]: Specify the directory to which the device's contents should be attached
      • sudo mount /dev/sdb1 /home/dpezet/Files
      • sudo umount /dev/sdb1 /home/dpezet/Files
    • Make mounting changes permanent by editing the /etc/fstab file
  • Mount Points
  • Common Partitions and Filesystem layouts
    • Swap
    • /home
    • /boot
    • /usr
    • /usr/local
    • /opt
    • /var
    • /tmp
    • /mnt
    • /media