You are not logged in.

#1 2012-05-14 20:37:39

emphire
Member
From: Canada
Registered: 2007-03-21
Posts: 203

Changing BTRFS RAID level

Linux 3.3 was supposed to have introduced support for re-striping between raid levels. Does anyone know how to go about doing so or know any good tutorials/documentation?

I'm thinking of getting a second drive, formatting it with btrfs, copying over my existing drive, and then adding the old drive and converting it to RAID1. If I can figure out how that is.

Offline

#2 2012-05-14 20:59:34

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,892
Website

Re: Changing BTRFS RAID level

You may need btrfs-progs-git installed (not sure, but the information in the man pages doesn't correspond to the ability of the applications either way), but you can change raid levels using:

btrfs filesystem balance start -dconvert=<raidlevel> -mconvert=<raidlevel>

Remember to add the extra disk/partition to the btrfs partition first with

btrfs device add /dev/sd** /path/to/mounted/btrfsfilesystem

Make sure to backup any important data first, I've only done this once myself (converting raid1 to non-raid, since syslinux can't boot a multiple device btrfs partition apparently (even if it is just raid1))


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2012-05-15 19:58:37

emphire
Member
From: Canada
Registered: 2007-03-21
Posts: 203

Re: Changing BTRFS RAID level

Thanks WorMzy. I'll take the plunge and give it a try soon. I'm leaving a small ext2 boot partition for syslinux. Hopefully that will do the trick.

Offline

#4 2012-05-16 20:14:50

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,892
Website

Re: Changing BTRFS RAID level

emphire wrote:

I'm leaving a small ext2 boot partition for syslinux. Hopefully that will do the trick.

...why didn't I think of that? Thanks in return for that.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2012-05-18 16:05:23

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,892
Website

Re: Changing BTRFS RAID level

*Shameless doublepost-bump*

If you got it working like that, mind letting me know how? Syslinux just seems to loop for me if /boot's on it's own partition. It doesn't even seem to attempt to load the kernel. Fortunately chainloading into grub still works, so I could boot my other installations and revert the changes, but I'd quite like to get this working.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2012-05-20 01:09:34

cteampride
Member
Registered: 2010-01-10
Posts: 15

Re: Changing BTRFS RAID level

I am running a similar setup to your description.  Yes, syslinux has a difficult time booting a raid1 btrfs array (it may be possible though?). I wound up giving up on syslinux and just using grub. 

I left a small partition ext3 partition for grub on both my drives.  grub-install <disk> works flawlessly this way.  Technically, I dont think you need a dedicated /boot with grub now (as it now has full btrfs support?)

for both disks gdisk -l looks the same:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            6143   2.0 MiB     EF02  BIOS boot partition
   2            6144      1953523021   931.5 GiB   8300  Linux filesystem

I then created my btrfs raid1 array:

mkfs.btrfs -L TANK -d raid1 -m raid1 /dev/sda2 /dev/sdb2

grub-install went smoothly.

grub-install /dev/sda
grub-install /dev/sdb
grub-mkconfig -o /boot/grub/grub.cfg

MAKE sure you add the "btrfs" hook mkinitcpio to mkinitcpio.conf hooks array and regen your initramfs-linux.img.  Somehow I forget to do this sometimes...

The resulting setup can be booted even if one drive fails (in degraded mode atleast).  If a drive were to fail, its a little bit of a pain to setup the partitions on the failed drive replacement, add the device to the degraded btrfs, and install grub to it... but hey.  Its relatively bullet proof: even more so with weekly snapshots and backups to a non-btrfs device.

Anyway I am really enjoying the btrfs features!  good luck with the install.

Last edited by cteampride (2012-05-20 01:10:35)

Offline

Board footer

Powered by FluxBB