From da4a29c615fac6baa401c3aa1aea49c681dbd260 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 27 Sep 2022 23:32:35 +0200 Subject: [PATCH] Added howto to mount files as virtual file systems --- .../mount files as virtual file systems.md | 3 ++- knowledge base/raspberry pi os.md | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/knowledge base/mount files as virtual file systems.md b/knowledge base/mount files as virtual file systems.md index 2639e8f..4b54433 100644 --- a/knowledge base/mount files as virtual file systems.md +++ b/knowledge base/mount files as virtual file systems.md @@ -14,7 +14,8 @@ mkfs.ext4 'path/to/file' mkdir 'mount/point' # Mount the file system. -sudo mount -t 'ext4' 'path/to/file' 'mount/point' +# The 'loop' option is optional. +sudo mount -t 'ext4' -o 'loop' 'path/to/file' 'mount/point' ``` Prefer `truncate` to `dd` to let the file expand dynamically and be resized (both larger or smaller) without damaging data with `losetup` and `resize2fs`. diff --git a/knowledge base/raspberry pi os.md b/knowledge base/raspberry pi os.md index 2de5c70..2f4a6c6 100644 --- a/knowledge base/raspberry pi os.md +++ b/knowledge base/raspberry pi os.md @@ -1,6 +1,25 @@ # Raspberry Pi OS -## Let it run containers +1. [Store files on the SD even when the overlay file system is active](#store-files-on-the-sd-even-when-the-overlay-file-system-is-active) +2. [Make it able to run containers](#make-it-able-to-run-containers) + 1. [Kernel containerization features](#kernel-containerization-features) + 2. [Firewall settings](#firewall-settings) +3. [Sources](#sources) + +## Store files on the SD even when the overlay file system is active + +The files just need to be stored on a different file system from `/`. You can partition the SD and use that, or create a file and mount it as a virtual file system: + +```sh +truncate -s '6G' 'file' +mkfs.ext4 'file' +mkdir 'mount/point' +sudo mount -t 'ext4' -o 'loop' 'file' 'mount/point' +sudo chown 'user':'group' 'mount/point' +touch 'mount/point/new-file' +``` + +## Make it able to run containers ### Kernel containerization features