mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
1.2 KiB
1.2 KiB
Mount files as virtual file systems
Table of contents
TL;DR
# Create the file.
truncate -s '10G' 'path/to/file'
dd if='/dev/zero' of='path/to/file' bs=4MiB count=250K status='progress'
# Create the file system on such file.
mkfs.ext4 'path/to/file'
# Create the mount point.
mkdir 'mount/point'
# Mount the file system.
# 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.
Further readings
Sources
All the references in the further readings section, plus the following: