On Fri, Feb 14, 2014 at 11:35:56AM +0100, Axelle wrote:
> Hi,
> I've just encountered a hard disk crash in one of my btrfs pools.
> 
> sudo btrfs filesystem show
> failed to open /dev/sr0: No medium found
> Label: none  uuid: 545e95c6-d347-4a8c-8a49-38b9f9cb9add
>         Total devices 3 FS bytes used 112.70GB
>         devid    1 size 100.61GB used 89.26GB path /dev/sdc6
>         devid    2 size 93.13GB used 84.00GB path /dev/sdc1
>         *** Some devices missing
> 
> The device which is missing is /dev/sdb. I have replaced it with a new
> hard disk. How do I add it back to the volume and fix the device
> missing?
> The pool is expected to mount to /samples (it is not mounted yet).
> 
> I tried this - which fails:
> sudo btrfs device add /dev/sdb /samples
> ERROR: error adding the device '/dev/sdb' - Inappropriate ioctl for device
> 
> Why isn't this working?

   Because it's not mounted. :)

> I also tried this:
> sudo mount -o recovery /dev/sdc1 /samples
> mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
>        missing codepage or helper program, or other error
>        In some cases useful info is found in syslog - try
>        dmesg | tail  or so
> same with /dev/sdc6

   Close, but what you want here is: 

mount -o degraded /dev/sdc1 /samples

not "recovery". That will tell the FS that there's a missing disk, and
it should mount without complaining. If your data is not RAID-1 or
RAID-10, then you will almost certainly have lost some data.

   At that point, since you've removed the dead disk, you can do:

btrfs device delete missing /samples

which forcibly removes the record of the missing device.

   Then you can add the new device:

btrfs device add /dev/sdb /samples

   And finally balance to repair the RAID:

btrfs balance start /samples

   It's worth noting that even if you have RAID-1 data and metadata,
losing /dev/sdc in your current configuration is likely to cause
severe data loss -- probably making the whole FS unrecoverable. This
is because the FS sees /dev/sdc1 and /dev/sdc6 as independent devices,
and will happily put both copies of a piece of RAID-1 data (or
metadata) on /dev/sdc -- one on each of sdc1 and sdc6. I therefore
wouldn't recommend running like that for very long.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
           --- All hope abandon,  Ye who press Enter here. ---           

Attachment: signature.asc
Description: Digital signature

Reply via email to