2

I mounted 2 drives as a RAID1 btrfs array (btrfs v3.12, Ubuntu 14.04). Everything's working fine except nautilus and other GUI-based apps see two disks, both labeled "Raid1". One is mounted (the working btrfs disk), the other is unmounted.

Does anyone know why this "ghost" volume exists or how to get rid of it?

Edit - Adding additional details:

The result of "sudo btrfs filesystem show":

$ sudo btrfs filesystem show
Label: Raid1  uuid: 3d12bc7b-61b1-4dea-b78b-ef9a44a6b698
    Total devices 2 FS bytes used 2.39TiB
    devid    1 size 3.64TiB used 2.43TiB path /dev/sdg1
    devid    2 size 3.64TiB used 2.43TiB path /dev/sdh1

Btrfs v3.12

My fstab:

UUID=3d12bc7b-61b1-4dea-b78b-ef9a44a6b698 /media/btr0 btrfs defaults,noauto 0 0

All fstab seems to do is mount the device as /media/btr0. If I comment out the fstab entry it automatically gets mounted as /media/fred/Raid1.

1 Answer 1

1

I assume you're referring to a btrfs raid1 filesystem created on top of two block devices created with something like mkfs.btrfs -L Raid1 -d raid1 /dev/sd* /dev/sd*

Reproduced this setup locally (based on Funtoo instructions from here):

$ dd if=/dev/zero of=/tmp/btrfs-vol0.img bs=1G count=1
$ dd if=/dev/zero of=/tmp/btrfs-vol1.img bs=1G count=1
$ sudo losetup /dev/loop0 /tmp/btrfs-vol0.img
$ sudo losetup /dev/loop1 /tmp/btrfs-vol1.img

Created the fs

$ sudo mkfs.btrfs -L Raid1 -d raid1 /dev/loop0 /dev/loop1

Both loop0 and loop1 do appear in nautilus and unity (using ubuntu 14.10 here). This is not really related to btrfs itself though, but rather due to the way udisks and udev work.

There are two ways to hide the devices from GUI tools, as mentioned below. Solution 1 (preferred) will only hide the ghost device, solution 2 will hide both devices from GUI tools.

1. Create a udev rule to ignore the device(s)

Create a file in /etc/udev/rules.d (e.g. /etc/udev/rules.d/99-local-udisks-btrfs.rules), and add a rule like this one:

KERNEL=="sdh1", ENV{UDISKS_IGNORE}:="1"

Then run sudo udevadm trigger to trigger the rule.

for more info, see following links:https://wiki.archlinux.org/index.php/udev, https://askubuntu.com/questions/124094/how-to-hide-an-ntfs-partition-from-ubuntu

2. Add it to /etc/fstab

e.g

LABEL=rootfs / btrfs defaults,subvol=@,autodefrag 0 0
LABEL=rootfs /home btrfs defaults,subvol=@home,autodefrag 0 0
LABEL=Raid1 /tmp/raid1 btrfs defaults 0 0

Use filesystem LABEL= or UUID=, which you can retrieve from

$ sudo btrfs filesystem show [<path>|<uuid>|<device>|label]

Label: 'Raid1' uuid: 98780c23-5330-4357-8fb8-ef3307fdabc3
          Total devices 2 FS bytes used 112.00KiB
          devid 1 size 1.00GiB used 231.75MiB path /dev/loop0
          devid 2 size 1014.19MiB used 211.75MiB path /dev/loop1

Btrfs v3.14.1

Both volumes shall disappear from unity and nautilus immediately after saving changes to /etc/fstab.This will not however works if your mount point is under /media

9
  • Appreciate the effort! But I already am mounting it in fstab: UUID=3d12bc7b-61b1-4dea-b78b-ef9a44a6b698 /media/btr0 btrfs defaults 0 0 Since each drive that makes up the array has its own UUID, I tried this originally: UUID=<btrfs raid device UUID> /media/btr0 btrfs device=PARTUUID=<disk 1 UUID>,device=PARTUUID=<disk 2 UUID> 0 0 but that didn't work either. Will try method 2, though I'd prefer the elegance of the first method. Commented Apr 2, 2015 at 5:34
  • weird, solution 1 works fine here with 14.10. Are you sure you use the FS UUID in the fstab entry, and not one of the raw device UUID ? otherwise i find using the FS label is usually more readable and elegant.
    – mssch
    Commented Apr 2, 2015 at 12:51
  • I don't think I'm using the wrong UUID - there are 2 UUIDs (1 for each of the disks that make the RAID volume, sdg and sdh), I'm using a 3rd UUID generated when I created the array. I'm a little confused by your "$ sudo btrfs filesystem show /dev/[block device]" suggestion. All I can think to use is /dev/sdg or /dev/sdh, both of which return "Btrfs v3.12". I got my UUID from "$ sudo btrfs filesystem show", which shows the UUID of the array. Of course, I could easily be missing something obvious... Commented Apr 3, 2015 at 4:15
  • I've added more details below my original question. Commented Apr 3, 2015 at 4:27
  • Ok, i get now why solution 1 doesn't work, because you're mounting under /media. You're using the correct UUID. Regarding $ sudo btrfs filesystem show /dev/[block device], specifying a block dev, a partition or a path (see btrfs filesystem show -h) is optional, if omitted the command will list all btrfs filesystems known to the kernel on the system. In your case, $ sudo btrfs filesystem show /dev/sdg1 (or sdh1) shall work. Am afraid if mounting under /media (or /home) is a req for you, then only solution 2 would work. I will update my original answer.
    – mssch
    Commented Apr 3, 2015 at 10:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .