[How To] How to convert Debian Wheezy from Ext3 or Ext4 to Btrfs

Normally the ones we use GNU / Linux we have used for our partitions the famous Ext2, Ext3 and Ext4, but as we know, there are other types of file systems and Btrfs is gaining quite a bit of popularity.

But what is it Btrfs? Let's see a brief description found in Wikipedia:

Btrfs (B-tree FS or usually pronounced "Butter FS") is a File System copy-on-write announced by Oracle Corporation for GNU / Linux.

Its objective is to replace the current file system ext3, eliminating the greatest number of its limitations, especially with the maximum size of the files; in addition to the adoption of new technologies not supported by ext3. It is also stated that it will "focus on fault tolerance, repair and ease of administration."

Well, in this article I will show you how to use debian wheezy with Btrfs, following the steps I found in this link. I think it goes without saying that if you decide to make the change, you must do so at your own risk and that I am not responsible for any catastrophe related to your data. Let's go there 😛

Going from Ext3 / 4 to Btrfs

1.- The first thing we must do is save all our data or better yet, do this test in a virtual machine.

2.- We download an .iso of Debian Testing and "burn" it on a CD or put it on a pen drive with UNetbootin to boot from this device.

3.- Although the original article does not clarify it, I suppose that we must install as is logical, and once we have the system ready we put:

fsck -f /dev/sdaX

(assuming / dev / sdaX is the root filesystem)

4.- We install our favorite editor and btrfs-tools (if not available).

5.- Then we execute:

btrfs-convert /dev/sdX

6.- Later:

mount /dev/sdX /mnt

Then:

mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc

7.- We use Chroot:

chroot /mnt

8.- We edit the file / etc / fstab, we look for the line where the root (/) filesystem is mounted and we change UUID by / Dev / sd, we changed ext3 / ext4 by Btrfs, we change the option to 'defaults' and we change the last number (1) to 0.

For example, in my case it would be to change this:

UUID=c2bc3236-b089-4f1e-8303-8fc9fab8848f    /    ext4    errors=remount-ro 0   1

and leave it like this:

/dev/sdX    /           btrfs    default     0       0

9.- Then we execute:

ls -la /boot

With this what we do is show the files that are inside / boot making sure that we have one similar to this: initrd.img-3.2.0-2-686-pae. What we need is the text that comes after 'initrd.img-' which will be the Kernel that we will use in the following command:

mkinitramfs 3.2.0-2-686-pae -o /boot/initrd.img-3.2.0-2-686-pae

10.- Later we update the GRUB:

grub-install /dev/sdX
update-grub

When finished we use the command:

exit

To get out of chroot.

11.- We disassemble:

umount /mnt/proc
umount /mnt/dev
umount /mnt/sys
umount /mnt

12.- We restart and pray !!! 😀

If a catastrophe does not happen, we can verify that we are already in Btrfs doing the following checks:

1.- How root we execute:

update-initramfs -u -t -kall

2.- We change again in the file / etc / fstab el / Dev / sd by UUID. To watch the UUID from the partition we execute:

ls -la /dev/disk/by-uuid/ | grep sdΧ

Which should return something like this:

lrwxrwxrwx 1 root root 10 abr 19 08:50 0c3299fc-de7b-496f-8cf8-0d0945111b88 -> ../../sda5
lrwxrwxrwx 1 root root 10 abr 19 08:50 2cce04c7-ae67-413b-9773-afe86a36aa39 -> ../../sda6
lrwxrwxrwx 1 root root 10 abr 19 08:50 c2bc3236-b089-4f1e-8303-8fc9fab8848f -> ../../sda1

If everything went well, you can delete the backup that the conversion process has created (ext2_saved) as follows:

btrfs subvolume delete /ext2_saved

Done 😀


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   103 said

    Just one question: Would we risk using this file system for a few new features and features that many users don't even know exist? I do not mean that btrfs is bad (I have not even tried it), based on what I have read it has "things" that the classic ext3 and ext4 lack, but I return to the initial question, is it worth it?

    1.    nuxwin said

      from my point of view…. I do not think so!! you would also take the risk of fucking your system !!!! and another thing does not matter what type of format you have in your partition ... the important thing is to have the right one for the functions that you are going to give to your partitions or for what type of use you are going to give it!

  2.   NotFromBrooklyn said

    I use debian because it is stable, and still, I want a stable filesystem. I wonder, what advantages will btrfs bring to normal users like me?

  3.   Yoyo Fernandez said

    Very good contribution, as always 😉

    Although in my case I don't think I still need it, ext4 is great. I only use a PC for a domestic environment, you know, the internet, music, videos, porn… and stuff.

    All the best

    1.    Merlin The Debianite said

      Use Linux Porn from looks the same.

  4.   erunamoJAZZ said

    To those who ask if Btrfs will bring them any advantage over Ext4, the answer is: Yes and No, xD
    If you use a solid state hard disk (SSD), you will see a much better performance if you use Btrfs, but, as the system is still in development, it is possible that you will suffer an accident, it is a matter of reading the project documentation to get an idea of what can be found: https://btrfs.wiki.kernel.org/

    I once thought of making the jump, but gave up.

    1.    103 said

      That is precisely what I was referring to, I said it in a strange tone it seems.

  5.   vicky said

    For those who know English and are interested, here is a link with tests that compare btrfs and ext4 with each other. Although it is a few months ago, so around now btrfs improved 🙂 In most tests ext4 did better.

    http://www.phoronix.com/scan.php?page=article&item=btrfs_linux31_ssd&num=1

  6.   Jamin samuel said

    Open up to wait for the fedora partners to implement it and see how the system behaves ... if things go super well, the other distros will implement it as well.

  7.   moony said

    He said, "Oracle Corporation."

    This is not prejudice; this is principles:

    I DO NOT THINK OF USING "BTRFS". Thanks for all the info I needed.

    1.    sieg84 said

      so good features that BTRFS has

    2.    Chicxulub Kukulkan said

      I was wondering that too. Knowing the recent history of Oracle (OpenOffice, MySQL, OpenSolaris, Java), will it be reliable to use Btrfs?

  8.   sancochito said

    The point is to wait a bit for the project to be more mature.

  9.   jhcs said

    I hope it improves support for file compression. That if it is something very useful for normal users, it would help us to have more space for home.