aboutsummaryrefslogtreecommitdiff
path: root/utils/uvol/files/lvm.sh
Commit message (Collapse)AuthorAge
* uvol: replace with re-write in ucodeDaniel Golle2022-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | Replace previous Shell draft-quality implementation of uvol with a rewrite in ucode[1]. While the new code is slightly larger, it performs much better (as we no longer fork() for parsing strings like in Shell with grep, sed and friends). Before: time uvol list -j [ ... ] real 0m 0.82s user 0m 0.13s sys 0m 0.10s After: time uvol list -j [ ... ] real 0m 0.47s user 0m 0.05s sys 0m 0.05s [1]: https://github.com/jow-/ucode Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* uvol: fix list output on LVM backendDaniel Golle2022-03-22
| | | | | | | | 'uvol list' was broken when introducing support for the hidden volumes. Fix that by not using 'continue' keyword to break the loop (as that lead to skipping 'json_select ..') and using if-clause instead. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* uvol: call umount instead of using 'block umount'Daniel Golle2022-02-13
| | | | | | | | | Calling 'block umount' results in *all* devices listed in /etc/config/fstab being unmounted. Just call 'umount /dev/$devname' directly instead as that has the desired effect. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* uvol: update to 0.6Daniel Golle2021-12-20
| | | | | | | | | | | | | | | | | | * auto-created meta volume Automatically create volume '.meta' sized 0.01% of the total space managed by uvol, the minimum size being 4 MiB. This volume should be used to keep metadata about stored volumes, such as container runtime configuration (in /var/run/uvol/.meta/uxc) or the database of installed container packages. * configurable LVM volume group Allow setting volume group to be used by uvol using UCI. This is useful on devices which do not boot off the device which should be used for uvol and hence cannot make use of autopart and physical volume detection based on kernel cmdline. Use option vg_name in uvol section of fstab UCI config package. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* uvol: update to version 0.5Daniel Golle2021-09-15
| | | | | | Adds '-j' option for 'list' command to generate JSON output. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* uvol: update to version 0.4Daniel Golle2021-08-15
| | | | | | | | | | 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>
* uvol: lvm: make 'up' call reliableDaniel Golle2021-07-30
| | | | | | | | 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>
* uvol: update to version 0.3Daniel Golle2021-07-25
| | | | | | | | | | | * 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>
* uvol: adapt to changes in coreDaniel Golle2021-07-24
| | | | | | | | | * 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>
* uvol: general clean upDaniel Golle2021-07-16
| | | | | | | | | * 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>
* uvol: fix units with lvm backendDaniel Golle2021-07-06
| | | | | | | | 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>
* uvol: try to be more shellcheck compliant, fix LVM vol-upDaniel Golle2021-06-13
| | | | | | | | | * 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>
* uvol: improve autopart and lvm scripts, fix F2FS volumesDaniel Golle2021-04-21
| | | | | | | | | | | | 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>
* uvol: emmit ubus events and bring up volumes on bootDaniel Golle2021-04-18
| | | | | | | | | 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>
* uvol: make volume creation atomicDaniel Golle2021-04-15
| | | | | | | | | | 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: some improvementsDaniel Golle2021-04-11
| | | | | | | | * use lvm --reportformat json * add 'list' and 'align' commands * add help output Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* uvol: add new packageDaniel Golle2021-04-10
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>