[linux-lvm] problem with lvcreate and redirection

Lentes, Bernd bernd.lentes at helmholtz-muenchen.de
Fri Feb 19 18:40:22 UTC 2016


i have a script in which i invoke lvremove and lvcreate. With lvremove i don't have proplems but with lvcreate. 
I'm redirecting stdout and stderr to a file because the script is executed by cron and i'd like to have a look afterwards if everything went fine. 
The command is: lvcreate -v -L 25G -n lv_root_snapshot -s vg1/lv_root > lvcreate_with_redirection.log 2>&1. Shell does not accept further commands afterwards, but host still responds to ping. You can have a look on lvcreate_with_redirection.log here: https://hmgubox.helmholtz-muenchen.de:8001/d/b4c7025bac/ .
System seems to stop while suspending. 

last lines of the log:

    Creating vg1-lv_root_snapshot-cow
    Loading vg1-lv_root_snapshot-cow table (252:3)
    Resuming vg1-lv_root_snapshot-cow (252:3)
    Loading vg1-lv_root_snapshot table (252:1)
    Suspending vg1-lv_root (252:0) with filesystem sync with device flush

I did a strace on the command and that confirms it:
strace -ftt lvcreate -v -L 25G -n lv_root_snapshot -s vg1/lv_root > lvcreate_strace_with_redirection.log 2>&1
last lines of the log (you find all the mentioned logs on the link):


17:43:59.199487 ioctl(4, DM_TABLE_DEPS, 0x7875e0) = 0
17:43:59.199581 ioctl(4, DM_DEV_STATUS, 0x7875e0) = -1 ENXIO (No such device or address)
17:43:59.199680 ioctl(4, DM_DEV_STATUS, 0x7875e0) = -1 ENXIO (No such device or address)
17:43:59.199749 ioctl(4, DM_DEV_STATUS, 0x7875e0) = 0
17:43:59.199803 write(2, "  ", 2  )       = 2
17:43:59.199905 write(2, "  ", 2  )       = 2
17:43:59.199945 write(2, "Suspending vg1-lv_root (252:0) w"..., 69Suspending vg1-lv_root (252:0) with filesystem sync with device flush) = 69
17:43:59.199981 write(2, "\n", 1
)       = 1
17:43:59.200068 ioctl(4, DM_DEV_SUSPEND

Issuing the command without the redirection of stderr works !
lvcreate -v -L 25G -n lv_root_snapshot -s vg1/lv_root > lvcreate_with_redirection_without_stderr.log

Snapshot is created and systems keeps on running (although snapshot is created in all cases, also with the commands which stop the server).

When i use "lvcreate -v -L 25G -n lv_root_snapshot -s vg1/lv_root > lvcreate_with_redirection_without_stderr.log" in conjunction with unbuffer, system also keeps running:
unbuffer lvcreate -v -L 25G -n lv_root_snapshot -s vg1/lv_root > lvcreate_with_redirection_unbuffer.log 2>&1

Logfile again on the internet.

For the sake of completeness i did a strace without redirection and copied afterwards the content of the terminal to the file lvcreate_strace_without_redirection.log: strace -ftt lvcreate -v -L 25G -n lv_root_snapshot -s vg1/lv_root.
System keeps on running.

Any ideas why this behaves so strange ?

Host is a virtual machine (KVM), running SLES 11 SP4 64bit. LVM is lvm2-2.02.98-0.37.2.
My root directory resides on a lv:
/dev/mapper/vg1-lv_root on / type ext3 (rw,strictatime,acl,user_xattr)
/dev/vda3 on /boot type ext3 (rw,strictatime,acl,user_xattr)

The host for the vm is also SLES 11 SP4 64bit.


Bernd Lentes 

institute of developmental genetics 
Gebäude 35.34 - Raum 208 
HelmholtzZentrum München 
bernd.lentes at helmholtz-muenchen.de 
phone: +49 (0)89 3187 1241 
fax: +49 (0)89 3187 2294 

Wer Visionen hat soll zum Hausarzt gehen 
Helmut Schmidt
Helmholtz Zentrum München

Helmholtz Zentrum Muenchen
Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH)
Ingolstaedter Landstr. 1
85764 Neuherberg
Aufsichtsratsvorsitzende: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrer: Prof. Dr. Guenther Wess, Dr. Alfons Enhsen, Renate Schlusen (komm.)
Registergericht: Amtsgericht Muenchen HRB 6466
USt-IdNr: DE 129521671

More information about the linux-lvm mailing list