* BTRFS thinks that a device is mounted
@ 2011-10-20 21:39 Nikos Voutsinas
2011-10-21 1:33 ` Helmut Hullen
2011-10-21 10:10 ` Stephane CHAZELAS
0 siblings, 2 replies; 4+ messages in thread
From: Nikos Voutsinas @ 2011-10-20 21:39 UTC (permalink / raw)
To: linux-btrfs
Hello all,
What went wrong in the following scenario? BTRFS thinks that a device is
mounted while it is not.
BTRFS tools ver: Btrfs v0.19-101-g3891d2d
Uname: 3.1.0-rc7-686-pae
## Comment: Initially we had only root (/) mounted as btrfs
mount |grep btrfs
/dev/sdc2 on / type btrfs (rw,autodefrag)
## Comment: Create a new btrfs fs on /dev/sdg /dev/sdh /dev/sdl
mkfs.btrfs -m raid1 -d raid1 /dev/sdg /dev/sdh /dev/sdl
btrfs filesystem show
Label: none uuid: f0425f63-e486-4c10-adab-47a23085c8db
Total devices 3 FS bytes used 28.00KB
devid 3 size 2.00GB used 200.00MB path /dev/sdl
devid 2 size 1.00GB used 200.00MB path /dev/sdh
devid 1 size 768.00MB used 404.00MB path /dev/sdg
Label: none uuid: cc8211ba-6f62-46d6-ba17-49250f06a941
Total devices 1 FS bytes used 512.98MB
devid 1 size 6.09GB used 1.75GB path /dev/sdc2
## Comment: unorthodox, but looks possible, add one of the devices from
the newly created fs to root (/)
btrfs device add /dev/sdh /
## Comment: Remove it back.
btrfs device delete /dev/sdh /
## Comment: We ended up with "*** Some devices missing" on both devices
btrfs filesystem show
Label: none uuid: 5910f378-0784-4e7f-b918-de35067252e9
Total devices 3 FS bytes used 28.00KB
devid 3 size 2.00GB used 200.00MB path /dev/sdl
devid 1 size 768.00MB used 404.00MB path /dev/sdg
*** Some devices missing
Label: none uuid: cc8211ba-6f62-46d6-ba17-49250f06a941
Total devices 2 FS bytes used 512.59MB
devid 1 size 6.09GB used 1.50GB path /dev/sdc2
*** Some devices missing
## Comment: Use btrfs balance to fix root (/)
btrfs filesystem balance /
btrfs filesystem show
Label: none uuid: 5910f378-0784-4e7f-b918-de35067252e9
Total devices 3 FS bytes used 28.00KB
devid 3 size 2.00GB used 200.00MB path /dev/sdl
devid 1 size 768.00MB used 404.00MB path /dev/sdg
*** Some devices missing
Label: none uuid: cc8211ba-6f62-46d6-ba17-49250f06a941
Total devices 1 FS bytes used 513.40MB
devid 1 size 6.09GB used 1.75GB path /dev/sdc2
## Comment: try to mount the initially created fs on /mnt. It fails
mount -t btrfs /dev/sdg /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sdg,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
## Comment: See if device scan can do the trick. Nope...
btrfs device scan /dev/sdh
Scanning for Btrfs filesystems in '/dev/sdh'
ERROR: unable to scan the device '/dev/sdh' - Invalid argument
## Comment: OK, we give up. Try to recreate btrfs from scratch
mkfs.btrfs -m raid1 -d raid1 /dev/sdg /dev/sdh /dev/sdl
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
/dev/sdh is mounted
## Comment: Of course /dev/sdh is not mounted.
mount |grep /dev/sdh
root@lxc:~#
Thanks,
Nikos
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: BTRFS thinks that a device is mounted
2011-10-20 21:39 BTRFS thinks that a device is mounted Nikos Voutsinas
@ 2011-10-21 1:33 ` Helmut Hullen
2011-10-21 10:10 ` Stephane CHAZELAS
1 sibling, 0 replies; 4+ messages in thread
From: Helmut Hullen @ 2011-10-21 1:33 UTC (permalink / raw)
To: linux-btrfs
Hallo, Nikos,
Du meintest am 21.10.11:
> What went wrong in the following scenario? BTRFS thinks that a device
> is mounted while it is not.
[...]
> btrfs device scan /dev/sdh
> Scanning for Btrfs filesystems in '/dev/sdh'
> ERROR: unable to scan the device '/dev/sdh' - Invalid argument
> ## Comment: OK, we give up. Try to recreate btrfs from scratch
> mkfs.btrfs -m raid1 -d raid1 /dev/sdg /dev/sdh /dev/sdl
> WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
> WARNING! - see http://btrfs.wiki.kernel.org before using
> /dev/sdh is mounted
> ## Comment: Of course /dev/sdh is not mounted.
> mount |grep /dev/sdh
> root@lxc:~#
Two days ago I've seen a perhaps similar problem with an ext3 disk:
Connected via USB
running fsck (with some options)
mount /dev/$disk $mountpoint
also told that the disk was mounted (it wasn't really).
Maybe some other operation (like - in this case - fsck) on/with the disk
leads to this wrong message.
Viele Gruesse!
Helmut
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BTRFS thinks that a device is mounted
2011-10-20 21:39 BTRFS thinks that a device is mounted Nikos Voutsinas
2011-10-21 1:33 ` Helmut Hullen
@ 2011-10-21 10:10 ` Stephane CHAZELAS
2011-10-22 13:57 ` Nikos Voutsinas
1 sibling, 1 reply; 4+ messages in thread
From: Stephane CHAZELAS @ 2011-10-21 10:10 UTC (permalink / raw)
To: linux-btrfs
2011-10-21, 00:39(+03), Nikos Voutsinas:
[...]
> ## Comment: Of course /dev/sdh is not mounted.
> mount |grep /dev/sdh
> root@lxc:~#
[...]
Note that mount(8) uses /etc/mtab to find out what is mounted.
And if that file is not a symlink to /proc/mounts, the
information is not necessarily correct.
You can also have a look at /proc/mounts directly.
--
Stephane
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BTRFS thinks that a device is mounted
2011-10-21 10:10 ` Stephane CHAZELAS
@ 2011-10-22 13:57 ` Nikos Voutsinas
0 siblings, 0 replies; 4+ messages in thread
From: Nikos Voutsinas @ 2011-10-22 13:57 UTC (permalink / raw)
To: linux-btrfs
> 2011-10-21, 00:39(+03), Nikos Voutsinas:
> [...]
>> ## Comment: Of course /dev/sdh is not mounted.
>> mount |grep /dev/sdh
>> root@lxc:~#
> [...]
>
> Note that mount(8) uses /etc/mtab to find out what is mounted.
> And if that file is not a symlink to /proc/mounts, the
> information is not necessarily correct.
>
> You can also have a look at /proc/mounts directly.
>
OK, I found what went wrong, however I am not sure whose fault this is and
If I am going to describe a case that is already known to this list.
To cut a long story short, the consecutive
root@btrfs:~# btrfs device add /dev/sdc /
root@btrfs:~# btrfs device delete /dev/sdc /
led to inconsistency between the contents of /proc/mounts and
/dev/disk/by-uuid (ie the mapping of UUIDs to devices).
Actually, "btrfs device add /dev/sdc /" changed the mapping of root's UUID
to point to /dev/sdc, and the system left it this way, even after the
"btrfs device delete /dev/sdc /". Thus I ended up with the following
situation.
root@btrfs:~# cat /etc/mtab /proc/mounts |grep btrfs
/dev/sdd2 / btrfs rw 0 0
/dev/disk/by-uuid/cc8211ba-6f62-46d6-ba17-49250f06a941 / btrfs rw 0 0
root@btrfs:~#
root@btrfs:~# ls -l /dev/disk/by-uuid/cc8211ba-6f62-46d6-ba17-49250f06a941
lrwxrwxrwx 1 root root 9 Oct 22 16:13
/dev/disk/by-uuid/cc8211ba-6f62-46d6-ba17-49250f06a941 -> ../../sdc
Although this may be a udev issue, I think that the userspace tools of
btrfs should have handled this in a better way.
Nikos
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-22 13:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-20 21:39 BTRFS thinks that a device is mounted Nikos Voutsinas
2011-10-21 1:33 ` Helmut Hullen
2011-10-21 10:10 ` Stephane CHAZELAS
2011-10-22 13:57 ` Nikos Voutsinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox