create-vmachine: No separate partition for /usr
parent
0f5a69d908
commit
e595052d4a
|
@ -34,20 +34,19 @@ virsh -c qemu:///system vol-create-as ${POOL} ${VMNAME} 2G
|
|||
echo "Creating LVM volumes..."
|
||||
pvcreate /dev/${VG}/${VMNAME}
|
||||
vgcreate ${VMNAME} /dev/${VG}/${VMNAME}
|
||||
lvcreate -nroot -L100M ${VMNAME}
|
||||
lvcreate -nhome -L200M ${VMNAME}
|
||||
lvcreate -nvar -L400M ${VMNAME}
|
||||
lvcreate -nusr -l100%FREE ${VMNAME}
|
||||
lvcreate -nroot -l100%FREE ${VMNAME}
|
||||
|
||||
echo "Creating XFS filesystems..."
|
||||
for fs in root home usr var; do
|
||||
for fs in root home var; do
|
||||
mkfs.xfs -L$fs -q /dev/${VMNAME}/$fs
|
||||
done
|
||||
|
||||
echo "Mounting filesystems..."
|
||||
[[ ! -d "${MOUNTPOINT}" ]] && mkdir -p "${MOUNTPOINT}"
|
||||
mount /dev/${VMNAME}/root "${MOUNTPOINT}"
|
||||
for fs in home usr var; do
|
||||
for fs in home var; do
|
||||
mkdir "${MOUNTPOINT}"/$fs
|
||||
mount /dev/${VMNAME}/$fs "${MOUNTPOINT}"/$fs
|
||||
done
|
||||
|
@ -100,7 +99,6 @@ ln -s /etc/init.d/sshd "${MOUNTPOINT}"/etc/runlevels/default/
|
|||
echo "Configuring fstab..."
|
||||
cat << EOF > "${MOUNTPOINT}"/etc/fstab
|
||||
LABEL=root / xfs noatime 0 1
|
||||
LABEL=usr /usr xfs noatime 0 2
|
||||
LABEL=var /var xfs noatime 0 2
|
||||
LABEL=home /home xfs noatime 0 2
|
||||
tmpfs /tmp tmpfs defaults 0 0
|
||||
|
@ -122,7 +120,7 @@ sed -i 's/#s0/s0/' "${MOUNTPOINT}"/etc/inittab
|
|||
echo "Cleaning up..."
|
||||
umount "${MOUNTPOINT}"/usr/portage/{packages,distfiles,}
|
||||
rmdir "${MOUNTPOINT}"/usr/portage
|
||||
umount "${MOUNTPOINT}"/{tmp,proc,sys,run,usr,var,home,}
|
||||
umount "${MOUNTPOINT}"/{tmp,proc,sys,run,var,home,}
|
||||
vgchange -an ${VMNAME}
|
||||
|
||||
echo "Creating libvirt domain..."
|
||||
|
|
Loading…
Reference in New Issue