All of lore.kernel.org
 help / color / mirror / Atom feed
From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: Can't remount a BTRFS partition read write after a drive failure
Date: Wed, 17 May 2017 09:22:31 +0000 (UTC)	[thread overview]
Message-ID: <pan$af7cc$8b1ee5a8$c11d0b13$ce53f@cox.net> (raw)
In-Reply-To: 84408781-722d-6c87-b510-0497c4f36443@chicoree.fr

Sylvain Leroux posted on Tue, 16 May 2017 14:56:37 +0200 as excerpted:

> I'm investigating BTRFS using an external USB HDD on a Linux Debian
> Stretch/Sid system.
> 
> The drive is not reliable. And I noticed when there is an error and the
> USB device appears to be dead to the kernel, I am later unable to
> remount rw the drive. I can mount it read only though.
> 
> This seems to be a systematic behavior. And it occasionally happens when
> the computer wake up from sleep and the drive is still attached.
> 
> Power cycling the disk do not change anything, but restarting the
> computer "solves" the issue.
> 
> 
> I believe this may be caused by BTRFS having issues since the kernel
> assign a different device name to the drive when it bring it back
> inline? Or BTRFS didn't realize the "original" drive has gone away?

> Initially, the drive was mounted rw and associated to the /dev/sdb
> device, the btrfs partition being /dev/sdb1 After the failure, I power
> cycled the drive, and the kernel brought it back as /dev/sdc
> 
> I can mount /dev/sdc1 read only.
> But I'm unable to mount it read-write. Interestingly, the message in
> dmesg still mention /dev/sdb1 as the device whereas it should be
> /dev/sdc1.
> 
> sylvain@bulbizarre:~$ uname -[r]
> 4.9.0-2-amd64

This is a known issue.  Btrfs doesn't yet properly track devices and is 
thus unaware that the old device (/dev/sdb1) has gone away.  It does see 
the new device (/dev/sdc1, after btrfs device scan, which udev normally 
runs automatically when a new device appears), and can thus mount it, but 
because it still thinks the old device is there as well, as Chris Murphy 
says, it gets confused, and to be safe, only allows mounting read-only.


There's a patch set in the wings that makes btrfs properly device aware, 
allowing it to track disappearing devices and act accordingly, as a 
prerequisite to the hot-spares feature which the patch set introduces, 
but that patch set is tied up waiting for a different patch series (IIRC 
a change in the device-flush handling, I'm not a dev and haven't tracked 
the specifics), so it could be awhile, 4.13 at absolute minimum, since 
4.12 is the current dev kernel series.

Meanwhile, the history of USB connection flakiness and problems in 
general means btrfs is not generally recommended for USB attached 
devices, at least until those above mentioned patches go in.  For some 
people on specific hardware it works... until it doesn't and we get the 
reports here.  But there's enough of those reports that we simply don't 
recommend btrfs, if the device(s) hosting the filesystem are going to be 
USB-attached.

FWIW, direct SATA connections (eSATA for external) seem to be a better 
choice.  Or choose a different filesystem that's more stable and mature 
(btrfs is still stabilizing, not yet fully stable and mature), and proven 
ready to handle such issues in a better way.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


  parent reply	other threads:[~2017-05-17  9:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 12:56 Can't remount a BTRFS partition read write after a drive failure Sylvain Leroux
2017-05-17  4:10 ` Chris Murphy
2017-05-17  9:22 ` Duncan [this message]
2017-05-17 15:21 ` Ivan Sizov
     [not found] ` <CAMG9ccz555xia-FpqGsoy-uzYXcyYwG6H0EC18O2AC9yLUuBpg@mail.gmail.com>
2017-05-18  7:22   ` Sylvain Leroux
2017-05-19  2:23     ` Duncan
2017-05-20  9:11       ` Sylvain Leroux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='pan$af7cc$8b1ee5a8$c11d0b13$ce53f@cox.net' \
    --to=1i5t5.duncan@cox.net \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.