change restore mechanism on btrfs filesystem. 84/262784/2 accepted/tizen/unified/20210829.234856 submit/tizen/20210826.114923 submit/tizen/20210827.084901
authorErnest Borowski <e.borowski@samsung.com>
Thu, 19 Aug 2021 22:03:29 +0000 (22:03 +0000)
committerErnest Borowski <e.borowski@samsung.com>
Thu, 19 Aug 2021 22:20:56 +0000 (22:20 +0000)
Use subvolumes instead of cp to restore files, this will speedup
restore and reduce local memory requirements.

After update system will have ROOTFS subvolume located at root volume.
/ -- root volume
/ROOTFS -- subvolume with actual data.

ROOTFS subvolume is set as default one, so it will be transparent to
system after update because mount will mount it at /.

Change-Id: I36d40cf771b8d3cce662aa58fc669fc4c1f1df18
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
upgrade/update-checkpoint-create.sh
upgrade/update.sh.in

index cb614ec4ef66aa8d6c7a2c092415c992b5ee60e8..452e463c78099965fa67aa1a55568dec70458eeb 100755 (executable)
@@ -50,9 +50,11 @@ mount_btrfs_partition() {
         LABEL=${1}
         PARTITION=${2}
         DIRECTORY=${3}
-        "${MOUNT}" -o rw ${PARTITION} ${DIRECTORY}
+        "${MOUNT}" -o subvolid=5,rw "${PARTITION}" "${DIRECTORY}"
         mkdir -p "${DIRECTORY}/fota"
-        "$BTRFS" subvolume snapshot "$DIRECTORY" "$DIRECTORY/fota/RO_update"
+        "$BTRFS" subvolume snapshot "$DIRECTORY/ROOTFS" "$DIRECTORY/fota/RO_update"
+        "$UMOUNT" "${DIRECTORY}"
+        "$MOUNT" -o rw "${PARTITION}" "${DIRECTORY}"
         echo "[Debug] Mounted ${PARTITION} as btrfs"
 }
 
index e2988f9a7f90b72e764813e3960ecaa4a7ac4568..4fc63a64f381b8c979d41d548d81398f984f671e 100755 (executable)
@@ -95,9 +95,12 @@ DELETE_BTRFS_PARTITION() {
                return
        fi
        NOTIFY "Deleting btrfs snapshot"
-       mount -o remount,rw "${MNT_POINT}"
+       umount "${MNT_POINT}"
+       mount -o subvolid=5,rw "${PART}" "${MNT_POINT}"
        btrfs subvolume delete "$MNT_POINT"/fota/RO_update
        rm -rf "$MNT_POINT/fota/RO_update"
+       umount "${MOUNT_POINT}"
+       mount -o rw "${PART}" "${MNT_POINT}"
 }