I have a RAID5 btrfs with 8 disks and a hard disk died and just disappeared from the list.

Now I tried removing it but got an error:

ERROR: error removing the device '/dev/sdb' - Inappropriate ioctl for device

After disabling auto-mounting in /etc/fstab, I shut down the system, replaced the faulty drive and rebooted the system to reset the controller just in case it tripped from some other error, and the died disk was now absent, causing all other disks to re-enumerate, so the replacement disk became /dev/sdd rather than sdb.

Running btrfs fi show -d yielded this:

Label: 'store'  uuid: ...
        Total devices 8 FS bytes used 5.27TiB
        devid    2 size 1.36TiB used 784.63GiB path /dev/sdb
        devid    3 size 1.36TiB used 784.63GiB path /dev/sdc
        devid    4 size 1.36TiB used 784.63GiB path /dev/sde
        devid    5 size 1.36TiB used 784.63GiB path /dev/sdf
        devid    6 size 1.36TiB used 784.63GiB path /dev/sdg
        devid    7 size 1.36TiB used 784.63GiB path /dev/sdh
        devid    8 size 1.36TiB used 784.63GiB path /dev/sdi
        *** Some devices missing

Btrfs v3.12

Now I tried btrfs device add /dev/sdd /mnt/x, but got

ERROR: error adding the device '/dev/sdd' - Inappropriate ioctl for device

What now? How can I restore or mount the RAID?

I cannot even mount it. Tried mount [-t btrfs] -o degraded /dev/sdb /mnt/x and mount [-t btrfs] -o degraded,device=/dev/sdb,[...] /dev/sdb /mnt/x ([...] are the device specs, of course):

mount: wrong fs type, bad option, bad superblock on /dev/sdb,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

This is an Ubuntu 14.04 box with kernel 3.13.0-36-generic x64.


This is not a "complete" answer, but I just had the same issue with BTRFS RAID 10. You have to get the array online in degraded mode before you can remove a completely failed device.

btrfs device delete is used to remove devices online. It redistributes the any extents in use on the device being removed to the other devices in the filesystem.

Otherwise, you will continue to get the message:

ERROR: error adding the device '/dev/sdd' - Inappropriate ioctl for device

All I can hope for is that your mount command is incorrect. You just have to list one of the devices in your array and the path where you want to mount it. For example:

sudo mount -o degraded /dev/sda /raid10

... where /dev/sda for me was one of the working devices in the array. When I tried listing all the devices like so:

sudo mount -o degraded -t btrfs\
/dev/sda \
/dev/sdb \
/dev/sdc1 \
/dev/sdd \
/dev/sde \
/dev/sdf \

... the command would fail.

Once you have the array mounted, just execute sudo btrfs device delete missing /raid10 and wait for a long period of time whilst the array sorts itself out. If you cannot get your array mounted, I'm not sure there is anything you can do. Perhaps two drives have actually failed instead of just one, or (more likely) there more issues with BTRFS RAID 5 since it hasn't been around as long as BTRFS RAID 1/10?

  • I think newer kernels and newer btrfs tools have fixed this chicken-or-egg problem with mounting and removing devices in degraded configurations, but I haven't checked this. I just remember having read something that very much said something along those lines. Anyways. I lost my trust in btrfs as a viable alternative to ZFS. It's just YAFS XP: yet another file system and experimental for decades. – Arc Feb 7 '16 at 11:20
  • @Archimedix funny you should say that. During writing my answer I was going to talk about BTRFS's stability and talk about my temptation to switch to ZFS after this with the pros/cons of each, but decided to leave it out as it would probably not be found as constructive. I agree with you though; If you can use ZFS then do. – Programster Feb 7 '16 at 11:24

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.