This commit is contained in:
Zsolt Ero
2023-12-18 04:11:37 +01:00
parent f718d90d37
commit a242734ae4
2 changed files with 27 additions and 21 deletions

View File

@@ -57,6 +57,16 @@ def prepare_http_host(c):
def debug_tmp(c):
put(c, scripts / 'tile_gen' / 'extract_btrfs.sh', TILE_GEN_BIN, permissions='755', owner='ofm')
put(
c,
scripts / 'extract_mbtiles' / 'extract_mbtiles.py',
TILE_GEN_BIN,
permissions='755',
owner='ofm',
)
return
c.sudo('rm -rf /data/ofm/logs')
c.sudo('mkdir -p /data/ofm/logs')
c.sudo('rm -f /data/nginx/logs/*')
@@ -80,7 +90,7 @@ def debug_tmp(c):
'--skip-shared', is_flag=True, help='Skip the shared installtion step (useful for development)'
)
def main(hostname, user, port, tile_gen, http_host, skip_shared, do_reboot, debug):
if not click.confirm(f'Run script on {hostname}?'):
if not debug and not click.confirm(f'Run script on {hostname}?'):
return
if not tile_gen and not http_host and not debug:

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -e
sudo umount mnt_rw || true
sudo umount mnt_rw2 || true
sudo umount mnt_rw 2> /dev/null || true
sudo umount mnt_rw2 2> /dev/null || true
rm -rf mnt_rw* tmp_*
rm -f *.btrfs *.gz
rm -f *.log
@@ -13,24 +13,24 @@ fallocate -l 200G image2.btrfs
# metadata: single needed as default is now DUP
mkfs.btrfs -v \
mkfs.btrfs \
-m single \
image.btrfs
image.btrfs > /dev/null
mkfs.btrfs -v \
mkfs.btrfs \
-m single \
image2.btrfs
image2.btrfs > /dev/null
# https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#mount-options
# compression doesn't make sense, data is already gzip compressed
mkdir -p mnt_rw mnt_rw2
sudo mount -v \
sudo mount \
-t btrfs \
-o noacl,nobarrier,noatime,max_inline=4096 \
image.btrfs mnt_rw
sudo mount -v \
sudo mount \
-t btrfs \
-o noacl,nobarrier,noatime,max_inline=4096 \
image2.btrfs mnt_rw2
@@ -50,26 +50,25 @@ 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
sudo 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
sudo btrfs filesystem df mnt_rw2
echo -e "\n\nbtrfs filesystem show"
btrfs filesystem show mnt_rw2
sudo btrfs filesystem show mnt_rw2
echo -e "\n\nbtrfs filesystem usage"
btrfs filesystem usage mnt_rw2
sudo btrfs filesystem usage mnt_rw2
echo -e "\n\nbtrfs filesystem du -s"
sudo btrfs filesystem du -s mnt_rw2
echo -e "\n\ncompsize -x"
compsize -x mnt_rw2
sudo compsize -x mnt_rw2 2> /dev/null || true
} > stats.txt
sudo umount mnt_rw
sudo umount mnt_rw2
rm -r mnt_rw*
@@ -78,9 +77,6 @@ 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