# LVM hangs on shutdown[SOLVED, if not understood]

## madchaz

Good day all. 

I'm having a problem with shutting down my server. 

Right now, my server as some iSCSI drives as well as real scsi and ide drives. At one point, I made the mistake of trying to get the real ide hd in a LVM group with some iSCSI drives. This caused some weird issues, so I completly re-formated the drive and detatched the iSCSI drives. (they got destroyed after)

however, ever since then, LVM will hang on shutdown. I manually un-mount all iSCSI drives in /etc/local.stop (so they get unmounted while the network is still up) and as far as I could find with my limited knowledge, I shouldn't have anything left from the failed VG. 

However, the fact that LVM now hangs leads me to think otherwise. 

Anyone as an idea where to look for this?

----------

## Hu

Patch the failed initscript to show the output of lvs;vgs;pvs before it tries to stop LVM.  That output may provide some indication about why the shutdown hangs.

----------

## madchaz

```
sonofboo ~ # lvs

  LV       VG       Attr   LSize  Origin Snap%  Move Log Copy%  Convert

  root     vg_raid5 -wi-ao  5.00g

  transfer vg_raid5 -wi-a- 25.00g

  vm_rep_1 vg_raid5 -wi-ao 15.00g

sonofboo ~ # vgs

  VG       #PV #LV #SN Attr   VSize  VFree

  vg_raid5   1   3   0 wz--n- 50.35g 5.35g

sonofboo ~ # pvs

  PV         VG       Fmt  Attr PSize  PFree

  /dev/md3   vg_raid5 lvm2 a-   50.35g 5.35g

sonofboo ~ #

```

that's the result during normal operations. vg_raid5 is supposed to be there, as it contains (among others) /

No trace of the failed PVs or the VG I had created then.

----------

## frostschutz

are you using the lastest (~arch) version of lvm? the lvm shutdown script was changed recently (because it took ages to shutdown on my system   :Razz: )... it's not using any more loops now, just a single call to lvchange / vgchange. It should not cause hangs...

----------

## madchaz

I'm using stable, not arch

it works fine on my san with the same version, but my server hangs

----------

## Hu

 *madchaz wrote:*   

> that's the result during normal operations.

 What does it look like right before the script hangs?  I want to confirm or disprove the idea that some other operation that occurs earlier in the shutdown is preventing proper shutdown of LVM.  Seeing the state of the LVM immediately before it hangs may give a clue as to what that operation might be.

----------

## madchaz

It looks like it's doing a normal shutdown. No error, nothing. 

It umounts the file systems, then gets to shutting down LVM and just hangs there. (I waited 10 minutes before pressing power)

So no error, nothing. That's what confuses the heck out of me.

nothing in my shutdown scripts is unsual, except that I umount all iSCSI drives in local.stop, so they aren't mounted anymore when the network goes down.

----------

## madchaz

Upgraded to the new stable release of LVM2 and also added a few lines to also disconnect the iSCSI drives on shutdown. Apparently, one of those 2, or both, fixed the issue.

----------

## drescherjm

Could it be that the network went down before the iScsi drives were disconnected.

Edit: I see you said that the iSCSI drives were unmounted with the network up. 

The reason I mentioned this was I had a similar problem for a long time with openvz. The network would shutdown before the containers shutdown. The containers were waiting on closing nfs so they hung there. lvm was waiting on the filesystem of the containers being unmounted..

----------

## madchaz

I was unmounting them, but I had forgoten to disconnect them. However, that hadn't prevented the shutdown before, so not 100% sure that is what was causing it. That an upgrade to LVM became available at the same time could also be what fixed it. The issue appears to have been lvm getting hung on shutting down the vg that hosts root. (now it errors out like it should), so maybe the upgrade fixed it.

----------

