Detect BTRFS filesystem
This commit is contained in:
parent
97c530fc70
commit
ebdd32854c
|
@ -15,6 +15,14 @@ new_hostname=""
|
||||||
vgname=$(vgdisplay --short | tail -n 1 | sed 's/.*"\(.*\)" .*/\1/')
|
vgname=$(vgdisplay --short | tail -n 1 | sed 's/.*"\(.*\)" .*/\1/')
|
||||||
## If the script should create extra volume (eg. backup, virt, Proxmox,…)
|
## If the script should create extra volume (eg. backup, virt, Proxmox,…)
|
||||||
manage_extra_lv=0
|
manage_extra_lv=0
|
||||||
|
## Is BTRFS {{{
|
||||||
|
root_fs_type=$(lsblk -f /dev/mapper/"${vgname}"-root | awk '/root/ { print $2 }')
|
||||||
|
if [ "${root_fs_type}" = "btrfs" ]; then
|
||||||
|
manage_btrfs=0
|
||||||
|
else
|
||||||
|
manage_btrfs=1
|
||||||
|
fi
|
||||||
|
## }}}
|
||||||
## Colors definition {{{
|
## Colors definition {{{
|
||||||
BLACK='\033[49;30m'
|
BLACK='\033[49;30m'
|
||||||
BLACKB='\033[49;90m'
|
BLACKB='\033[49;90m'
|
||||||
|
@ -35,27 +43,32 @@ RESET='\033[0m'
|
||||||
mkdir -p -- /target
|
mkdir -p -- /target
|
||||||
mountpoint -q /target || mount -- /dev/mapper/"${vgname}"-root /target
|
mountpoint -q /target || mount -- /dev/mapper/"${vgname}"-root /target
|
||||||
|
|
||||||
### boot - grub
|
##
|
||||||
mountpoint -q /target/boot || mount -- ${hdd}1 /target/boot
|
if [ "${manage_btrfs}" -eq 0 ]; then
|
||||||
|
printf '%b\n' "The root system is in ${GREEN}BTRFS${RESET}, no extra mount is required."
|
||||||
|
else
|
||||||
|
### boot - grub
|
||||||
|
mountpoint -q /target/boot || mount -- ${hdd}1 /target/boot
|
||||||
|
|
||||||
#### home LV
|
#### home LV
|
||||||
mountpoint -q /target/home || mount -- /dev/mapper/"${vgname}"-home /target/home
|
mountpoint -q /target/home || mount -- /dev/mapper/"${vgname}"-home /target/home
|
||||||
#### opt LV
|
#### opt LV
|
||||||
mountpoint -q /target/opt || mount -- /dev/mapper/"${vgname}"-opt /target/opt
|
mountpoint -q /target/opt || mount -- /dev/mapper/"${vgname}"-opt /target/opt
|
||||||
#### srv LV
|
#### srv LV
|
||||||
mountpoint -q /target/srv || mount -- /dev/mapper/"${vgname}"-srv /target/srv
|
mountpoint -q /target/srv || mount -- /dev/mapper/"${vgname}"-srv /target/srv
|
||||||
#### tmp LV
|
#### tmp LV
|
||||||
mountpoint -q /target/tmp || mount -- /dev/mapper/"${vgname}"-tmp /target/tmp
|
mountpoint -q /target/tmp || mount -- /dev/mapper/"${vgname}"-tmp /target/tmp
|
||||||
#### usr LV
|
#### usr LV
|
||||||
mountpoint -q /target/usr || mount -- /dev/mapper/"${vgname}"-usr /target/usr
|
mountpoint -q /target/usr || mount -- /dev/mapper/"${vgname}"-usr /target/usr
|
||||||
#### var LV
|
#### var LV
|
||||||
mountpoint -q /target/var || mount -- /dev/mapper/"${vgname}"-var /target/var
|
mountpoint -q /target/var || mount -- /dev/mapper/"${vgname}"-var /target/var
|
||||||
|
|
||||||
if [ "${manage_extra_lv}" -eq 0 ]; then
|
if [ "${manage_extra_lv}" -eq 0 ]; then
|
||||||
### Extra bkp LV
|
### Extra bkp LV
|
||||||
mountpoint -q /target/srv/backup || mount -- /dev/mapper/"${vgname}"-bkp /target/srv/backup
|
mountpoint -q /target/srv/backup || mount -- /dev/mapper/"${vgname}"-bkp /target/srv/backup
|
||||||
### Extra vz LV
|
### Extra vz LV
|
||||||
mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz
|
mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Swap
|
### Swap
|
||||||
|
|
Loading…
Reference in New Issue