0

in following link https://www.kernel.org/doc/Documentation/device-mapper/thin-provisioning.txt I have read that:

create_thin

which is command sent to device mapper.

0

If you're talking about this section:

i) Creating a new thinly-provisioned volume.

  To create a new thinly- provisioned volume you must send a message to an
  active pool device, /dev/mapper/pool in this example.

    dmsetup message /dev/mapper/pool 0 "create_thin 0"

  Here '0' is an identifier for the volume, a 24-bit number.  It's up
  to the caller to allocate and manage these identifiers.  If the
  identifier is already in use, the message will fail with -EEXIST.

then it's just a unique number to refer to the thin volume ("an identifier"). LVM appears to assign them the obvious way — by counting (from one). You can see the ones LVM used by checking the output of dmsetup table:

# dmsetup table | grep thin
Giri-ThinPoolLV-tpool: 0 116752384 thin-pool 253:9 253:10 1024 22803 0 
Giri-vm--gl--runner: 0 62914560 thin 253:12 6
Giri-vm--squeeze--64: 0 10485760 thin 253:12 7
Giri-vm--portal--dev: 0 62914560 thin 253:12 5
Giri-vm--jessie--64: 0 31457280 thin 253:12 1
Giri-vm--stretch--64: 0 41943040 thin 253:12 2
Giri-vm--portal--test: 0 62914560 thin 253:12 4
Giri-vm--wheezy--64: 0 31457280 thin 253:12 3

(if you've not seen it before, the 253:12 is a device major:minor number, in this case /dev/dm-12, which is Giri-ThinPoolLV-tpool).

  • Your last sentence in brackets is very unclear for me. What does it mean major/minor? What is /dev/dm-12? Block device? Thin volume? Can it exists without LVM (with only devicemapper) ? – nrz53378 Oct 27 '18 at 10:16
  • From what do you know that /dev/dm-12 corresponds to thin-pool? – nrz53378 Oct 28 '18 at 11:33
  • @nrz53378 Easiest way to see which correspond is dmsetup ls or ls -l /dev/mapper. Major & minor number are for the block devices; at least on that system 253 is device-mapper's major number, and then all the devices (mapping tables) it creates get their minor number, starting from 1. (Remember a device is, to the kernel, identified by the major and minor number; the kernel does not care about the name userspace gives to the device file). – derobert Oct 29 '18 at 18:17
  • Thanks, your answers/comments are cool! Everything is clear for me despite of one thing, namely you said that device inside thin-pool is in reality mapping table. I know it. In other words thin pool is pool of blocks. And then, thin device (sometimes called thin volume) is mapping between blocks of this device to blocks in pool. Is it possible to print this mapping table? For example, for device and its snapshot it should print exactly the same mapping tables (right after taking snapshot). Is it possible? Correctly Do I understand it? – nrz53378 Oct 29 '18 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.