This commit is contained in:
Zsolt Ero
2024-02-12 19:44:49 +01:00
parent e7e53e62a7
commit 541ecdfb7e
16 changed files with 60 additions and 33 deletions

View File

@@ -0,0 +1,5 @@
ext4
Reduce the inode size: 256 -> -I 128
Reduce the inode ratio: The inode ratio is the number of blocks per inode. You can increase the inode ratio to reduce the number of inodes created. This can be done with the -i option when creating the filesystem. For example, -i 8192 will create one inode every 8192 blocks.

View File

@@ -0,0 +1,67 @@
#!/usr/bin/env bash
# reference:
# https://www.kernel.org/doc/Documentation/filesystems/ext4.txt
# https://wiki.archlinux.org/title/ext4
#
# -m reserved-blocks-percentage
# -F Force mke2fs to create a filesystem, even if the specified device is not a partition on a block special device
#
# -O feature
# from /etc/mke2fs.conf
# defaults: has_journal,extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize
# disabling journalling, since it's a read-only fs, as well as other unused features
# extent is actually needed for tail packing small files
#
# -E extended-options
# lazy_itable_init - inode table is fully initialized at the time of file system creation
# nodiscard - Do not attempt to discard blocks at mkfs time.
#
# inode_size = 128 (minimum)
# inode_ratio = 16384 (default but experimenting)
sudo umount mnt || true
rm -rf mnt
rm -f image.ext4
# make a sparse file
# make sure it's bigger then the current OSM output
fallocate -l 200G image.ext4
mke2fs -t ext4 -v \
-m 0 \
-F \
-O ^has_journal,^huge_file,^metadata_csum,^64bit,^extra_isize \
-E lazy_itable_init=0,nodiscard \
-I 128 \
-i 16384 \
image.ext4
mkdir mnt
sudo mount -v \
-t ext4 \
-o nobarrier,noatime \
image.ext4 mnt
sudo chown ofm:ofm -R mnt
/data/ofm/venv/bin/python ../../tile_gen/extract.py output.mbtiles mnt/extract \
> "extract_out.log" 2> "extract_err.log"
sudo umount mnt
e2fsck -vf image.ext4 && \
resize2fs -M image.ext4 && \
e2fsck -vf image.ext4
# default to read-only mode
tune2fs -E mount_opts=ro image.ext4

View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Define the source folder
source_folder="20231228_201550_pt"
# Define the number of copies you want to make
number_of_copies=40
# Loop and copy the folder into c1, c2, c3, c4, ...
for i in $(seq 1 $number_of_copies); do
cp -r "$source_folder" "c$i"
btrfstune -m "c$i/tiles.btrfs"
done