As example I choose a 50 MB sized container.
Creation of 50MB.ext2 is quite easy. Cave! dd can be run as any user, mkfs.ext2 and tune2fs must be run as root. Only use e.g. tune2fs when the ext2 container is umounted.
# creating: dd
Code: Select all
dd if=/dev/zero of=50MB.ext2 bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 5.02623 s, 10.4 MB/s
Code: Select all
mkfs.ext2 50MB.ext2
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 51200 1k blocks and 12824 inodes
Filesystem UUID: d86ffe69-d893-4d7b-9016-0cada3261660
Superblock backups stored on blocks:
8193, 24577, 40961
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
Code: Select all
tune2fs -m 0.1 50MB.ext2
Code: Select all
mkdir /TEST
mount 50MB.ext2 /TEST
# check how empty or full it is
df -m /TEST/
Filesystem Type 1M-blocks Used Available Use% Mounted on
/dev/loop16 ext2 49 1 48 2% /TEST
Added in 1 day 31 minutes 24 seconds:
I forgot to add:
Like any sane fs, the created ext container's root folder (aka its "/" folder) will be owned by user root group root and be read-only for others.
Let's presume you mounted your ext2 container under /TEST
The possible problem when you want to copy files into /TEST or save downloaded files into /TEST as default guest user is that you cannot, and you also cannot create a new folder in /TEST.
The reason:
Code: Select all
root@porteus:/# ls -oa /TEST/
total 13
drwxr-xr-x 3 root 1024 2021-11-11 03:45 .
drwxr-xr-x 73 root 480 2021-11-11 03:45 ..
drwx------ 2 root 12288 2021-11-11 03:45 lost+found
Code: Select all
chown guest.users /TEST/.
Code: Select all
root@porteus:/# ls -oa /TEST/
total 13
drwxr-xr-x 3 guest 1024 2021-11-11 03:45 .
drwxr-xr-x 73 root 480 2021-11-11 03:45 ..
drwx------ 2 root 12288 2021-11-11 03:45 lost+found
(Please be aware that ls -oa omits the group info of shown files and folders. Use ls -la if you want to also see group info)