/var/lib/libvirt/images
.
NewVolumeName
on the volume group named volumegroup
.
# lvcreate -nNewVolumeName
-L5G
volumegroup
NewVolumeName
logical volume with a file system that supports extended attributes, such as ext3.
# mke2fs -j /dev/volumegroup/NewVolumeName
/etc
, /var
, /sys
) or in home directories (/home
or /root
). This example uses a directory called /virtstorage
# mkdir /virtstorage
# mount/dev/volumegroup/NewVolumeName
/virtstorage
# semanage fcontext -a -t virt_image_t "/virtstorage(/.*)?"
/etc/selinux/targeted/contexts/files/file_contexts.local
file which makes the change persistent. The appended line may resemble this:
/virtstorage(/.*)? system_u:object_r:virt_image_t:s0
/virtstorage
) and all files under it to virt_image_t
(the restorecon
and setfiles
commands read the files in /etc/selinux/targeted/contexts/files/
).
# restorecon -R -v /virtstorage
touch
command) on the file system.
# touch /virtstorage/newfile
# sudo ls -Z/virtstorage
-rw-------. root root system_u:object_r:virt_image_t:s0newfile
virt_image_t
.