Migrating from btrfs to ext4 on my MacBook Pro (Mid 2014), while migrating from Fedora to Arch Linux.

If you want to stick with your current partitioning (keeping the EFI partition and the separate /boot partition untouched) while only changing the root partition to ext4 and adding a swap partition for hibernation, here’s how you can proceed.


High-Level Plan

  1. Keep the EFI partition (/dev/sda1) and /boot partition (/dev/sda2) intact.
  2. Reformat the root partition (/dev/sda3) to ext4 and set it up with LUKS encryption.
  3. Create a new swap partition for hibernation.

Step-by-Step Instructions

1. Boot into Arch Linux Live Environment

  • Boot from an Arch Linux USB installation medium.
  • Open a terminal.

2. Back Up Important Data

If there’s any data on your root partition (/dev/sda3) that you want to keep, back it up before proceeding.


3. Repartition the Disk

  1. Open a partitioning tool (e.g., cfdisk, gdisk, or parted):

    cfdisk /dev/sda
    
  2. Modify the partitions as follows:

    • Reduce the size of the root partition (/dev/sda3) to leave space for a new swap partition.
      For example:
      • Shrink /dev/sda3 by 16 GB (to match your RAM size) for swap.
      • Assign the remaining space as a new Linux swap partition (/dev/sda4).

4. Format and Encrypt the Partitions

Root Partition
  1. Encrypt the root partition with LUKS:

    cryptsetup luksFormat /dev/sda3
    cryptsetup open /dev/sda3 cryptroot
    
  2. Format the encrypted partition as ext4:

    mkfs.ext4 /dev/mapper/cryptroot
    
Swap Partition
  1. Format the new swap partition (/dev/sda4):

    mkswap /dev/sda4
    
  2. Enable the swap:

    swapon /dev/sda4
    

5. Mount the Partitions

  1. Mount the root partition:

    mount /dev/mapper/cryptroot /mnt
    
  2. Mount the /boot partition:

    mkdir -p /mnt/boot
    mount /dev/sda2 /mnt/boot
    
  3. Mount the EFI partition:

    mkdir -p /mnt/boot/efi
    mount /dev/sda1 /mnt/boot/efi
    

6. Install Arch Linux

Follow the standard Arch Linux installation process:

  1. Install the base system:

    pacstrap /mnt base linux linux-firmware
    
  2. Generate an fstab file:

    genfstab -U /mnt >> /mnt/etc/fstab
    
  3. Chroot into the new system:

    arch-chroot /mnt
    

7. Configure Swap for Hibernation

  1. Identify the swap partition’s UUID:

    blkid /dev/sda4
    
  2. Add the resume hook to /etc/mkinitcpio.conf:

    HOOKS=(base udev autodetect modconf block encrypt filesystems keyboard resume fsck)
    
  3. Rebuild the initramfs:

    mkinitcpio -P
    
  4. Update your bootloader configuration:

    • Edit the systemd-boot entry in /boot/loader/entries/arch.conf:

      title Arch Linux
      linux /vmlinuz-linux
      initrd /initramfs-linux.img
      options cryptdevice=UUID=<root-partition-UUID>:cryptroot root=/dev/mapper/cryptroot resume=/dev/sda4 rw
      
    • Replace <root-partition-UUID> with the UUID of /dev/sda3, which you can find using:

      blkid /dev/sda3
      

8. Finalize Installation

  1. Exit the chroot:
    exit
    umount -R /mnt
    cryptsetup close cryptroot
    
  2. Reboot the system:
    reboot
    

Post-Reboot

  1. Ensure the system prompts for the LUKS passphrase during boot.
  2. Test hibernation:
    systemctl hibernate
    
  3. Confirm the system successfully resumes from hibernation.

By keeping your existing EFI and /boot partitions intact, you’re preserving your current setup while enhancing it with a new root filesystem and swap for hibernation.