How to convert a Debian Wheezy (or newer) system to btrfs
The new GRUB can handle the / boot partition in btrfs format, so now you do not need to have a separate partition formatted in ext2 / 3/4.
Further, we assume that your entire file system is represented by one partition. If you have / usr /, / var, etc. under each section If a separate partition is created, then modify them individually, according to the instructions below.
So, let's get started ...
1. Make a backup section. No one is responsible for any loss of data except yourself!
2. Download and burn to a CD or USB stick Debian Wheezy (or newer).
3. Boot from the created boot image.
4.
5. Check if your favorite text editor is available (vim, ed, mine, etc.) and btrfs-tools, if not, install them.
6.
7.
8. Mount the / proc, / dev, / sys:
9 partitions in / mnt .
10. Edit / etc / fstab, find the line for the root partition (/) and change the UUID to the direct description / dev / sdX, change the file system type from ext3 / ext4 to btrfs, remove the “extra” options leaving just defaults, replace the last digit 1 with 0.
11.
You should see a file like: initrd.img-3.1.0-1-686-pae.
The line after 'initrd.img-' is the version of the kernel that needs to be used later.
12.
13.
14.
15.
16. Unmount the / proc, / dev, / sys and / mnt sections in / mnt:
17. We reboot and pray.
18. After some time, the system should boot, enter 'mount' and make sure that it works on btrfs.
19. Perform:
If everything went well, you can safely delete the backup / ext2_saved that was created during the file system conversion. We do it like this:
ps: Free translation of the article .
Further, we assume that your entire file system is represented by one partition. If you have / usr /, / var, etc. under each section If a separate partition is created, then modify them individually, according to the instructions below.
So, let's get started ...
1. Make a backup section. No one is responsible for any loss of data except yourself!
2. Download and burn to a CD or USB stick Debian Wheezy (or newer).
3. Boot from the created boot image.
4.
fsck -f /dev/sdaX
(where / dev / sdaX is the root partition)5. Check if your favorite text editor is available (vim, ed, mine, etc.) and btrfs-tools, if not, install them.
6.
btrfs-convert /dev/sdX
7.
mount /dev/sdX /mnt
8. Mount the / proc, / dev, / sys:
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
9 partitions in / mnt .
chroot /mnt
10. Edit / etc / fstab, find the line for the root partition (/) and change the UUID to the direct description / dev / sdX, change the file system type from ext3 / ext4 to btrfs, remove the “extra” options leaving just defaults, replace the last digit 1 with 0.
11.
ls -la /boot
You should see a file like: initrd.img-3.1.0-1-686-pae.
The line after 'initrd.img-' is the version of the kernel that needs to be used later.
12.
mkinitramfs 3.1.0-1-686-pae -o /boot/initrd.img-3.1.0-1-686-pae
13.
grub-install /dev/sdX
14.
update-grub
15.
exit
(exit the chroot environment)16. Unmount the / proc, / dev, / sys and / mnt sections in / mnt:
umount /mnt/proc
umount /mnt/dev
umount /mnt/sys
umount /mnt
17. We reboot and pray.
18. After some time, the system should boot, enter 'mount' and make sure that it works on btrfs.
19. Perform:
update-initramfs -u -t -kall
If everything went well, you can safely delete the backup / ext2_saved that was created during the file system conversion. We do it like this:
btrfs subvolume delete /ext2_saved
ps: Free translation of the article .