determing lvm support
is there any fool proof way of knowing whether or not a system has lvm support?
right now i determine it this way:
lvm1:
look for "vgcreate" command and
look for "lvm" in /proc/devices or
look for "lvm-mod" in /lib/modules/[release]/kernel/drivers/md/*
lvm2:
look for "vgcreate" command and
look for "device-mapper" in /proc/devices or
look for "dm-mod" in /lib/modules/[release]/kernel/drivers/md/*
i think i am fairly certain with lvm1, but with lvm2 i am not sure if i have device mapper support and a lvm command that is enough.
any ideas?
rich turner
Quoted 2 lines · Rich Turner
lvm2:
look for "vgcreate" command and
Better to check for the new 'lvm' base command: other commands are links to it: check that running 'lvm version' produces complete output. That will also confirm that device-mapper is available in the live kernel and that /dev/mapper/control is set up correctly. (See device-mapper/scripts/devmap_mknod.sh)
Quoted 1 line
look for "device-mapper" in
/proc/devicesor
It's better to check for that in /proc/misc, which will tell you whether or not device-mapper support is present in the running kernel.
Quoted 1 line
look for "dm-mod" in /lib/modules/[release]/kernel/drivers/md/*
Better to attempt to load the module with modprobe and then do the tests above to check it worked.
Alasdair
Signature · 1 line
[email protected]
Quoted 9 lines · Alasdair G Kergon
Quoted 2 lines · Rich Turner
lvm2:
look for "vgcreate" command andBetter to check for the new 'lvm' base command: other commands are links to it: check that running 'lvm version' produces complete output. That will also confirm that device-mapper is available in the live kernel and that
/dev/mapper/controlis set up correctly. (Seedevice-mapper/scripts/devmap_mknod.sh)
Besides that is there any way to reliably check if dm is loaded from a c program, besides calling dm_task_run(), which is noisy if the driver is not loaded? I don't want the user to see an error if she's not running device-mapper.
it the moment i try to open dm_dir()/control, is that ok?
L.
Signature · 6 lines
Luca Berra -- [email protected] Communication Media & Services S.r.l. /"\ \ / ASCII RIBBON CAMPAIGN X AGAINST HTML MAIL / \
Quoted 4 lines · Luca Berra
Besides that is there any way to reliably check if dm is loaded from a c program, besides calling
dm_task_run(), which is noisy if the driver is not loaded? I don't want the user to see an error if she's not running device-mapper.
Look at using dm_log_init() to provide a function that suppresses all output.
Quoted 1 line
it the moment i try to open dm_dir()/control, is that ok?
That should work OK bypassing libdevmapper.
Otherwise, try dm_task_get_driver_version() after disabling log output.
Alasdair
Signature · 1 line
[email protected]
Quoted 8 lines · Alasdair G Kergon
Quoted 4 lines · Luca Berra
Besides that is there any way to reliably check if dm is loaded from a c program, besides calling
dm_task_run(), which is noisy if the driver is not loaded? I don't want the user to see an error if she's not running device-mapper.Look at using
dm_log_init()to provide a function that suppresses all output.
I'll look at it, but it seems i cannot restore the previous log function then, i think it's easier to bypass the lib for my particular case. Thanks a lot for your answers.
Regards,
L.
Signature · 6 lines
Luca Berra -- [email protected] Communication Media & Services S.r.l. /"\ \ / ASCII RIBBON CAMPAIGN X AGAINST HTML MAIL / \
Quoted 2 lines · Luca Berra
Quoted 1 line
Look at using
dm_log_init()to provide a function thatI'll look at it, but it seems i cannot restore the previous log function
I'll fix it so people can.
Alasdair
Signature · 1 line
[email protected]
Quoted 8 lines · Alasdair G Kergon
Quoted 2 lines · Rich Turner
lvm2:
look for "vgcreate" command andBetter to check for the new 'lvm' base command: other commands are links to it: check that running 'lvm version' produces complete output. That will also confirm that device-mapper is available in the live kernel and that
/dev/mapper/controlis set up correctly. (Seedevice-mapper/scripts/devmap_mknod.sh)
if i have 'device-mapper' and 'lvm version' produces complete output, is there anything else to check if lvm is supported on the system?
is 'device-mapper' used for anything else besides lvm?
does the kernel need to be built with 'lvm' support (which i believe was true with lvm1-created 'lvm-mod'), or does building a kernel for 'lvm' support just create 'dm-mod' loadable module/builtin 'dm-mod' kernel support?
Quoted 3 lines
Quoted 1 line
look for "device-mapper" in
/proc/devicesorIt's better to check for that in
/proc/misc, which will tell you whether or not device-mapper support is present in the running kernel.
why is it better to check in /proc/misc? when device-mapper support is loaded, it shows up in both /proc/misc as well as /proc/devices.
Quoted 6 lines
Quoted 2 lines
look for "dm-mod" in /lib/modules/[release]/kernel/drivers/md/*
Better to attempt to load the module with modprobe and then do the tests above to check it worked.
Alasdair
Quoted 5 lines · Rich Turner
Quoted 3 lines
Quoted 1 line
look for "device-mapper" in
/proc/devicesorIt's better to check for that in
/proc/misc, which will tell you whether or not device-mapper support is present in the running kernel.why is it better to check in
/proc/misc? when device-mapper support is loaded, it shows up in both/proc/miscas well as/proc/devices.
You can only guarantee its appearance in /proc/devices while you have a device active.
Alasdair
Signature · 1 line
[email protected]
Quoted 11 lines · Rich Turner
is there any fool proof way of knowing whether or not a system has lvm support?
right now i determine it this way:
lvm1:
look for "lvm-mod" in /lib/modules/[release]/kernel/drivers/md/*
lvm2:
look for "dm-mod" in /lib/modules/[release]/kernel/drivers/md/*
The only problem with this step is that many kernels (any production-level server of mine at least) do not use loadable modules, but instead build LVM support striaght into the kernel. In these cases your tests for the modules will fail.