Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 7th June 2010, 12:05 AM
lovenemesis Offline
Registered User
 
Join Date: Apr 2008
Location: Leeds, UK
Posts: 305
linuxfirefox
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.
Code:
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
Code:
 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.

CAUTION: DO NOT ATTEMPT TO CONVERT /boot PARTITION !

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:
Code:
 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:
Code:
 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 Identi.ca AND hyperair on IRC #btrfs.
__________________
Fedora Ambassador & Translator
Editor of LinuxTOY
Smolts Profile


Take a Deep Breath out of Windows

Last edited by lovenemesis; 7th June 2010 at 12:18 AM. Reason: Add appreciations.
Reply With Quote
  #2  
Old 7th February 2012, 11:03 PM
tfruth Offline
Registered User
 
Join Date: May 2008
Posts: 9
windows_7firefox
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:

http://forums.fedoraforum.org/showthread.php?t=262319
Reply With Quote
Reply

Tags
btrfs, convert, data, ext4, fedora, howto, losing, partition

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Current GMT-time: 09:32 (Saturday, 29-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Tapioca Maria Bonita - LRT 2 Katipunan Station