Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clone_sd.pl doesn't properly detect directory existence #1480

Open
thing4711 opened this issue Apr 7, 2024 · 1 comment
Open

clone_sd.pl doesn't properly detect directory existence #1480

thing4711 opened this issue Apr 7, 2024 · 1 comment

Comments

@thing4711
Copy link

Hi all,

I am trying to backup to LoxBerry SD card to an SMB network drive with the script /opt/loxberry/sbin/clone_sd.pl.
I started using the web interface and after it failed tried to debug it on the console but I can't find out what the issue is.

This is what happens when I run the script:

root@loxberry:/opt/loxberry/sbin# perl ./clone_sd.pl /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry path 7z
================================================================================
<LOGSTART> 07.04.2024 18:23:43 TASK STARTED
<LOGSTART> Clone SD card
<INFO> LoxBerry Version 3.0.1.1 ( is_hwmodel_raspberry_pi_4_400.cfg is_raspberry.cfg is_arch_aarch64.cfg )
<INFO> Loglevel: 6
<INFO> Version of this script: 3.0.0.3
<INFO> Parameters: /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry path 7z
<INFO> Executing user is root
<INFO> Executing command 'lsblk -b -O -J'...
<OK> Command executed successfully. - Exitcode 0
<INFO> Executing command 'findmnt / -b -J'...
<OK> Command executed successfully. - Exitcode 0
<INFO> Executing command 'findmnt /boot -b -J'...
<OK> Command executed successfully. - Exitcode 0
<INFO> /     is on partition /dev/mmcblk0p2
<INFO> /boot is on partition /dev/mmcblk0p1
<INFO> Boot device is mmcblk0

================================================================================

<INFO> Your boot device (SOURCE of clone):
/dev/mmcblk0 Type disk Size 59.5GB
<INFO>    -> Partition mmcblk0p1 Size 128.0MB VFAT
<INFO>    -> Partition mmcblk0p2 Size 59.4GB EXT4

<CRITICAL> Your entered DESTINATION path /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry does not exist or isn't writeable.
<LOGEND> Finished
<LOGEND> 07.04.2024 18:23:45 TASK FINISHED

This is the result of some manual permission investigation on the console:

root@loxberry:/opt/loxberry/sbin# stat /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry
 Datei: /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry
 Größe: 0               Blöcke: 0          EA Block: 1048576 Verzeichnis
Gerät: 0/44     Inode: 354446      Verknüpfungen: 2
Zugriff: (0777/drwxrwxrwx)  Uid: ( 1001/loxberry)   Gid: ( 1001/loxberry)
Zugriff: 2024-04-07 18:09:49.791597200 +0200
Modifiziert: 2024-04-07 18:09:49.791597200 +0200
Geändert: 2024-04-07 18:09:49.791597200 +0200
Geburt: 2021-11-16 21:33:03.206439200 +0100

root@loxberry:/opt/loxberry/sbin# ls -alF /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry
insgesamt 2460860
drwxrwxrwx 2 loxberry loxberry          0  7. Apr 18:09 ./
drwxrwxrwx 2 loxberry loxberry          0 25. Aug 2023  ../

root@loxberry:/opt/loxberry/sbin# echo "test" > /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry/test.txt

root@loxberry:/opt/loxberry/sbin# ls -alF /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry
insgesamt 2460860
drwxrwxrwx 2 loxberry loxberry          0  7. Apr 18:09 ./
drwxrwxrwx 2 loxberry loxberry          0 25. Aug 2023  ../
-rw-rw-rw- 1 loxberry loxberry          5  7. Apr 18:09 test.txt

root@loxberry:/opt/loxberry/sbin# cat /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry/test.txt
test

I don't get, why the following block doesn't properly detect existence of that directory...

$destpath_found = 0 if ( !-e $destpath);
if (!$destpath_found) {
    LOGCRIT "Your entered DESTINATION path $destpath does not exist or isn't writeable.";

I forced the script to continue with commenting out the following exit(1); but afterwards there is another issue:

<CRITICAL> Your entered DESTINATION path /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry does not exist or isn't writeable.
<INFO> Destination device is  () available space 0.0B
<CRITICAL> /media/smb/qnap.nas/data_ha/Backup/Loxone/loxberry (0.0B) is smaller than required space (4.3GB)

Is it possible that the issue is with the fact that it is a network drive (cifs mount) ?
Is there any idea how I can alter the script to make it function ?

Thank you in advance.

@mschlenstedt
Copy link
Owner

Are you sure there's no access right problem on NAS side? Or any "max filesize" problems on NAS side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants