As /var/state is used for UCI state, move persistent config for uxc
from /var/state/uxc to /var/run/uxc.
uxc itself has already been changed to look for it there.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Create UCI fstab mount sections for existing volumes on firstboot.
Introduce special handling for volumes with non-[:alnum:] prefix:
- do not create UCI sections for these 'hidden' volumes
- create UCI section for '.uxc' special volume with target
/var/state/uxc to be used for uxc config.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Changing a volume right after activation doesn't work well due to some
caching or race-condition issue.
Perform activation as last lvchange operation as a work-around.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* genrate UCI fstab configs for each volume before first 'up'
* remove UCI section on volume remove
* use autofs automounter for read-only volumes
* try umount on 'down'
* emulate hotplug events for UBI volume up/down
* more robust error paths
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* lvm: remove left-over ubus events
* lvm: resolve /dev/dm-* device name
As block-mount and blockd now use /dev/dm-* names, let uvol also return
those device names.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* make sure new volumes are in state 'down' until explicitely
requested to transition to 'up' state. Useful for additional
verification steps after writing a read-only volume.
* remove unused ubus events as blockd does that much better now
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Using GPT/UUID parition table is not always a possible choice.
Add support for MBR/DOS partitioned disks to make autopart work on
legacy targets like mt7623.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Free and total bytes are now properly returned as bytes by LVM2 as
requested. No longer multiply values.
Fix parameter order of 'create' command in usage output while at it.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* quotes around all variables
* always use 'read -r' instead of 'read'
* some more minor shellcheck fixes
* reorder LVM ops for 'up' call to allow it to succeed
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Use sfdisk to get GPT partition by name as partition names are not
known by the kernel if added via partx.
Make sure physical volume names are unique, if possible correlate
with the disks serial number and/or card's cid.
mkf2fs apparently returns 134 even in case format succeeded, so don't
fail in that case (this fixes rw volumes large enough for F2FS to be
selected by the lvm scripts of uvol).
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Emmit ubus events when volumes come up/down.
Make sure volume state is always well defined by introducing
additional state 'write-prepare' (wp) during mkfs.
Add init scripts to bring up volumes at boot.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Make sure filesystem is ready when volume becomes available.
Use 'write-once' as initial state for read-only volumes, only allow
writing to volumes in that state and transision to 'read-only' once
write has completed.
Also fix a typo which prevented 'list' command from working with LVM.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
uvol is a wrapper-script which allows automated handling of storage
volumes. uvol currently comes with backend support for LVM2 and UBI,
covering practically all options for storage large enough to be
managed (NAND, SPI-NAND, eMMC, SATA, NVME, virtio-blk, ...).
Signed-off-by: Daniel Golle <daniel@makrotopia.org>