1

I am trying to build a server that will be my NAS/Media server as well a the XBMC front end. I am planning on using Ubuntu with btrfs for the NAS part of it. The current setup consists of 1TB hdd for the OS etc and two 2TB hdd's for data. I plan to have the 2TB hdd's used as JBOD btrfs system in which i can add hdd's as needed later, basically growing the filesystem online. They way I had setup the file system for testing was while installing the OS just have one of the HDD's connected and have btrfs on it mounted as /data. Later on add another hdd to this file system. When the second disk was added btrfs made as RAID 0, with metadata being RAID 1. However, this presents a problem: even if one of the disk fails I loose all my data (mostly media). Also most of the time the server will be running without doing any disk access, i.e. the HDD's can be spun down, when a access request comes in this with the current RAID 0 setup both disks will spin up. in case I manage a JBOD only the disk that has the file needs to be spun up. This should hopefully reduce the MTBF for each disk. So, is there a way in which I can have btrfs setup such that metadata is mirrored but data stays in a JBOD formation?

Another question I have is this, I understand that a full drive failure in JBOD will lose data on the drive, but having metadeta mirrored across all drives, will this help the filesytem correct errors that migh creep in (ex bit rot?) and is btrfs capable of doing this.

1

3 Answers 3

3

It would seem that your question is best answered here:

https://serverfault.com/a/438181/89037

Basically, yes, the "single" data profile allows disks of different sizes and combines them in JBOD fashion. Don't change the metadata, leave as RAID1.

1
  • 1
    Welcome to Server Fault! Generally we like answers on the site to be able to stand on their own - Links are great, but if that link ever breaks the answer should have enough information to still be helpful. Please consider editing your answer to include more detail. See the FAQ for more info.
    – slm
    Apr 24, 2013 at 3:35
1

From Btrfs wiki

Current Status

Btrfs can add and remove devices online. Adding devices at mkfs time gives the most control over the raid levels used.

Btrfs can do raid0, raid1, raid10 and it can duplicate metadata on a single spindle. When blocks are read in, checksums are verified and if there are any errors, Btrfs tries to read from an alternate copy.

See the Gotchas page for some current issues when using btrfs with multiple volumes of differing sizes in a RAID1 style setup.

Creating a Multi-device FS

mkfs.btrfs will accept more than one device on the command line. It has options to control the raid configuration for data and metadata. Valid choices are raid0, raid1, raid10 and single. Single means that no duplication of metadata is done, which may be desired when using hardware raid.

So no, you can't do JBOD for data (or the Wiki wasn't updated, Btrfs is under heavy development).

I love Btrfs checksuming data and metadata, it will save you from a silent data corruption (well, it will inform you, that your file has been damaged but should prevent metadata corruption). Still, I wouldn't trust it with things I'd like to keep just yet. Personally I'd go with 3 disks and a software RAID 5. You can grow array later as you need. For a filesystem I'd choose something more mature, like ext4 or XFS.

If you are more concerned about disks spinning up than about data persistence you could use LVM to create a logical volume out of both disks and make a Btrfs file system on top of that. LVM allows for a linear mode which may or may not cause just relevant drive to be spun up (if both data and metadata resides on the same spindle), but in case of a drive failure you loose all data.

0

You can just run something like this:

mkfs.btrfs -L data /dev/sdc /dev/sdd

to span the btrfs across multiple disks. Be sure to use the correct device names. Just be aware you are losing redundancy with a setup like this and your data is not safe.

1
  • 2
    I believe this does RAID0 (striping). This will get multiple disks, but will not be JBOD. JBOD is data goes on disk 1 until disk 1 is full, then goes on disk 2. Or sometimes, some whole files go on disk 1, other whole files go on disk 2. In either case, if you access a file on disk 1, only disk 1 needs to spinup. In RAID0, both disks always need to spinup to access any data.
    – bobpaul
    Apr 24, 2013 at 3:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .