Skip to content

Arch Linux Install File System BTRFS

Instruction Order

Partition The Drive

  1. See what drives are available using "fdisk".

    $ fdisk -l
    
    Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    
    Disk identifier: 0x7a21f024
    Device     Boot  Start       End   Sectors  Size Id Type
    /dev/sda1  *      2048    206847    204800  100M 83 Linux
    /dev/sda2       206848 943925247 943718400  450G 83 Linux
    

  2. Set up the new partition structure using "gdisk".

    # gdisk /dev/sda
    
  3. Press X to enter the advanced menu.

  4. Press Z to zap the drive.
  5. Press Y to confirm.
  6. Press Y to delete MBR.

    Note: If "found invalid MBR and/or corrupt GPT", create a blank GPT.

    Note: If "gdisk" complains about existing partition tables, zap (wipe the partition tables) the drive.

  7. Press N for new "boot"partition.

    1. Partition number, press Enter (default 1).
    2. Press Enter to use the default first sector.
    3. Type "500M" and presss Enter to specify the last sector.
    4. Enter "ef00" to specify that this is an EFI partition.
  8. Press N for new "root" partition
    1. Press Enter to use the default first sector.
    2. Press Enter to use the default last sector.
    3. Press Enter to accept the default partition type (should be "8300" or Linux).
  9. Write the changes to the disk by press W and then confirming.

Format The Drive Partitions

Note: You will require the packages, "dosfstools" and "btrfs-progs".

  1. Format the EFI partition.

    # mkfs.fat -F32 /dev/sda1
    
  2. Format the Linux root partition. The label "archlinux" can be replaced with any desired string.

    # mkfs.btrfs -L archlinux /dev/sda2
    

Mount The Drive Partitions

  1. Mount the drive parition.
    # mount /dev/sda2 /mnt
    
  2. Create BTRFS subvolume for the root.
    # btrfs subvolume create /mnt/ROOT
    
  3. Create BTRFS subvolume for the home.
    # btrfs subvolume create /mnt/home
    
  4. Create subvolume for the srv.
    # btrfs subvolume create /mnt/srv
    
  5. Verify subvolumes created.
    # btrfs subvolume list -a /mnt
    
    ID 257 gen 359 top level 5 path ROOT
    ID ??? gen ??? top level ? path home
    ID ??? gen ??? top level ? path srv
    
  6. Unmount the drive.
    # umount /mnt
    
  7. Mount the subvolume ROOT.
    # mount -o defaults,compress,subvol=ROOT /dev/sda2 /mnt
    
  8. Create directories for mount points for each subvolume.
    # mkdir /mnt/{boot,home,srv}
    
  9. Mount the boot drive parition within the subvolume ROOT.
    # mount /dev/sda1 /mnt/boot
    
  10. Mount the subvolume home within the subvolume ROOT.
    # mount -o defaults,compress,subvol=home /dev/sdb2 /mnt/home
    
  11. Mount the subvolume srv within the subvolume ROOT.
    # mount -o defaults,compress,subvol=srv /dev/sdb2 /mnt/srv
    

Generate Fstab

  1. Run the genfstab script.

    # genfstab -U /mnt >> /mnt/etc/fstab
    
  2. Edit "/mnt/etc/fstab" and change the "2" at the end of entry for "/dev/sda1" to "0".

    /dev/sda1    /boot    vfat    rw  0 2
    
    /dev/sda1    /boot    vfat    rw  0 0