# mdraid failed to stop

## castor_fou

Recently I have noticed some error in the shutdown process.

From rc.log

```
 * Shutting down the Logical Volume Manager

 * Finished Shutting down the Logical Volume Manager

 * Shutting down RAID devices (mdadm) ...

 * mdadm: stopped /dev/md0

mdadm: Cannot get exclusive access to /dev/md2:Perhaps a running process, mounted filesystem or active volume group?

mdadm: Cannot get exclusive access to /dev/md1:Perhaps a running process, mounted filesystem or active volume group?

mdadm: Cannot get exclusive access to /dev/md2:Perhaps a running process, mounted filesystem or active volume group?

mdadm: Cannot get exclusive access to /dev/md1:Perhaps a running process, mounted filesystem or active volume group?

mdadm: Cannot get exclusive access to /dev/md2:Perhaps a running process, mounted filesystem or active volume group?

mdadm: Cannot get exclusive access to /dev/md1:Perhaps a running process, mounted filesystem or active volume group?

 [ !! ]

 * ERROR: mdraid failed to stop
```

looks like lvm is not really shutdown then raid cannot shutdown either.

Do you have any clue about how to investigate ?

----------

## Veldrin

I assume, that you are running lvm on top of mdadm raid.

and it is prefectly normal, that it cannot shutdown all raid and lvm devices at shutdown, as the / need to be up and run at that point (although only read only), and there also the raid partition, the vg and lv it resides in. 

What confuses me, is that there are 2 md devices complaining. 

can you give some more information about you disk layout. fstab will shed some light on it. 

V.

----------

## castor_fou

You are perfectly right, lvm on top of mdadm raid.

I used to have some complaints about md1 which cannot be unmounted at shutdown.

I have swap on md0. (no lvm)

I have /, /usr/, /home, /var on md1. (lvm)

And /data on md2. (lvm)

But recently the issue became larger.

It looks like LVM is not really shutting down, and then mdadm is complaining. At least it should be able to shutdown md2.

I will post my fstab later.

----------

## castor_fou

here is my fstab

```
# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/md0                                /boot           ext3            defaults,noatime        1 2

/dev/mapper/VG_gentoo_root-root         /               ext3            noatime                 0 1

/dev/mapper/VG_gentoo_root-usr          /usr            ext3            noatime                 0 1

/dev/mapper/VG_gentoo_root-var          /var            ext3            noatime                 0 1

/dev/mapper/VG_gentoo_root-tmp          /tmp            ext3            noatime                 0 1

/dev/mapper/VG_gentoo_data-home         /home           ext3            noatime                 0 1

/dev/mapper/VG_gentoo_data-data         /data           ext3            noatime                 0 1

UUID=a6f2ae5e-1a72-420d-80f3-f302acb262f8       none    swap            sw                      0 0

UUID=5b6d9d1a-8eed-406d-af65-bb0be1da5d61       none    swap            sw                      0 0

/dev/cdrom                              /mnt/cdrom      udf,iso9660     user,noauto,exec,utf8   0 0

UUID=8773c729-ecdc-47fd-ba4e-af7d530e6c0f       /data-backup    ext3    noatime         0 1

nas:/volume1/music                      /nas/music      nfs     defaults,user,exec,nolock    0 1

nas:/volume1/photo                      /nas/photo      nfs     defaults,user,exec,nolock    0 1

nas:/volume1/video                      /nas/video      nfs     defaults,user,exec,nolock    0 1

nas:/volume1/homes/guillaume            /home/gui/Nas   nfs     defaults,user,exec,nolock    0 1

nas:/volume1/BDs                        /home/gui/Nas/BDs       nfs     defaults,user,exec,nolock    0 1

nas:/volume1/homes/guillaume            /home/test/Nas  nfs     defaults,user,exec,nolock    0 0

#UUID=412e2995-0b52-42ac-987d-a37b631ae5f8      /mnt/kubuntu    ext4    noatime         0 1

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

shm                                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

```

VG_gentoo_root is on md1

VG_gentoo_data is on md2

----------

