But I don't think there's a problem with the fs. Running the script from terminal it works _every_ time, running by cron it works about once out of 3 or 4 tries.
If this helps, here is the script I use (actually the script runs a normal user, thus some things have to run with sudo and I added a check if the fs is already mounted):
No problem:
$ e2fsck /dev/mapper/backup
e2fsck 1.41.9 (22-Aug-2009)
BACKUP: clean, 27987/127512 files, 323361/509980 blocks
$ e2fsck -f /dev/mapper/backup
e2fsck 1.41.9 (22-Aug-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
BACKUP: 27987/127512 files (1.3% non-contiguous), 323361/509980 blocks
But I don't think there's a problem with the fs. Running the script from terminal it works _every_ time, running by cron it works about once out of 3 or 4 tries.
If this helps, here is the script I use (actually the script runs a normal user, thus some things have to run with sudo and I added a check if the fs is already mounted):
#!/bin/bash "/home/ christian/ backup- luks.img" "/home/ christian/ backup. key"
BACKUP=
KEYFILE=
LOOP=`losetup -f`
losetup "$LOOP" "$BACKUP"
cryptsetup -d "$KEYFILE" luksOpen "$LOOP" backup
mkdir /media/backup
e2fsck /dev/mapper/backup
mount /dev/mapper/backup /media/backup
/usr/bin/backintime -b
umount /media/backup
rmdir /media/backup
cryptsetup luksClose backup
losetup -d "$LOOP"
touch "$BACKUP"