Skip to contentSkip to conversation

directory instead of link for thinpools?

DISCUSSION NAK Oliver Rath 3 participants 3 messages Mar 3, 2016

lore
Share & tools
lore
#0 lore raw

Hi list,

Im using thinpool-devices for a longer time (3+ years) and thinking about a more intuitive representation in /dev/.

If Im right, Thinpools are not used directly (as device), only as pool for thinpool-based devices (these with --virtualsize instead of --size).

I.e. we are using "vg" as volumegroup and "pool" as thinpool, "pooldevice" a "pool" based virtual device and "standarddevice" a normal (non-thinpool) lvm-device, then following happens:

- /dev/vg/pool is a link to /dev/dm-X, which is a device node, but never used directly
- /dev/vg/pooldevice is also a link to /dev/dm-Y, but now it is useable directly
- /dev/vg/standarddevice is also a link to /dev/dm-Z, useable directly, but not snappable like thinpool devices

This is imho a bit confusing.

My idea now would be to change the representation of "pool" from a link to this (never directly used) device to a directory, which includes the links to the pooldevices. Now the representation would look like this ("/" is dir, "@" is link):

/dev/vg/standarddevice@
/dev/vg/pool/
/dev/vg/pool/pooldevice@

Now I tried to create this with udev-rules, but unfortunatly I didnt find any possibility to differ between standarddevices, pools and pool-based devices. Is there any possibility to recogize this for udev-rules?

What do you think generally about this idea?

Tfh!

Oliver

#1 lore raw

Dne 3.3.2016 v 11:17 Oliver Rath napsal(a):

Quoted 31 lines

Hi list,

Im using thinpool-devices for a longer time (3+ years) and thinking about a more intuitive representation in /dev/.

If Im right, Thinpools are not used directly (as device), only as pool for thinpool-based devices (these with --virtualsize instead of --size).

I.e. we are using "vg" as volumegroup and "pool" as thinpool, "pooldevice" a "pool" based virtual device and "standarddevice" a normal (non-thinpool) lvm-device, then following happens:

- /dev/vg/pool is a link to /dev/dm-X, which is a device node, but never used directly
- /dev/vg/pooldevice is also a link to /dev/dm-Y, but now it is useable directly
- /dev/vg/standarddevice is also a link to /dev/dm-Z, useable directly, but not snappable like thinpool devices

This is imho a bit confusing.

My idea now would be to change the representation of "pool" from a link to this (never directly used) device to a directory, which includes the links to the pooldevices. Now the representation would look like this ("/" is dir, "@" is link):

/dev/vg/standarddevice@
/dev/vg/pool/
/dev/vg/pool/pooldevice@

Quoted 7 lines

Now I tried to create this with udev-rules, but unfortunatly I didnt find any possibility to differ between standarddevices, pools and pool-based devices. Is there any possibility to recogize this for udev-rules?

What do you think generally about this idea?

Hi

NACK

It's already complex with existing udev & system rules - so adding new complicated stuff makes no sense.

If you need to get some 'visually' similar layout - just prepend pool name prefix into your LV name.

But there is not going to be subdir support for LVs in lvm2.

It stays with simple rule: user usable LV has device path:

/dev/vgname/lvname

and thinLV is user usable LV and we are not going change this key rule.

Regards

Zdenek

#2 lore raw
In reply to Oliver Rath
Quoted 11 lines · Oliver Rath

This is imho a bit confusing.

My idea now would be to change the representation of "pool" from a link to this (never directly used) device to a directory, which includes the links to the pooldevices. Now the representation would look like this ("/" is dir, "@" is link):

/dev/vg/standarddevice@
/dev/vg/pool/
/dev/vg/pool/pooldevice@

If your goal is to identify and separate thin LVs based on pools they belong to, we already have a way to do that easily via -S|--select.

For example:

[0] fedora/~ # lvs -o+layout,role vg

  LV    VG   Attr       LSize  Pool  Data%  Meta%  Layout      Role      
  lvol1 vg   Vwi-a-tz--  4.00m pool1 0.00          thin,sparse public    
  lvol2 vg   Vwi-a-tz--  4.00m pool2 0.00          thin,sparse public    
  lvol3 vg   Vwi-a-tz--  4.00m pool1 0.00          thin,sparse public    
  lvol4 vg   Vwi-a-tz--  4.00m pool2 0.00          thin,sparse public    
  lvol5 vg   Vwi-a-tz--  4.00m pool1 0.00          thin,sparse public    
  lvol6 vg   Vwi-a-tz--  4.00m pool2 0.00          thin,sparse public    
  pool1 vg   twi-aotz-- 52.00m       0.00   1.17   thin,pool   private   
  pool2 vg   twi-aotz-- 24.00m       0.00   1.17   thin,pool   private 

[0] fedora/~ # lvs -o+layout,role vg --select 'pool_lv=pool1'

  LV    VG   Attr       LSize Pool  Data%  Layout      Role      
  lvol1 vg   Vwi-a-tz-- 4.00m pool1 0.00   thin,sparse public    
  lvol3 vg   Vwi-a-tz-- 4.00m pool1 0.00   thin,sparse public    
  lvol5 vg   Vwi-a-tz-- 4.00m pool1 0.00   thin,sparse public    

[0] fedora/~ # lvs -o+layout,role vg --select 'pool_lv=pool2'

  LV    VG   Attr       LSize Pool  Data%  Layout      Role      
  lvol2 vg   Vwi-a-tz-- 4.00m pool2 0.00   thin,sparse public    
  lvol4 vg   Vwi-a-tz-- 4.00m pool2 0.00   thin,sparse public    
  lvol6 vg   Vwi-a-tz-- 4.00m pool2 0.00   thin,sparse public 

Also, we have 'layout' and 'role' fields which make it easier to identify the LVs in more detail and then you can use that for your selections (selection on subsets are also supported):

[0] fedora/~ # lvcreate -s vg/lvol6
Logical volume "lvol7" created.

[0] fedora/~ # lvs -o+layout,role vg --select 'role=snapshot'

  LV    VG   Attr       LSize Pool  Origin FAncestors   Layout      Role                        
  lvol7 vg   Vwi---tz-k 4.00m pool2 lvol6  lvol6        thin,sparse public,snapshot,thinsnapshot

You can even display full path to the device:

[0] fedora/~ # lvs -o+layout,role,path vg --select 'role=snapshot'

  LV    VG   Attr       LSize Pool  Origin FAncestors   Layout      Role                         Path         
  lvol7 vg   Vwi---tz-k 4.00m pool2 lvol6  lvol6        thin,sparse public,snapshot,thinsnapshot /dev/vg/lvol7

You can use selection on any field practically, see also lvs -o help.

I would probably try to avoid editing udev rules because it's always a source of various problems so we're trying to avoid changes there as much as possible.

Does that -S|--select make it easier for you to identify the LVs or do you think it's missing something we could probably enhance there still?

Signature · 1 line
Peter