From: Oliver Freyermuth <o.freyermuth@googlemail.com>
To: linux-btrfs@vger.kernel.org
Subject: Safe unmounting of external btrfs disk
Date: Thu, 26 Nov 2020 19:33:58 +0100 [thread overview]
Message-ID: <fef04da3-fb9e-aca6-4bd4-965a1263c45e@googlemail.com> (raw)
Dear BTRFS experts,
I've had a rather strange occurence with my external BTRFS backup disk last night,
which makes me question what is the correct way to safely remove a USB drive with BTRFS on it.
Here's the timeline:
- 02:00:00 am: btrbk starts running.
- 02:01:17 am: btrbk deletes the last old subvolume from the disk
(I have btrfs_commit_delete = no, so the delayed deletion basically starts some time after).
- ~02:18 am: I performn an "umount" of the disk.
- ~02:18:43 am: I unplug the USB drive.
- 02:25:05 am: My kernel tells me this:
[19268.944902] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 1, rd 0, flush 0, corrupt 0, gen 0
[19268.944904] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 2, rd 0, flush 0, corrupt 0, gen 0
[19268.944926] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 3, rd 0, flush 0, corrupt 0, gen 0
[19268.944926] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 4, rd 0, flush 0, corrupt 0, gen 0
[19268.944938] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 5, rd 0, flush 0, corrupt 0, gen 0
[19268.944938] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 6, rd 0, flush 0, corrupt 0, gen 0
[19268.944963] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 7, rd 0, flush 0, corrupt 0, gen 0
[19268.944964] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 8, rd 0, flush 0, corrupt 0, gen 0
[19268.944973] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 9, rd 0, flush 0, corrupt 0, gen 0
[19268.944974] BTRFS error (device sdc1): bdev /dev/sdc1 errs: wr 10, rd 0, flush 0, corrupt 0, gen 0
[19268.946460] BTRFS: error (device sdc1) in btrfs_commit_transaction:2327: errno=-5 IO failure (Error while writing out transaction)
[19268.946461] BTRFS info (device sdc1): forced readonly
[19268.946462] BTRFS warning (device sdc1): Skipping commit of aborted transaction.
[19268.946463] BTRFS: error (device sdc1) in cleanup_transaction:1898: errno=-5 IO failure
[19268.946483] BTRFS error (device sdc1): commit super ret -5
What's worrisome is that this happened 7 minutes after the device was unmounted and unpluggied.
I use Kernel 5.9.11 and the following mount options on the backup disk:
space_cache=v2,noatime,compress-force=zstd:6,commit=120,subvolid=0,noauto
Reconecting the disk, I do not see any subvolumes still pending deletion.
The good news: It seems the filesystem did not suffer at all,
probably since the whole transaction never reached the disk.
Is this behaviour expected?
If yes, how to "unmount" correctly (btrfs filesystem sync only seems to work on mounted filesystems)?
I believe udisks unmounts and then quickly removes power, so this would basically be similar to what I did manually here.
I've never seen this on earlier kernels, but I don't check my kernel logs each time, and don't unmount before shutdown each time,
so I can't state where this is a kernel version dependent issue.
Cheers,
Oliver
next reply other threads:[~2020-11-26 18:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 18:33 Oliver Freyermuth [this message]
2020-11-26 23:38 ` Safe unmounting of external btrfs disk Chris Murphy
2020-11-27 2:17 ` Oliver Freyermuth
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=fef04da3-fb9e-aca6-4bd4-965a1263c45e@googlemail.com \
--to=o.freyermuth@googlemail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox