Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Can't deactivate LVM Group on halt

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
RoyFokker
Posts: 209
Joined: 2008-07-05 10:56

Can't deactivate LVM Group on halt

#1 Post by RoyFokker »

I get the following error everytime I do a halt:
console wrote: # /etc/init.d/lvm2 stop
Shutting down LVM Volume Groups Can't deactivate volume group "nikoshd" with 2 open logical volume(s)
failed!
I found this from googling:
bugs.debian.org wrote: From: Ferenc
If a volume group contains mounted (even ro) logical volumes, it can't be deactivated. On the other hand, deactivating a volume group does not entail writing to the disk, so powering off with an active volume group isn't bad in itself, if all of its logical volumes are "clean" (eg. mounted read-only). If root is on a logical volume, you will always get a warning about its logical volume being in use during shutdown.
Is this an inconsequential error as Ferenc states, or is it serious?

smallchange
Posts: 1740
Joined: 2009-05-04 15:56
Been thanked: 1 time

Re: Can't deactivate LVM Group on halt

#2 Post by smallchange »

I have been seeing that message for over a year with no consequences. At least no consequences I have noticed. :)

n3wb
Posts: 20
Joined: 2009-06-03 00:21

Re: Can't deactivate LVM Group on halt

#3 Post by n3wb »

Same here I have been seeing it for about 6 months on 2 mount points. I

Code: Select all

umount -R /dev/the/mount/in/question
(often times having to kill some open processes first) then run

Code: Select all

fsck -R /dev/the/mount/in/question
I use

Code: Select all

 fuser -m /dev/the/mount/in/question
to find the open processes. Then

Code: Select all

Kill PID
to kill them before I umount the device. I have never once found any errors on either device.
Of course then I

Code: Select all

mount /dev/the/mount/in/question /where/I/want/to/mount/it
I do this about once a month just to be sure because the error takes my warm fuzzy away.

User avatar
bugsbunny
Posts: 5354
Joined: 2008-07-06 17:04
Been thanked: 1 time

Re: Can't deactivate LVM Group on halt

#4 Post by bugsbunny »

I do this about once a month just to be sure because the error takes my warm fuzzy away.
I often get an fsck run on reboot, sometimes with a journal replay (because rooy is mounted as read/write so it's technicallu an "unclean" dismount. But as long as everything shits down correctly it's no problem. I'ts been fine so far. Anyway I found the following while browsing around one day. It takes advantage of the fact that lvm allows for snapshots, so you mount the snapshot and run fsck against that, meaning that you can effectively run this against a mounted system.

The device being checked here is a logical volume called debian-root sitting on a volume group named debianVG1. So the full device name is /dev/debianVG1/debian-root (or actually /dev/mapper/debianVG1-debian--root, which is symlinked to by /dev/debianVG1/debian-root)

The snapsize I defined here is 100MB, which is overkill (massive actually in this case), even though the LV is defined at 15GB. It only needs to hold the changes to the disk for the amount of time the snapshot is mounted. In my case it's an ext4 partition.

Considering the original author I had high confidence in this script, and it worked just fine when I was testing it. It also resets the mount counts back to zero, replacing the need/desire for boot time checks. I set up a cron job to run this against all my logical volumes weekly.

Code: Select all

#!/bin/sh
#
# e2croncheck --- put this in your weekly crontab 
#
# make sure you customize "VG" so it is your LVM # volume group name, 
# "VOLUME" so it is the name of the root logical volume, and "EMAIL" to
# be your e-mail address
#
# Written by Theodore Ts'o, Copyright 2007-2008
#
# This file may be redistributed under the terms of the 
# GNU Public License, version 2.
#
VG=debianVG1
VOLUME=debian-root
SNAPSIZE=100m
EMAIL=wouldntyouliketoknow@example.com

TMPFILE=`mktemp -t e2fsck.log.XXXXXXXXXX`

OPTS="-Fttv -C0"
#OPTS="-Fttv -E fragcheck"

set -e
START="$(date +'%Y%m%d%H%M%S')"
lvcreate -s -L ${SNAPSIZE} -n "${VOLUME}-snap" "${VG}/${VOLUME}"
if nice logsave -as $TMPFILE e2fsck -p $OPTS "/dev/${VG}/${VOLUME}-snap" && \
   nice logsave -as $TMPFILE e2fsck -fy $OPTS "/dev/${VG}/${VOLUME}-snap" ; then
  echo 'Background scrubbing succeeded!'
  tune2fs -C 0 -T "${START}" "/dev/${VG}/${VOLUME}"
else
  echo 'Background scrubbing failed! Reboot to fsck soon!'
  tune2fs -C 16000 -T "19000101" "/dev/${VG}/${VOLUME}"
  if test -n "$RPT-EMAIL"; then 
    mail -s "E2fsck of /dev/${VG}/${VOLUME} failed!" $EMAIL < $TMPFILE
  fi
fi
lvremove -f "${VG}/${VOLUME}-snap"
rm $TMPFILE

Post Reply