From 1f28586bbd80bdc8b66d2a643ef11ca28608e65f Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 2 Apr 2019 18:37:01 +0200 Subject: [PATCH] Manage LVM creation and format --- debian/chroot.install | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/debian/chroot.install b/debian/chroot.install index dc6439d..471d65d 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -33,5 +33,25 @@ if [ "${manage_part}" -eq 0 ]; then sudo vgcreate "${vgname}" ${hdd}2 fi +## }}} +## Create Logical Volumes {{{ +[ ! -b /dev/mapper/"${vgname}"-home ] && lvcreate -n home -L 20g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-opt ] && lvcreate -n opt -L 2g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-root ] && lvcreate -n root -L 5g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-srv ] && lvcreate -n srv -L 2g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-tmp ] && lvcreate -n tmp -L 10g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-usr ] && lvcreate -n usr -L 15g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-var ] && lvcreate -n var -L 10g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-vz ] && lvcreate -n vz -L 150g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-bkp ] && lvcreate -n bkp -L 150g "${vgname}" +[ ! -b /dev/mapper/"${vgname}"-swap ] && lvcreate -n swap -L 2g "${vgname}" + +### Format the LV in ext4 +for lvname in /dev/mapper/"${vgname}"-*; do + mkfs.ext4 "${lvname}" +done + +### And format the swap +mkswap /dev/mapper/"${vgname}"-swap ## }}} # }}}