Created
January 9, 2021 18:50
-
-
Save oBuTr471b/b72f52d312f1b6a6bed9deab32269c4a to your computer and use it in GitHub Desktop.
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
# In The Name Of Allah . | |
# -- --- ---- -- ----- - | |
# Mon Dec 28 10:23:23 2020 | |
# Written By : zer0err0r . | |
# ======= == = ========= = | |
# 18p2, Creating Storage Pools . | |
# Directory Bsaed Pools . | |
$ virsh pool-define-as dir_pool dir - - - - /home/zer0err0r/kvm_1 | |
$ virsh pool-build dir_pool | |
# Notice : | |
= [pool-build] should create the dir if its not exist, And sets the correct SELinux context for you . | |
= Without using this pool, You need to define SELinux context by yourself, And you need to create the dir too . | |
= But in both cases, If you gonna use [~/some_dir], You need to let [others] to have the [x]_perm on your Home_dir | |
and thats to allow [qemu] user to access . | |
# Partition Based Pools . | |
$ virsh pool-define-as part_pool fs - - /dev/sdb1 - /home/zer0err0r/kvm_2 | |
$ virsh pool-define-as part_pool --type fs --source-dev /dev/sdc1 --target /home/zer0err0r/kvm_2 | |
$ virsh pool-build part_pool | |
# As you see : | |
= The using of dashes[-] depend on the pool type . | |
= Each dash represent a specific configuration . | |
= [/dev/sdb1] is the partition that we will use . | |
# Partition based pool is better : | |
= part_pool has a separated partition to store volumes instead of filling the main filesystem partition space . | |
= You dont have to [mkdir] the mount point, And you dont have to configure [/etc/fstab] . | |
= Even SELinux context will be configured for you . | |
= Unlike the dir_pool which may fill your main filesystem partition space . | |
= And if you used a separated partition for your volumes and you used a dir_pool, You need to configure the | |
[/etc/fstab] file manually . | |
# Pool management : | |
$ virsh pool-start POOL_NAME | |
$ virsh pool-autostart POOL_NAME | |
$ virsh pool-autostart --disable POOL_NAME | |
$ virsh pool-list --all | |
$ virsh pool-info POOL_NAME | |
$ virsh pool-edit POOL_NAME | |
# Pool deletion : | |
$ virsh pool-destroy POOL_NAME | |
$ virsh pool-undefine POOL_NAME | |
# Pool backup and restore : | |
$ virsh pool-dumpxml > POOL_NAME.xml | |
$ virsh pool-define POOL_NAME.xml | |
# Volume creation : | |
$ virsh vol-create-as POOL_NAME vm1.qcow2 10G --format qcow2 | |
= Nothing special here, Just change the POOL_NAME . | |
# ===== == ==== ======== = | |
# Peace Be Up0n Muhammed . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment