Free space is wrongly calculated for USB disk
Closed this issue ยท 4 comments
Thanks for that script, might save me a lot of work when getting my broken btrfs up again ๐
When using a USB disk as a backup target, the free space is calculated wrongly.
sudo -s $PWD/syno_app_mover.sh
Synology_app_mover v3.0.50
DS923+ DSM 7.2.1-69057-5
Running from: /volumeUSB1/usbshare/disaster_recovery/Synology_app_mover-3.0.50/syno_app_mover.sh
1) Move
2) Backup
3) Restore
Select the mode: 2
You selected Backup
Backup path is: /volumeUSB1/usbshare/disaster_recovery/
Do you want to backup All packages? [y/n]
n
[Installed package list]
1) /volume1 Active Backup for Business
2) /volume1 Active Backup for Google Workspace
3) /volume1 Active Backup for Microsoft 365
4) /volume1 Apache HTTP Server 2.4
5) /volume1 cloudflared
6) /volume1 Cloud Sync
7) /volume1 Container Manager
8) /volume1 DNS Server
9) /volume1 Document Viewer
10) /volume1 Hyper Backup
11) /volume1 OctoPrint
12) /volume1 Storage Analyzer
13) /volume1 Synology Application Service
14) /volume1 Synology Photos
15) /volume1 Text Editor
16) /volume1 Web Station
Select the package to backup: 7
You selected Container Manager in /volume1
Destination volume is /volumeUSB1
Ready to Backup Container Manager to /volumeUSB1/usbshare/disaster_recovery/? [y/n]
y
du: cannot access '/volume1/@docker/containers/774f0a6b0838502a0c634ad0ebe6959cb5ce9ba1cfa83d6e2e9464268ae15841/log.db-journal': No such file or directory
vol_free_space called with /volumeUSB1
free is set to 6455240
WARNING Not enough space to backup /volume1/@docker to /volumeUSB1
Free: 6 GB Needed: 191 GB (plus 50 GB buffer)
ERROR Not enough space on /volumeUSB1 to backup @docker!
the line vol_free_space called with /volumeUSB1
was added by me, but shows the issue.
As the USB volume is mounted within /volumeUSB1/usbshare
the free space if /
is returned.
df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 8191352 1617448 6455120 21% /
...
/dev/usb2p1 3844638928 1287314448 2557205696 34% /volumeUSB1/usbshare
Did you also add the free is set to 6455240
line?
I suspect the targetpath variable was empty so df processed /
instead of the expected /volumeUSB1
Can you run this test script and confirm that it does not give the same error? All it does it check if there's enough space.
https://github.com/007revad/Synology_app_mover/blob/test/syno_app_mover_test.sh
I've found another bug while testing this. I tested with a USB thumb drive that only had 670MB free and the script said it had 6GB free.
I also notice you got another error:
du: cannot access '/volume1/@docker/containers/774f0 <snipped> 15841/log.db-journal': No such file or directory
That error is harmless, which is probably why you didn't mention it.
Did you also add the free is set to 6455240 line?
yes
Can you run this test script and confirm that it does not give the same error? All it does it check if there's enough space.
https://github.com/007revad/Synology_app_mover/blob/test/syno_app_mover_test.sh
max@Synology:/volumeUSB1/usbshare/disaster_recovery/Synology_app_mover-3.0.50$ sudo bash syno_app_mover_test.sh
Password:
You selected Move
You selected Container Manager
debug: backup path: /volumeUSB1/usbshare/disaster_recovery/
debug: target volume: /volumeUSB1
(ditched some i/o errors here)
WARNING Not enough space to backup /volume1/@docker to /volumeUSB1
Free: 6 GB Needed: 189 GB (plus 50 GB buffer)
ERROR Not enough space on /volumeUSB1 to backup @docker!
I also notice you got another error:
yes, my whole volume1 is dying currently. Somehow the btrfs is corrupted, starting without any reason at all.
some more df
for comparisment:
max@Synology:/volumeUSB1/usbshare/disaster_recovery/Synology_app_mover-3.0.50$ df /volumeUSB1
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 8191352 1620456 6452112 21% /
max@Synology:/volumeUSB1/usbshare/disaster_recovery/Synology_app_mover-3.0.50$ df /volumeUSB1/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 8191352 1620472 6452096 21% /
max@Synology:/volumeUSB1/usbshare/disaster_recovery/Synology_app_mover-3.0.50$ df /volumeUSB1/usbshare
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/usb2p1 3844638928 1522498428 2322021716 40% /volumeUSB1/usbshare
max@Synology:/volumeUSB1/usbshare/disaster_recovery/Synology_app_mover-3.0.50$ df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md0 8191352 1620524 6452044 21% /
I see the problem now. For USB drives the mount point is /volumeUSB1/usbshare
and not /volumeUSB1
This new version should work now https://github.com/007revad/Synology_app_mover/releases/tag/v3.0.51
Works fine, thanks!