Fix vitastor-disk resize to smaller size clearing all data O_o, add a test for it

This commit is contained in:
Vitaliy Filippov
2026-06-10 00:30:42 +03:00
parent c16f955a51
commit 334755e912
4 changed files with 23 additions and 9 deletions
+14
View File
@@ -10,4 +10,18 @@ $ETCDCTL get --prefix '/vitastor/pg/state'
$VITASTOR_CLI rm-data --pool 1 --inode 1
# test resize with partial data removal
$VITASTOR_CLI create -s 128M testimg
$VITASTOR_FIO -bs=4M -direct=1 -iodepth=1 -end_fsync=1 -fsync=1 -rw=write -image=testimg
$VITASTOR_CLI modify --resize 64M testimg
$VITASTOR_CLI dd iimg=testimg of=./testdata/bin/testimg.bin
sz=$(stat -c %s ./testdata/bin/testimg.bin)
[[ "$sz" = 67108864 ]] || format_error "File size is $sz bytes after resize to 64 M"
format_green OK