added beginning of btrfs module
parent
fa65a9f4a4
commit
9eaef445af
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
make_subvol() {
|
||||
local usesudo
|
||||
local uid
|
||||
local gid
|
||||
[[ $EUID -ne 0 ]] && usesudo=sudo
|
||||
uid=${2:-$USER}
|
||||
gid=${3:-$uid}
|
||||
echo $usesudo btrfs subvolume create $1
|
||||
$usesudo btrfs subvolume create $1
|
||||
echo $usesudo chown $uid:$gid $1
|
||||
$usesudo chown $uid:$gid $1
|
||||
}
|
||||
|
||||
make_base_subvols() {
|
||||
svols="shell admin opt data docker images temp"
|
||||
BTRFSDATAROOT=${BTRFSDATAROOT:-/mnt/data}
|
||||
# cd $BTRFSDATAROOT || exit
|
||||
for svol in $svols; do
|
||||
make_subvol $BTRFSDATAROOT/$svol $@
|
||||
done
|
||||
}
|
||||
|
||||
#ssudo mount -o subvol=opt /dev/sda4 /test
|
||||
|
||||
alias btvl="sudo btrfs subvolume list"
|
||||
|
||||
# ALL ALL = (root) NOPASSWD:/bin/btrfs
|
||||
|
||||
# btrfs send rootfs-nadal-$(date +"%d-%m-%Y") | btrfs receive /backup/images/snaps/rootfs
|
||||
# btrfs subvolume snapshot -r / /backup/rootfs-nadal-$(date +"%d-%m-%Y")
|
||||
# tar -cvpzf /backup/images/nadal-fs.tar.gz --one-file-system /
|
Loading…
Reference in New Issue