Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion doc/molior-deploy.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ FILESYSTEM PARAMETERS
Up to 16 partitions / logical volumes are currently supported, and 1 physical volume or a full disk for LVM.

SFDISK Input for sfdisk partitioning
PART#_FS Filesystem of partition # (ext4, ... or 'lvm' for LVM physical volume)
PART#_FS Filesystem of partition # (ext4, btrfs, ... or 'lvm' for LVM physical volume)
PART#_MNT Mountpoint of partition #
PART#_OPTS fstab options (i.e. "defaults,noatime")
PART#_MKFSOPTS Options for mkfs (i.e. "-O ^64bit,^metadata_csum")
Expand All @@ -92,6 +92,9 @@ FILESYSTEM PARAMETERS
BIND_MOUNTS Space (' ') separated list of target:source[:mountopts] bind mount pairs which will be mounted before installation and added to the fstab
EXTRA_BIND_MOUNTS Space (' ') separated list of target:source[:mountopts] bind mount pairs which will be added to the fstab

BTRFS_SUBVOL#_PATH btrfs subvolume to be created on specified path (for example /opt)
BTRFS_SUBVOL#_LIMIT btrfs subvolume quota limit (postfixed by M,G,...)


RAID PARAMETERS
Software RAID via the 'mdadm' may be created by defining the following parameters.
Expand Down Expand Up @@ -188,6 +191,49 @@ EXAMPLE
LVM_LV3_SIZE=16G
LVM_LV3_FS="ext4"

Example deployment configuration (VirtualBox with EFI boot, GUID partition table, btrfs and guest utils):

$ cat deploy/vbox-btrfs.conf
# vim: syntax=sh

DEPLOYMENT_TYPE=vbox
ARCH=amd64
TARGET_HOSTNAME=$PROJECT-demo
LINUX_CMDLINE="biosdevname=0 net.ifnames=0 init=/lib/systemd/systemd nomodeset systemd.show_status=0 loglevel=0"
INSTALL_PACKAGE=vbox-demo

MINIMIZE=1 # do not install docs and manpages

VMSIZE=24576 # 24MB
VMRAM=2048
VMVRAM=128

APT_SOURCES_EXTRA="deb http://debrepo/mirrors/stretch-backports stretch-backports main contrib non-free"
APT_INSTALL_EXTRA="virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11"

TARGET_BOOTTYPE=efi

SFDISK="unit: sectors
label: gpt
efi: type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, size=512M,
swap: type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, size=512M,
btrfs: type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"

PART1_FS=vfat
PART1_MNT=/boot/efi

PART2_FS=swap

PART3_FS=btrfs
PART3_MNT=/
PART3_OPTS=defaults,noatime

BTRFS_SUBVOL1_PATH=/
BTRFS_SUBVOL1_LIMIT=4G

BTRFS_SUBVOL2_PATH=/opt
BTRFS_SUBVOL2_LIMIT=5G

AUTHORS
Please see the AUTHORS file in the source repositories.

Expand Down
44 changes: 43 additions & 1 deletion molior-deploy.sh.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ fs_has_partitions=0
fs_has_lvm=0
fs_has_luks=0
fs_on_raid=0
fs_has_btrfs=0

exit_on_error()
{
Expand Down Expand Up @@ -339,6 +340,11 @@ make_fs()
elif [ "$s" = "luks" ]; then
create_luks $part $name

elif [ "$s" = "btrfs" ]; then
log "mkfs $part"
eval mkfs -t btrfs -f $opts $part >/dev/null
exit_on_error "Error formatting partition $part as $s"

else # normal filesystems
log "mkfs $part"
eval mkfs -t $s $opts $part >/dev/null
Expand Down Expand Up @@ -426,7 +432,11 @@ get_fsinfo()
set -x
fs_has_luks=1
set +x
break
fi
if [ "$s" = "btrfs" ]; then
set -x
fs_has_btrfs=1
set +x
fi
done
set -x
Expand Down Expand Up @@ -492,6 +502,33 @@ mount_fs()
set -x
fi

set +x
for p in `seq 1 $MAXPART`
do
eval subvol_path=\$BTRFS_SUBVOL${p}_PATH
if [ -z "$subvol_path" ]; then
continue
fi
subvol=$target$subvol_path
if [ ! -e $subvol ]; then
dir=${subvol%${subvol##*/}}
if [ ! -e $dir ]; then
mkdir -p $dir
fi
set -x
btrfs subvolume create $subvol
set +x
fi
eval subvol_limit=\$BTRFS_SUBVOL${p}_LIMIT
if [ -n "$subvol_limit" ]; then
set -x
btrfs quota enable $subvol
btrfs qgroup limit $subvol_limit $subvol
set +x
fi
done
set -x

if [ -n "$LVM_VG" ]; then
set +x
for p in `seq 1 $MAXPART`
Expand Down Expand Up @@ -731,6 +768,11 @@ get_deploy_config()
test -n "$s" && echovar LVM_LV${p}_SIZE "$s"
eval s=\$LVM_LV${p}_MKFSOPTS
test -n "$s" && echovar LVM_LV${p}_MKFSOPTS "$s"

eval s=\$BTRFS_SUBVOL${p}_PATH
test -n "$s" && echovar BTRFS_SUBVOL${p}_PATH "$s"
eval s=\$BTRFS_SUBVOL${p}_LIMIT
test -n "$s" && echovar BTRFS_SUBVOL${p}_LIMIT "$s"
done
echovar BIND_MOUNTS
echovar EXTRA_BIND_MOUNTS
Expand Down
8 changes: 8 additions & 0 deletions plugins/installer.plugin
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ prepare_initrd_deployment()
if [ "$fs_on_raid" -eq 1 ]; then
INSTALLER_EXTRA_PACKAGES="$INSTALLER_EXTRA_PACKAGES mdadm"
fi
if [ "$fs_has_btrfs" -eq 1 ]; then
INSTALLER_EXTRA_PACKAGES="$INSTALLER_EXTRA_PACKAGES btrfs-progs"
fi

if [ ! -d $WORK_DIR/instroot ]; then
# in case of using a base roots, there is no instroot debootstrap left,
Expand All @@ -137,6 +140,11 @@ prepare_initrd_deployment()
chroot $WORK_DIR/instroot apt-get update >&2
fi

if [ "$fs_has_btrfs" -eq 1 ]; then
echo "copy_exec /sbin/mkfs.btrfs /sbin" >> $initrd/hooks/installer
echo btrfs >> $initrd/modules
fi

DEBIAN_FRONTEND=noninteractive chroot $WORK_DIR/instroot apt-get install --no-install-recommends --yes \
$INSTALLER_EXTRA_PACKAGES $LINUX_IMAGE_NAME \
busybox initramfs-tools isolinux syslinux-common \
Expand Down