#!/usr/bin/env bash # region imports source "/usr/lib/rebash/core.sh" core.import exceptions exceptions.activate # endregion combined_device_name="$1" read_only_device="$2" writable_device="$3" persistent="$4" # P or N chunksize='1' partition_size="$(blockdev --getsz "$read_only_device")" writable_partition_name='root' modprobe dm_snapshot dmsetup create "$combined_device_name" --noudevsync --table \ "0 $partition_size snapshot $read_only_device $writable_device $persistent $chunksize" dmsetup mknodes --noudevsync "$combined_device_name" # region vim modline # vim: set tabstop=4 shiftwidth=4 expandtab: # vim: foldmethod=marker foldmarker=region,endregion: # endregion