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/')
|
||||
## If the script should create extra volume (eg. backup, virt, Proxmox,…)
|
||||
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 {{{
|
||||
BLACK='\033[49;30m'
|
||||
BLACKB='\033[49;90m'
|
||||
|
@ -35,27 +43,32 @@ RESET='\033[0m'
|
|||
mkdir -p -- /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
|
||||
mountpoint -q /target/home || mount -- /dev/mapper/"${vgname}"-home /target/home
|
||||
#### opt LV
|
||||
mountpoint -q /target/opt || mount -- /dev/mapper/"${vgname}"-opt /target/opt
|
||||
#### srv LV
|
||||
mountpoint -q /target/srv || mount -- /dev/mapper/"${vgname}"-srv /target/srv
|
||||
#### tmp LV
|
||||
mountpoint -q /target/tmp || mount -- /dev/mapper/"${vgname}"-tmp /target/tmp
|
||||
#### usr LV
|
||||
mountpoint -q /target/usr || mount -- /dev/mapper/"${vgname}"-usr /target/usr
|
||||
#### var LV
|
||||
mountpoint -q /target/var || mount -- /dev/mapper/"${vgname}"-var /target/var
|
||||
#### home LV
|
||||
mountpoint -q /target/home || mount -- /dev/mapper/"${vgname}"-home /target/home
|
||||
#### opt LV
|
||||
mountpoint -q /target/opt || mount -- /dev/mapper/"${vgname}"-opt /target/opt
|
||||
#### srv LV
|
||||
mountpoint -q /target/srv || mount -- /dev/mapper/"${vgname}"-srv /target/srv
|
||||
#### tmp LV
|
||||
mountpoint -q /target/tmp || mount -- /dev/mapper/"${vgname}"-tmp /target/tmp
|
||||
#### usr LV
|
||||
mountpoint -q /target/usr || mount -- /dev/mapper/"${vgname}"-usr /target/usr
|
||||
#### var LV
|
||||
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
|
||||
mountpoint -q /target/srv/backup || mount -- /dev/mapper/"${vgname}"-bkp /target/srv/backup
|
||||
### Extra vz LV
|
||||
mountpoint -q /target/var/lib/vz || mount -- /dev/mapper/"${vgname}"-vz /target/var/lib/vz
|
||||
fi
|
||||
fi
|
||||
|
||||
### Swap
|
||||
|
|
Loading…
Reference in New Issue