HOWTO convert EXT4 partition to Btrfs in Fedora 13 without losing data - Fedora Support Forums and Community
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2008
    Leeds, UK
    0 Post(s)
    0 Thread(s)

    Post HOWTO convert EXT4 partition to Btrfs in Fedora 13 without losing data

    One of the cool features in Fedora 13 is better support for the next Linux file system Btrfs.

    However, there are two limitations:
    1. Due to the stability concern, Anaconda can only create Btrfs partition when paring btrfs parameter during DVD installation process. This leaves the users who upgrade from previous releases or use other installation media out of the scope.
    2. AFAIK, though btrfs parameter was passed, Anaconda can only format the partition as btrfs, which is a destructible operation to the data. Unless you are new to Fedora, there will be many files sitting in the /home partition. Backing up and re-formatting are possible but difficult.

    This HOWTO provides a workaround to the limitations above, which means you can still enjoy btrfs in Fedora 13 no matter what installation media you used and without the annoying backing up stuff.

    CAUTION: This is not and never meant to be a step-by-step guide because I suppose the users who want to try btrfs have sufficient knowledge in relative areas. What they need is a successful case LIKE THIS to motivate themselves.

    OK, Let's start the revolution on your hard drive.

    STEP 1: Get the Fedora 13 installed on your hard drive. No matter by which way, on either ext3 or ext4 file system type. Remember the partition number of the ones you would like to convert to btrfs latter.

    STEP 2: Install the btrfs toolbox, which is not installed by default without btrfs parameter. System needs them when booting from a btrfs partition.
    su -c 'yum install btrfs-progs'

    STEP 3: Get a Fedora 13 LiveCD or LiveUSB. There are plenty of tutorials around on this topic. When succeed, restart the computer and boot form the Live media.

    STEP 4: Gain root privilege in Live. Then install the btrfs tool box in the Live media using the identical commend above. We need to use the btfs-convert inside that toolbox.

    STEP 5: Replace your actually partition name with <your_partition_name> in the following command
     btrfs-convert  <your_partition_name>
    It would take some time depending on the size of partition. My 400G ext4 partition takes almost 2 hours to be converted. So be patient.
    Repeat this steps if you have several partitions to be converted.


    STEP 6: Use blkid to see the new UUID for converted partition. Edit /etc/fstab (the one on the HARD DRIVE, NOT LIVE MEDIA) according to those UUIDs. Do not forget to change the partition type ! You may want to add compress mount option, too. Also, ssd for SSD users.
    If you converted / partition, you probably need to edit /boot/grub/grub.conf (same,the one on the HARD DRIVE, NOT LIVE MEDIA ) kernel boot line as well.

    STEP 7: Fix the SELinux context by create an empty file called .autorelabel in / partition of HARD DRIVE. 'touch' would do the job. It is the simplest way if you converted the / partition. 'restorecon' would work if it does not required auto-mount during booting.

    STEP 8: Restart the computer and boot into Fedora 13 on the HARD DRIVE. It might take some time if .autorelabel file was created.

    CONGRATULATIONS! Btrfs is on your disk and your data is there, too. Enjoy those tempting btrfs features crowed on the recent Linux press.

    Even if you are not happy, you can roll back to previous file system! The procedure is similar, except in STEP 5 using these command:
     btrfs-convert  -r <your_partition_name>
    When you think you are ready to settle down on btrfs land, you can delete the snapshot of original file system:
     btrfs subvolume delete <your_btrfs_partition_mount_point>/ext2_saved
    That's all. Hope you have a good time with Btrfs!

    Appreciation to @sirpengi @ender2070 @eeefak on AND hyperair on IRC #btrfs.
    Last edited by lovenemesis; 6th June 2010 at 11:18 PM. Reason: Add appreciations.
    Fedora Ambassador & Translator
    Editor of LinuxTOY

    Take a Deep Breath out of Windows

  2. #2
    Join Date
    May 2008
    0 Post(s)
    0 Thread(s)

    Re: HOWTO convert EXT4 partition to Btrfs in Fedora 13 without losing data

    Thanks for the post. Two questions:

    1. How does this work with LVM partitioning?

    2. What if you created your ext4 partitions as encrypted during setup? Can the encrypted file system be converted from ext4 to btrfs?

    ---------- Post added at 02:03 PM ---------- Previous post was at 01:57 PM ----------

    Perhaps the instructions in this thread are applicable to my question:

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts