Last active
March 1, 2020 07:31
-
-
Save faizal2007/2554843cdc41b4f3107e38a35f128804 to your computer and use it in GitHub Desktop.
Sample related script to manage xen with xen-tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Need to run manual paste command | |
### Create snapshot | |
lvcreate -L50G -s -n centos-disk-snapshot /dev/sanbox-vg/centos-disk-fresh | |
### Restore snapshot | |
lvconvert --merge /dev/sanbox-vg/centos-disk-snapshot | |
lvchange -an /dev/sanbox-vg/centos-disk-fresh | |
lvchange -ay /dev/sanbox-vg/centos-disk-fresh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xen-create-image --hostname=dnsserver --size=10Gb --memory=1Gb --swap=2Gb \ | |
--lvm=sanbox-vg --ip=10.10.5.21 --netmask=255.255.255.0 --gateway=10.10.5.1 \ | |
--arch=amd64 --install-method=debootstrap --dist=stretch --passwd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
total_memory=$(xm info | grep total_memory | awk '{print $3}') | |
remaining=$(xm info | grep free_memory | awk '{print $3 - 512}') | |
used_memory=$((total_memory-remaining)) | |
echo -e 'Total Memory:\t'$total_memory'MB ('$((total_memory/1024))'GB)' | |
echo -e 'Memory Used:\t'$used_memory'MB ('$((used_memory/1024))'GB)' | |
echo -e 'Remaining:\t'$remaining'MB ('$((remaining/1024))'GB)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment