2

I want to set up a BTRFS RAID1 setup with two WD Red 4TB disks, which possess 4K sectors. Since I am keen to get it right the first time before copying data to it (yes it will be backed up), my question is whether it needs any special considerations regarding sector-alignment and size for Advanced Format disk.

In the past I know I had to take care of this, when setting up MDADM+LVM and ZFS (ashift=12) for example, but I cannot find any information for BTRFS regarding this (apart from SSD-specific stuff, e.g. here). I had planned to use the whole disks without partitions in the following way:

$ mkfs.btrfs -m raid1 -d raid1 /dev/sdX /dev/sdY

So, considering I couldn't find anything, can I trust BTRFS to just 'do the right thing'? How can I control what it does? I checked the result in GParted and the disk information shows

First sector: 0

for both drives, which seems wrong, since normally GParted aligns the first sector to MB, which would have a first sector of 2048, as I have seen for a BTRFS partition I created on another disk (but I am not sure).

Perhaps I should just create a disk-spanning BTRFS-partitions on both drives, that is aligned and then use those in RAID1? BTW: Is there any pros/cons of using whole disks vs. partitions I should consider?

Hope someone with some experience can help me out.

1

From my experience, letting btrfs take over a whole disk with no partitions will not result in proper logical/physical sector alignment. I've tried this with 3.14.1; latter versions may do this differently (current release is 3.18.x).

My suggestion is to use properly aligned GPT partitions and tell BTRFS to use a 4K sector size with mkfs.btrfs --sectorsize.

  • 1
    What do you mean with non 'proper logical/physical sector alignment'. What sector size was chosen by default? Note that the mkfs.btrfs man page mentions: 'Specify the sectorsize, the minimum data block allocation unit. The default value is the page size.' Your page size is most likely 4k ... – maxschlepzig Sep 3 '15 at 7:17
-1

Does it really matter the size of the block? BTRFS is extent based and it does file packing (multiple files in one block) inodes are alocated dynamically.

It's a seriously cool file system.

According to this: https://wiki.archlinux.org/index.php/Btrfs#File_system_creation the default block size is 16KB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.