This commit is contained in:
Zsolt Ero
2023-12-18 04:00:21 +01:00
parent d112a0853e
commit f718d90d37
3 changed files with 71 additions and 29 deletions

View File

@@ -3,8 +3,8 @@ set -e
sudo umount mnt_rw || true
sudo umount mnt_rw2 || true
rm -rf mnt_rw*
rm -f image*.btrfs
rm -rf mnt_rw* tmp_*
rm -f *.btrfs *.gz
rm -f *.log
# make an empty file that's definitely bigger then the current OSM output
@@ -33,16 +33,42 @@ sudo mount -v \
sudo mount -v \
-t btrfs \
-o noacl,nobarrier,noatime,max_inline=4096 \
image.btrfs mnt_rw2
image2.btrfs mnt_rw2
sudo chown ofm:ofm -R mnt_rw mnt_rw2
../../tile_gen/venv/bin/python ../../tile_gen/extract_mbtiles.py output.mbtiles mnt_rw/extract \
> extract_out.log 2> extract_err.log
# we need to extract, delete and rsync onto a new partition
grep fixed extract_out.log > dedupl_fixed.log || true
# we need to extract, delete dedupl and rsync onto a new partition
# otherwise the partition image stays big
rsync -aH mnt_rw/extract/ mnt_rw2/extract/ > rsync_out.log 2> rsync_err.log
rsync -avH mnt_rw/extract/ mnt_rw2/extract/ > rsync_out.log 2> rsync_err.log
# collect stats
{
echo -e "df -h"
df -h mnt_rw2
echo -e "\n\nbtrfs filesystem df"
btrfs filesystem df mnt_rw2
echo -e "\n\nbtrfs filesystem du -s"
btrfs filesystem du -s mnt_rw2
echo -e "\n\nbtrfs filesystem show"
btrfs filesystem show mnt_rw2
echo -e "\n\nbtrfs filesystem usage"
btrfs filesystem usage mnt_rw2
echo -e "\n\ncompsize -x"
compsize -x mnt_rw2
} > stats.txt
sudo umount mnt_rw
sudo umount mnt_rw2
@@ -52,9 +78,12 @@ sudo ../../tile_gen/venv/bin/python ../../tile_gen/shrink_btrfs.py image2.btrfs
> shrink_out.log 2> shrink_err.log
#rm image.btrfs
#mv image2.btrfs done.btrfs
# pigz -k image.btrfs --fast
rm image.btrfs
mv image2.btrfs done.btrfs
pigz done.btrfs --fast
echo DONE