2

I am currently working with a small Ubuntu-Server running on a raspberry pi to provide some services in my network. To extend the lifetime of my SD-card, I am trying to use an overlay-fs (see here for example). I found a nice ready-to-use package "overlayroot". This works as a charm, but since I wanted to use a tmpfs as upper layer, I would need to backup the upper layer on a regular basis (To an external storage, like a NAS or a different PC).

Since the upper layer filesystem is just like an incremental backup, I really like the idea of saving once the lower layer somewhere, and after that keeping only daily backups of the upper layer.

I tested around a bit - when I delete a file present in the lower layer, a special file is being created in the upper layer, marking the deletion of that file. A tar-archive of the upper layer correctly packs that file and unpacks it again - problem here is, this is not working "on the fly", meaning unpacking the archive in the upper layer while the overlayfs is already mounted. When I'm trying to do this, interesting errors occur, which shows that the kernel didn't notice all of the changes made to the upper layer filesystem. (When you try the same thing before mounting the overlay, it works like a charm!)

My question is, does anybody have an idea how to "restore" the filesystem from a tar-archive on the fly (since unmounting the root filesystem is not possible...) Of course, I could hook the restoration somewhere inside the initramfs-tools (where the rootfs gets mounted) - but I really don't like messing around with that... is there any other option?

Martin
  • 1,869
  • 6
  • 16

0 Answers0