Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Shutdown with root on RAID
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
at
Apprentice
Apprentice


Joined: 20 Aug 2006
Posts: 185

PostPosted: Sat Apr 30, 2011 1:57 pm    Post subject: Shutdown with root on RAID Reply with quote

I am trying to understand how shutdown sequence should happen if I have root filesystem on LVM on RAID.

It seems that to shut them down, lvm and mdadm would need to be executed, but before that root would need to have been unmounted...

I cannot imagine /sbin/halt doing that - how would it know about all the idiosyncrasies of a particular system?

Or does it simply never get to be properly shutdown in the hope that all the disks have been synced and re-mounted read-only?
Back to top
View user's profile Send private message
m0p
Apprentice
Apprentice


Joined: 20 Jun 2005
Posts: 205
Location: en_GB

PostPosted: Sat Apr 30, 2011 5:00 pm    Post subject: Reply with quote

I remember reading that deactivating LVM volumes doesn't actually change anything on the disk, and I assume the same is true with mdadm. I assume that as long as your partitions are sync'd and mounted ro/unmounted, it doesn't matter. Don't take my word for it, I've never worked with either tool, I just remember reading that somewhere about LVM at least.
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2204

PostPosted: Sun May 01, 2011 6:38 am    Post subject: Reply with quote

My desktop machine has its rootfs on software RAID5. It's not auto-assembled (I pass kernel parameters at boot defining the array) but it would work pretty much the same if it were. I don't use LVM. I am using OpenRC/baselayout-2. I added mdraid to the boot runlevel. I suspect it's irrelevant, as the kernel's already assembled the array, but I've not tried running without it.

At shutdown, when mdraid runs unsurprisingly it complains that root is still in use. However, the shutdown then continues happily. My guess is that the array gets closed properly as a result of the sync and remount as R/O that AFAIR come at the end of the shutdown process.

I've not noticed any problems such as resynchronizing or recovery when starting up the system in the year since I set it up. I boot the system about once a day. Conversely, I have noticed that if I pull the plug without entering shutdown (I don't remember which updates left my system with a dead console, but it's happened a few times in the last year :-( ), the next restart works OK but the system is very sluggish for 30 or 40 minutes while it resynchronizes the array.

I've vaguely considered tinkering with the rc- dependencies for mdraid to try to make it run nearer the end of the shutdown process, but I suspect that is pointless. While it might be possible to explicitly close the array cleanly, if there was a problem, I would want to write an error message somewhere, and for that to work, rootfs would have to be mounted, and then mdraid wouldn't run...

[EDIT] Got the service name wrong: it's mdraid, not mdadm
_________________
Greybeard
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Sun May 01, 2011 9:20 am    Post subject: Re: Shutdown with root on RAID Reply with quote

If I remember correctly the only place where you might need to actually shut down LVM is an obscure clustered setup. On a local single independent box, it's okay to remount read only, sync and cut power.
Back to top
View user's profile Send private message
at
Apprentice
Apprentice


Joined: 20 Aug 2006
Posts: 185

PostPosted: Sun May 01, 2011 4:53 pm    Post subject: Reply with quote

Perhaps, I agree about unimportance of shutting down LVM. However, in my opinion, stopping RAID is a completely different story.

During shutdown, I get the following errors:
Code:
 [ !! ]
 * Closing Luks A ...
Device base is busy.
 [ !! ]
 * Stoping RAIDs ...
mdadm: failed to stop array /dev/md231: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?

then a little later:
Code:
[ ok ]
 *   Unmounting /usr ...
 *   in use but fuser finds nothing
 [ !! ]
 * Shutting down the Logical Volume Manager
 *   Shutting Down logical volumes  ...
  LV lvm-a/root in use: not deactivating
  LV lvm-a/usr in use: not deactivating
 [ !! ]
 *   Shutting Down volume groups  ...
  Can't deactivate volume group "lvm-a" with 2 open logical volume(s)
 [ !! ]


And finally, when I restart, I always get a corrupted root file system.

I suppose I should mention that there is no entry in the log saying that root has been remounted read-only. At any rate, I don't think it would have succeeded since it even fails to unmount (or remount ro) /usr partition.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Sun May 01, 2011 5:09 pm    Post subject: Reply with quote

Well, there is no reason why it should fail for /usr, so that's the first problem you have to fix.

The LVM script should say that it can't deactivate root and the group with 1 open volume(s) but that is a non-critical error. It's the same for me (encrypted root on lvm, no raid).

I must admit that I never used RAID on Gentoo, since I use it on Desktop only, whereas RAID is server / nas only for me. So I'm not familiar with Gentoo's mdadm scripts.
Back to top
View user's profile Send private message
at
Apprentice
Apprentice


Joined: 20 Aug 2006
Posts: 185

PostPosted: Sun May 01, 2011 6:56 pm    Post subject: Reply with quote

Yes, thank you for your reply.

I agree, the first problem I should look into is not being able to remount /usr read-only.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum