UnionFS: How to persist changes in the overlay/upperdir into the base/lowerdir filesystem?

1.4k views Asked by At

Suppose to have the following scenario, on a linux system:

  • An ext4 data partition mounted as Read-Only: data_ro
  • An overlay partition: data_overlay
  • The two of them union-mounted using UnionFS: mount -t overlayfs -o lowerdir=data_ro,upperdir=data_overlay overlayfs data

At a certain point in time it is needed to persist the changes from data_overlay into data_ro (obviously data_ro will be remounted R/W in such case and then remounted back R/O).


How to persist changes in the overlay/upperdir into the base/lowerdir filesystem?

Is it coping/moving from overlay to the base FS enough, like in the following commands sequence?

umount data
mount -o remount,rw data_ro
mv -rf data_overlay data_ro
mount -o remount,ro data_ro
mount -t overlayfs -o lowerdir=data_ro,upperdir=data_overlay overlayfs data
0

There are 0 answers