Advertisement
42n4

XENDELOCALSTORAGELVM

Feb 6th, 2016
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.25 KB | None | 0 0
  1. #USE IT IN COMMAND LINE (without #):
  2. #curl http://pastebin.com/raw/48dj2Q4M > xendeletelocalsr.sh
  3. #tr -d "\015" < xendeletelocalsr.sh > xendeletelocalsrnew.sh
  4. #sh xendeletelocalsrnew.sh
  5. #
  6. #for host with small letters use: http://pastebin.com/raw/kVmvNtZM
  7. #uuid pbd http://blog.gluster.org/2012/
  8. sed -i -e "s/metadata_read_only = 1/metadata_read_only = 0/" /etc/lvm/lvm.conf
  9. hname=`hostname`
  10. hname=`echo $hname | tr [:lower:] [:upper:]`
  11. sruuid=`xe sr-list host=$hname name-label=Local\ storage | cut -f20 -d" " | head -n 1`
  12. pbduid=`xe pbd-list sr-uuid=$sruuid | grep -E '^uuid' | cut -f2 -d":" | sed 's/\ //g'`
  13. xe pbd-unplug uuid=$pbduid
  14. xe sr-forget uuid=$sruuid
  15. #xe sr-destroy uuid=$sruuid
  16. vgremove `vgdisplay -C | tail -n1 | cut -f3 -d' '` -f
  17. dev4gfs=`pvdisplay -C | tail -n1 | cut -f3 -d' '`
  18. pvremove $dev4gfs -f
  19. pvcreate $dev4gfs
  20. vgname=lvm4gfs
  21. vgcreate $vgname $dev4gfs
  22. lvcreate -L 8G -n xen $vgname
  23. mkfs.ext4 -m 0 -j /dev/$vgname/xen
  24. mkdir -p /export/$hname-vol0
  25. #echo "/dev/$vgname/xen /export/$hname-vol0   ext4  rw,noatime,nodiratime,journal_checksum,data=journal,errors=panic,nodelalloc 1 2" >> /etc/fstab
  26. echo "/dev/$vgname/xen /export/$hname-vol0   ext4  rw,noatime,nodiratime,user_xattr,barrier=0,data=ordered 1 2" >> /etc/fstab
  27. mount -a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement