Add possibility to disable extra lv (backup, vz,…)

This commit is contained in:
Jeremy Gardais 2019-08-05 15:12:14 +02:00
parent 3468bce210
commit 33d25dba12
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 16 additions and 10 deletions

26
debian/chroot.install vendored
View File

@ -17,6 +17,8 @@ vgname="ovhsys"
manage_part=0 manage_part=0
## If the script should use BTRFS ## If the script should use BTRFS
manage_btrfs=1 manage_btrfs=1
## If the script should create extra volume (eg. backup, virt, Proxmox,…)
manage_extra_lv=0
## Colors definition {{{ ## Colors definition {{{
BLACK='\033[49;30m' BLACK='\033[49;30m'
BLACKB='\033[49;90m' BLACKB='\033[49;90m'
@ -79,8 +81,10 @@ else
[ ! -b /dev/mapper/"${vgname}"-var ] && lvcreate -n var -L 10g "${vgname}" [ ! -b /dev/mapper/"${vgname}"-var ] && lvcreate -n var -L 10g "${vgname}"
fi fi
### Create extra LVs ### Create extra LVs
[ ! -b /dev/mapper/"${vgname}"-vz ] && lvcreate -n vz -L 150g "${vgname}" if [ "${manage_extra_lv}" -eq 0 ]; then
[ ! -b /dev/mapper/"${vgname}"-bkp ] && lvcreate -n bkp -L 150g "${vgname}" [ ! -b /dev/mapper/"${vgname}"-vz ] && lvcreate -n vz -L 150g "${vgname}"
[ ! -b /dev/mapper/"${vgname}"-bkp ] && lvcreate -n bkp -L 150g "${vgname}"
fi
[ ! -b /dev/mapper/"${vgname}"-swap ] && lvcreate -n swap -L 2g "${vgname}" [ ! -b /dev/mapper/"${vgname}"-swap ] && lvcreate -n swap -L 2g "${vgname}"
### Format LVs in ext4 ### Format LVs in ext4
@ -147,14 +151,16 @@ else ### Or for ext4, create mountpoint and mount LV
printf '%b\n' "/dev/mapper/${vgname}-var /var ext4 defaults 0 0" >> /tmp/target.fstab printf '%b\n' "/dev/mapper/${vgname}-var /var ext4 defaults 0 0" >> /tmp/target.fstab
fi fi
### Extra bkp LV if [ "${manage_extra_lv}" -eq 0 ]; then
mkdir -p -- /target/srv/backup ### Extra bkp LV
mountpoint -q /target/srv/backup || mount -- /dev/mapper/"${vgname}"-bkp /target/srv/backup mkdir -p -- /target/srv/backup
printf '%b\n' "/dev/mapper/${vgname}-bkp /srv/backup ext4 defaults 0 0" >> /tmp/target.fstab mountpoint -q /target/srv/backup || mount -- /dev/mapper/"${vgname}"-bkp /target/srv/backup
### Extra vz LV printf '%b\n' "/dev/mapper/${vgname}-bkp /srv/backup ext4 defaults 0 0" >> /tmp/target.fstab
mkdir -p -- /target/var/lib/vz ### Extra vz LV
mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz mkdir -p -- /target/var/lib/vz
printf '%b\n' "/dev/mapper/${vgname}-vz /var/lib/vz ext4 defaults 0 0" >> /tmp/target.fstab mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz
printf '%b\n' "/dev/mapper/${vgname}-vz /var/lib/vz ext4 defaults 0 0" >> /tmp/target.fstab
fi
### Swap ### Swap
swapon -- /dev/mapper/"${vgname}"-swap swapon -- /dev/mapper/"${vgname}"-swap