You are not logged in.

#1 2015-02-11 12:50:24

Cerynon
Member
Registered: 2014-03-28
Posts: 7

[solved] lvm lvcreate created a new volume points to existing btrfs fs

Hi There,

  I wanted to add a new logical volume to an existing volume group so I ran :-
  lvcreate -n SambaShares -L 50G MainVG
 
  It warned me that btrfs fs was detected so I stopped right there to figure things out..

   # blkid /dev/MainVG/ArchRoot
   /dev/MainVG/ArchRoot   : UUID="0532ffd7-dc9e-4ec4-bce2-8ac21f121f12" UUID_SUB="90497162-1ffe-4a13-9c93-f32f4fd0ef98" TYPE="btrfs"
   # blkid /dev/MainVG/SambaShares
   /dev/MainVG/SambaShares: UUID="0532ffd7-dc9e-4ec4-bce2-8ac21f121f12" UUID_SUB="90497162-1ffe-4a13-9c93-f32f4fd0ef98" TYPE="btrfs"

  The newly created logical volume points to my root!
  I tried mounting the SambaShares filesystem somewhere else and verifying a new file I just wrote to the real root.
  The file was present on SambaShares mount.
  They are the same physical filesytem.
 
  Any ideas what to do now? I dare not remove the new volume in case it wipes my root.
 
  lvs output
 

 
  --- Logical volume ---
  LV Path                /dev/MainVG/ArchRoot
  LV Name                ArchRoot
  VG Name                MainVG
  LV UUID                2cVb2C-3jDT-1yGl-AM5h-BRac-BcLe-3IQoso
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:11 
  --- Logical volume ---
  LV Path                /dev/MainVG/SambaShares
  LV Name                SambaShares
  VG Name                MainVG
  LV UUID                akgEB9-IsUf-Xnzw-qRnq-HrvE-buva-ObYwFV
  LV Write Access        read/write
  LV Creation host, time storage-pc, 2015-02-11 21:56:22 +1100
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     768
  Block device           253:15
 

/etc/lvm/backup
   

 ArchRoot {
                        id = "2cVb2C-3jDT-1yGl-AM5h-BRac-BcLe-3IQoso"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        segment_count = 1

                        segment1 {
                                start_extent = 0
                                extent_count = 800      # 50 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv3", 0
                                ]
                        }
                }

SambaShares {
                        id = "akgEB9-IsUf-Xnzw-qRnq-HrvE-buva-ObYwFV"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        creation_host = "storage-pc"
                        creation_time = 1423652182      # 2015-02-11 21:56:22 +1100
                        segment_count = 1

                        segment1 {
                                start_extent = 0
                                extent_count = 800      # 50 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv0", 29664
                                ]
                        } 

Thanks,

John

Last edited by Cerynon (2015-02-12 04:21:44)

Offline

#2 2015-02-11 13:01:06

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: [solved] lvm lvcreate created a new volume points to existing btrfs fs

In general, it's not entirely odd for a UUID or filesystem to show up on a newly created LV.

When you delete a LV the data on it is not wiped (except maybe on SSD); you create a new LV, old data may show up.

According to your lvm backup the LVs are allocated in different places (ArchRoot on pv3:0, SambaShares on pv0:29664). This may be presented in a more readable fashion using `pvs -v --segments`, `dmsetup table` or similar. If these LV were indeed physically identical, chances are they'd show up identical in there too.

Now, btrfs has its own layer of device colemongery; so maybe something is happening there, if you [previously] joined that new LV into your btrfs collective? Unfortunately I'm not familiar enough with btrfs to help in that case.

Offline

#3 2015-02-11 13:19:01

Cerynon
Member
Registered: 2014-03-28
Posts: 7

Re: [solved] lvm lvcreate created a new volume points to existing btrfs fs

Thanks frostschutz,

They certainly look different physically

#pvs -v --segments
  PV         VG     Fmt  Attr PSize   PFree   Start SSize LV               Start
/dev/md3   MainVG lvm2 a--  908.19g 358.19g     0   800 ArchRoot             0 linear /dev/md3:0-799
/dev/md0   MainVG lvm2 a--    2.05t 109.38g 29664   800 SambaShares          0 linear /dev/md0:29664-30463

#dmsetup table
MainVG-ArchRoot: 0 104857600 linear 9:3 2048
MainVG-SambaShares: 0 104857600 linear 9:0 3888121856

When I try to mount the filesystems using /dev/mapper names  'cat /proc/mounts'
swaps between showing /dev/mapper/MainVG-ArchRoot & /dev/mapper/MainVG-SambaShares as root fs.
I think the system is getting confused somewhere, so I can't mount both of them to verify they are in fact different.

I just use btrfs as a basic filesystem within lvm volumes on top of software raid. I don't use the the raid features within btrfs.

Last edited by Cerynon (2015-02-11 13:20:44)

Offline

#4 2015-02-11 13:32:35

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: [solved] lvm lvcreate created a new volume points to existing btrfs fs

Okay; LVM-wise I don't see a problem here. If you can also rule out problems on the md layer (cat /proc/mdstat, no overlapping use of physical devices there?), that leaves btrfs. So you have to find a way to make btrfs spill the beans how it sees those devices. You should put btrfs in your thread title to get some btrfs-savvy people in here. wink

Offline

#5 2015-02-11 13:43:23

Cerynon
Member
Registered: 2014-03-28
Posts: 7

Re: [solved] lvm lvcreate created a new volume points to existing btrfs fs

I am feeling more confident it's just a ghost image from a previous lvm pvmove operation.

Google tells me Btrfs won't let you change uuid as its referenced internally. It's also a bad idea to have 'raw'/dd copies of the btrfs filesystem on the same machine! 

I will do a rsync copy of the entire root to a fresh volume as a backup.

Then will lay down a new (ext4!)  filesystem on the SambaShare volume. Edit* I just removed the logical volume and recreated a fresh one. Everything is working now!

/proc/mdstat looks good, nothing got mixed up there.

Thanks for your help in verifying this.

Last edited by Cerynon (2015-02-12 04:23:00)

Offline

Board footer

Powered by FluxBB