Editing
Advanced DRBD mount issues
(section)
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Solution 3: script based unmounting (bit of brute-force....) == Using the script architecture mentioned above, we now force an unmount of certain DRBD devices when fireing up the server. I got a draft version of the attached script from a guy from the mailing list. It worked but I didn't like the approach and worked out the other ones - it might be helpful if you use one drbd device inside multiple vservers and so you cant use the above mentioned ideas. The script first tries to detect the mount-points occupied by the current vServer, than runs through all mounts and unmounts all that are not related to the current vServer. Please see the script as an idea - it might not work out of the box for you because you have to adjust the detection of the occupied mounts. The code must go into the prepre-start file as mentioned above. <pre> #!/bin/bash # published version done by Oliver Welter, mail-at-oliwel.de # based on a script from martin rueegg, metaworx.ch, mrueegg-at-metaworx.ch # provide without waranty as is and free to modify and copy with this notice kept intact DF=/bin/df CUT=/bin/cut TAIL=/usr/bin/tail GREP=/bin/grep CAT=/bin/cat # I dont mirror the vServer's itself, just the data, so all vServers share one volume - I think most people must adjust this vs_dir=/vservers vs_etc=/etc/vservers vs_data=/data/www1 # get the device, the vserver is located on vs_device=`$DF -kh $vs_dir | $CUT -f1 -d' ' | $TAIL -n 1` # get the device, the vserver config dir is located on vs_etc_mount=`$DF -kh $vs_etc | $TAIL -n 1 | $GREP -Eo '[^[:space:]]+$'` vs_data_device=`$DF -kh $vs_data | $CUT -f1 -d' ' | $TAIL -n 1` for i in `$CAT /proc/mounts \ | $CUT -f1,2 -d' ' --output-delimiter='|' \ | $GREP -E '^/dev/drbd/[^|]+\|'`; do # extract the device device=`echo $i | $CUT -f1 -d'|'` # extract the mountpoint mountpoint=`echo $i | $CUT -f2 -d'|'` # unmount the file system unless it's the # - device the vserver's on # - device the vserver config dir is on if ! [ ."$vs_device" == ."$device" -o ."$vs_etc_mount" == ."$mountpoint" -o ."$vs_data_device" == ."$device" ] ; then echo "umount -nv $mountpoint" echo `umount -nv $mountpoint || exit $?` fi done </pre>
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information