Lentes, Bernd
2014-08-20 15:27:52 UTC
Hi ML,
i'm writing a script to update my servers. Before updating, i'd like to create a snapshot of the root-directory (/). If something goes wrong with the update, I have a consistent backup.
I try to redirect stdout and stderr to a logfile for being able to check everything afterwards. The redirection has problems with lvcreate.
This is my script (excerpt):
============================================================
lvremove -fv /dev/vg1/lv_root_snapshot &> /var/log/update.log
lvcreate -v -L 45G -n lv_root_snapshot -s vg1/lv_root >> /var/log/update.log 2>&1
zypper -n up -y -t patch --skip-interactive >> /var/log/update.log 2>&1
============================================================
With the second line I try to create the lv and redirect stdout/stderr to a log file.
The whole system stop by executing the second line, this are the last lines in my log:
============================================================
lvcreate Setting logging type to disk
lvcreate Setting chunksize to 8 sectors.
lvcreate Finding volume group "vg1"
lvcreate Archiving volume group "vg1" metadata (seqno 99).
lvcreate Creating logical volume lv_root_snapshot
lvcreate Creating volume group backup "/etc/lvm/backup/vg1" (seqno 100).
lvcreate Found volume group "vg1"
lvcreate activation/volume_list configuration setting not defined: Checking only host tags for vg1/lv_root_snapshot
lvcreate Creating vg1-lv_root_snapshot
lvcreate Loading vg1-lv_root_snapshot table (252:1)
lvcreate Resuming vg1-lv_root_snapshot (252:1)
lvcreate Clearing start of logical volume "lv_root_snapshot"
lvcreate Creating logical volume snapshot0
lvcreate Found volume group "vg1"
lvcreate Found volume group "vg1"
lvcreate Creating vg1-lv_root-real
lvcreate Loading vg1-lv_root-real table (252:2)
lvcreate Loading vg1-lv_root table (252:0)
lvcreate Creating vg1-lv_root_snapshot-cow
lvcreate Loading vg1-lv_root_snapshot-cow table (252:3)
lvcreate Resuming vg1-lv_root_snapshot-cow (252:3)
lvcreate Loading vg1-lv_root_snapshot table (252:1)
lvcreate Suspending vg1-lv_root (252:0) with filesystem sync with device flush
===========================================================
I tried it several times, and the system always stop at this point. When I execute the same command manually in a shell no change. Stop.
Redirecting the lvremove command on a shell in the same manner is working fine:
lvremove -fv /dev/vg1/lv_root_snapshot >> /var/log/update.log 2>&1
system continues running.
lvcreate manually in a shell and only redirecting stdout is working fine:
lvcreate -v -L 45G -n lv_root_snapshot -s vg1/lv_root >> /var/log/update.log
system continues running
Only the combination of redirecting stdout and stderr to the logfile stops the system completely:
lvcreate -v -L 45G -n lv_root_snapshot -s vg1/lv_root >> /var/log/update.log 2>&1
Any ideas ?
my system:
SLES 11 SP3 64bit
vm58820-6:~ # lvm version
LVM version: 2.02.98(2) (2012-10-15)
Library version: 1.03.01 (2011-10-15)
Driver version: 4.23.0
1 lv for the root-directory, /boot is a "real" partition
1pv, 1 vg
Bernd
--
Bernd Lentes
Systemadministration
Institut für Entwicklungsgenetik
Gebäude 35.34 - Raum 208
HelmholtzZentrum münchen
***@helmholtz-muenchen.de
phone: +49 89 3187 1241
fax: +49 89 3187 2294
http://www.helmholtz-muenchen.de/idg
Die Freiheit wird nicht durch weniger Freiheit verteidigt
Helmholtz Zentrum München
Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
Ingolstädter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
Geschäftsführer: Prof. Dr. Günther Wess, Dr. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht München HRB 6466
USt-IdNr: DE 129521671
i'm writing a script to update my servers. Before updating, i'd like to create a snapshot of the root-directory (/). If something goes wrong with the update, I have a consistent backup.
I try to redirect stdout and stderr to a logfile for being able to check everything afterwards. The redirection has problems with lvcreate.
This is my script (excerpt):
============================================================
lvremove -fv /dev/vg1/lv_root_snapshot &> /var/log/update.log
lvcreate -v -L 45G -n lv_root_snapshot -s vg1/lv_root >> /var/log/update.log 2>&1
zypper -n up -y -t patch --skip-interactive >> /var/log/update.log 2>&1
============================================================
With the second line I try to create the lv and redirect stdout/stderr to a log file.
The whole system stop by executing the second line, this are the last lines in my log:
============================================================
lvcreate Setting logging type to disk
lvcreate Setting chunksize to 8 sectors.
lvcreate Finding volume group "vg1"
lvcreate Archiving volume group "vg1" metadata (seqno 99).
lvcreate Creating logical volume lv_root_snapshot
lvcreate Creating volume group backup "/etc/lvm/backup/vg1" (seqno 100).
lvcreate Found volume group "vg1"
lvcreate activation/volume_list configuration setting not defined: Checking only host tags for vg1/lv_root_snapshot
lvcreate Creating vg1-lv_root_snapshot
lvcreate Loading vg1-lv_root_snapshot table (252:1)
lvcreate Resuming vg1-lv_root_snapshot (252:1)
lvcreate Clearing start of logical volume "lv_root_snapshot"
lvcreate Creating logical volume snapshot0
lvcreate Found volume group "vg1"
lvcreate Found volume group "vg1"
lvcreate Creating vg1-lv_root-real
lvcreate Loading vg1-lv_root-real table (252:2)
lvcreate Loading vg1-lv_root table (252:0)
lvcreate Creating vg1-lv_root_snapshot-cow
lvcreate Loading vg1-lv_root_snapshot-cow table (252:3)
lvcreate Resuming vg1-lv_root_snapshot-cow (252:3)
lvcreate Loading vg1-lv_root_snapshot table (252:1)
lvcreate Suspending vg1-lv_root (252:0) with filesystem sync with device flush
===========================================================
I tried it several times, and the system always stop at this point. When I execute the same command manually in a shell no change. Stop.
Redirecting the lvremove command on a shell in the same manner is working fine:
lvremove -fv /dev/vg1/lv_root_snapshot >> /var/log/update.log 2>&1
system continues running.
lvcreate manually in a shell and only redirecting stdout is working fine:
lvcreate -v -L 45G -n lv_root_snapshot -s vg1/lv_root >> /var/log/update.log
system continues running
Only the combination of redirecting stdout and stderr to the logfile stops the system completely:
lvcreate -v -L 45G -n lv_root_snapshot -s vg1/lv_root >> /var/log/update.log 2>&1
Any ideas ?
my system:
SLES 11 SP3 64bit
vm58820-6:~ # lvm version
LVM version: 2.02.98(2) (2012-10-15)
Library version: 1.03.01 (2011-10-15)
Driver version: 4.23.0
1 lv for the root-directory, /boot is a "real" partition
1pv, 1 vg
Bernd
--
Bernd Lentes
Systemadministration
Institut für Entwicklungsgenetik
Gebäude 35.34 - Raum 208
HelmholtzZentrum münchen
***@helmholtz-muenchen.de
phone: +49 89 3187 1241
fax: +49 89 3187 2294
http://www.helmholtz-muenchen.de/idg
Die Freiheit wird nicht durch weniger Freiheit verteidigt
Helmholtz Zentrum München
Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
Ingolstädter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de
Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
Geschäftsführer: Prof. Dr. Günther Wess, Dr. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht München HRB 6466
USt-IdNr: DE 129521671