All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc MERLIN <marc@merlins.org>
To: linux-btrfs@vger.kernel.org
Subject: Cannot add device "is mounted" for unmounted drive that used to be in raidset that is mounted
Date: Sun, 23 Mar 2014 11:09:07 -0700	[thread overview]
Message-ID: <20140323180907.GA22171@merlins.org> (raw)

I found out that a drive that used to be part of a raid system that is mounted
and running without it, btrfs apparently decides that the drive is part of the mounted
raidset and in use.
As a result, I had to eventually dd 0's over it, btrfs device scan, and finally
I was able to use it again.

btrfs should probably improve its check to see that the drive is not really used
and let me format it.


Longer details:
On a running system, I re-added a drive, it showed up as /dev/sdm1
I decrypted it
cryptsetup luksOpen /dev/sdm1 crypt_sdm1

But I can't add it:
polgara:/mnt/btrfs_backupcopy# btrfs device add -f /dev/mapper/crypt_sdm1 .
/dev/mapper/crypt_sdm1 is mounted

however, I can format it as ext4, mount it, write to it, unmount it, and
I still get the same error:
polgara:/mnt/btrfs_backupcopy# mke2fs -t ext4 /dev/mapper/crypt_sdm1
polgara:/mnt/btrfs_backupcopy# mount /dev/mapper/crypt_sdm1 /mnt/mnt
polgara:/mnt/btrfs_backupcopy# Mar 23 10:48:31 polgara kernel: [38645.955263] EXT4-fs (dm-10): mounted filesystem with ordered data mode. Opts: (null)
polgara:/mnt/btrfs_backupcopy# umount /mnt/mnt
polgara:/mnt/btrfs_backupcopy# btrfs device add -f /dev/mapper/crypt_sdm1 .
/dev/mapper/crypt_sdm1 is mounted

polgara:/mnt/btrfs_backupcopy# fuser -v /dev/mapper/crypt_sdm1
polgara:/mnt/btrfs_backupcopy# lsof -n | grep -E '(dm-10|sdm)'
polgara:/mnt/btrfs_backupcopy# mkfs.btrfs -f /dev/mapper/crypt_sdm1 
Error: /dev/mapper/crypt_sdm1 is mounted
polgara:/mnt/btrfs_backupcopy# 

In the end, I had to run
dd if=/dev/zero of=/dev/mapper/crypt_sdm1 bs=1M
for btrfs to stop telling me the filesystem was mounted.

Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901

             reply	other threads:[~2014-03-23 18:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-23 18:09 Marc MERLIN [this message]
2014-03-23 18:58 ` Cannot add device "is mounted" for unmounted drive that used to be in raidset that is mounted Marc MERLIN
2014-03-24 19:19   ` Duncan
2014-03-25  0:28     ` Marc MERLIN
2014-03-31  4:07 ` Anand Jain

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=20140323180907.GA22171@merlins.org \
    --to=marc@merlins.org \
    --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.