Converting File Systems - Paiet/Tech-Journal-for-Everything GitHub Wiki

  1. Create an EXT2 file system
    • fdisk /dev/sdb
    • mkfs.ext2 /dev/sdb1
  2. Convert to EXT3
    • tune2fs -j /dev/sdb1
    • Can be done online, but a remount is typically required to take advantage of new features
  3. Convert to EXT4
    • For live file systems
      1. Change FSTAB entry to show EXT4
        • EXT3 can be mounted as EXT4
        • sudo vi /etc/fastab
      2. Boot to single-user mode
        • sudo systemctl rescue
      3. Mount the file system read-only
        • sudo mount -o remount,ro /
      4. Continue with the steps for non-live file sytems
    • For non-live file systems
      1. Unmount the volume
        • sudo umount /dev/sdb1
      2. Convert the volume
        • sudo fsck.ext3 -pf /dev/sdb1
          • Backup and hide the journal
        • tune2fs -O extents,uninit_bg,dir_index /dev/sdb1
          • Enable EXT4 features
          • extents replaces bitmapping
          • uninit_bg allows file checking in the background, resulting in faster checks
          • dir_index enables hashed B-Trees for faster file lookups
        • fsck.ext4 -yfD /dev/sdb1
          • Re-indexes directories
      3. Edit FSTAB to show EXT4
        • sudo vi /etc/fastab
    • Only new files will use extents
    • Old files still stored in bitmaps
    • Use chattr +e <file>
      • lsattr <file> and look for "e"
  4. Convert to XFS
    • No supported method
    • Create a new volume and copy the data over
    • Steps
      1. mkfs.xfs /dev/sdc1
      2. mount /dev/sdc1 /mnt/temp
      3. cp -R /website /mnt/temp
      4. umount /website /mnt/temp
      5. mount /dev/sdc1 /website
  5. Convert to BTRFS
    • Similar to XFS in that it is not supported
      1. mkfs.btrfs /dev/sdd1
      2. mount /dev/sdd1 /mnt/temp
      3. cp -R /website /mnt/temp
      4. umount /website /mnt/temp
      5. mount /dev/sdd1 /website
    • Add storage
      • btrfs device add /dev/sde1 /mnt/temp
      • btrfs filesystem balance /mnt/temp
⚠️ **GitHub.com Fallback** ⚠️