Greetings,
I've been using rsync to backup from my various desktops and laptops to an in-house networked server. A variant of the script is appended below. Located in /etc/cron.hourly, the script pings a machine to see if it is live; if so, it proceeds to do an incremental backup to a machine-specific location on a dedicated drive. Components of this script were suggested, and then I adapted it for my situation.
Where I seem to run into some trouble is when I try to restore from the dedicated drive when it is attached to a machine via USB cable. Specifically, when running a command such as this: rsync -av /var/backup/machine1/home/SomeUser /home
I get a lot of messages such as this: rsync: [receiver] mkstemp "/path/to/some/file.0atuCZ" failed: Invalid argument (22)
In the process, not all files are restored.
Any guidance would be greatly appreciated.
Thank you,
MP pyz@brama.com
#### Begin Rsync Script ###### #!/bin/sh
HOSTS="machine1 machine2" RSYNC=/usr/bin/rsync SSH=/usr/bin/ssh KEY="/root/.ssh/rsync-key" RUSER=root RPATH=/home
for RHOST in $HOSTS do ping -q -c 1 -w 5 $RHOST > /dev/null if [ $? -eq 0 ]; then echo "$RHOST is pingable" LPATH="/var/backup2/$RHOST"
echo "$RUSER $RHOST $RPATH $LPATH" $RSYNC -avz --delete -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH $LPATH # $RSYNC -avz -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH $LPATH
sleep 5
fi done exit
On 5/27/23 13:36, Max Pyziur wrote:
Where I seem to run into some trouble is when I try to restore from the dedicated drive when it is attached to a machine via USB cable. Specifically, when running a command such as this: rsync -av /var/backup/machine1/home/SomeUser /home
I get a lot of messages such as this: rsync: [receiver] mkstemp "/path/to/some/file.0atuCZ" failed: Invalid argument (22)
I assume "/path/to/some/" is on the target drive. What filesystem are you using on the USB drive? Can you give any real examples of failed filenames (even just the final name, not the path)?
On Sat, 27 May 2023, Samuel Sieb wrote:
On 5/27/23 13:36, Max Pyziur wrote:
Where I seem to run into some trouble is when I try to restore from the dedicated drive when it is attached to a machine via USB cable. Specifically, when running a command such as this: rsync -av /var/backup/machine1/home/SomeUser /home
I get a lot of messages such as this: rsync: [receiver] mkstemp "/path/to/some/file.0atuCZ" failed: Invalid argument (22)
I assume "/path/to/some/" is on the target drive. What filesystem are you
Yes, the target drive.
using on the USB drive? Can you give any real examples of failed filenames (even just the final name, not the path)?
An example of a filename: rsync: [receiver] mkstemp "/path/to/some/directory/WNYC's Leonard Lopate Show/.wnyc_lopate.mp3?d=475.0atuCZ" failed: Invalid argument (22)
It seems blanks and characters such as apostrophes, brackets, etc, cause problems.
As for filesystems, source/target can be ext4 to ext4 ext4 to HPFS/NTFS/exFAT HPFS/NTFS/exFAT to ext4
... depending on direction.
The HPFS/NTFS/exFAT is a 2TB portable Samsung SSD Model T7. I wasn't sure if I should reformat it to ext4, leave as-is, or what?
What's interesting to me is that the command rsync -avz source target on two separate machines doesn't produce this error/noise.
While rsync -av source target
where target is a USB-mounted drive does.
Thank you.
M
On 5/27/23 15:15, Max Pyziur wrote:
On Sat, 27 May 2023, Samuel Sieb wrote:
On 5/27/23 13:36, Max Pyziur wrote:
Where I seem to run into some trouble is when I try to restore from the dedicated drive when it is attached to a machine via USB cable. Specifically, when running a command such as this: rsync -av /var/backup/machine1/home/SomeUser /home
I get a lot of messages such as this: rsync: [receiver] mkstemp "/path/to/some/file.0atuCZ" failed: Invalid argument (22)
I assume "/path/to/some/" is on the target drive. What filesystem are you
Yes, the target drive.
using on the USB drive? Can you give any real examples of failed filenames (even just the final name, not the path)?
An example of a filename: rsync: [receiver] mkstemp "/path/to/some/directory/WNYC's Leonard Lopate Show/.wnyc_lopate.mp3?d=475.0atuCZ" failed: Invalid argument (22)
It seems blanks and characters such as apostrophes, brackets, etc, cause problems.
As for filesystems, source/target can be ext4 to ext4 ext4 to HPFS/NTFS/exFAT HPFS/NTFS/exFAT to ext4
... depending on direction.
The HPFS/NTFS/exFAT is a 2TB portable Samsung SSD Model T7. I wasn't sure if I should reformat it to ext4, leave as-is, or what?
"HPFS/NTFS/exFAT" isn't a filesystem. Are you getting that from fdisk or something? What does mount say? I'm going to assume it's some type of FAT, probably exFAT if it's actually one of that list. There are characters that can't be in filenames on that. Also, you'll be losing file attributes and labels which will be a problem if you want to restore in the future. I suggest reformatting it to a Linux filesystem like ext4 or btrfs.
On Sat, 27 May 2023, Samuel Sieb wrote:
On 5/27/23 15:15, Max Pyziur wrote:
On Sat, 27 May 2023, Samuel Sieb wrote:
On 5/27/23 13:36, Max Pyziur wrote:
Where I seem to run into some trouble is when I try to restore from the dedicated drive when it is attached to a machine via USB cable. Specifically, when running a command such as this: rsync -av /var/backup/machine1/home/SomeUser /home
I get a lot of messages such as this: rsync: [receiver] mkstemp "/path/to/some/file.0atuCZ" failed: Invalid argument (22)
I assume "/path/to/some/" is on the target drive. What filesystem are you
Yes, the target drive.
using on the USB drive? Can you give any real examples of failed filenames (even just the final name, not the path)?
An example of a filename: rsync: [receiver] mkstemp "/path/to/some/directory/WNYC's Leonard Lopate Show/.wnyc_lopate.mp3?d=475.0atuCZ" failed: Invalid argument (22)
It seems blanks and characters such as apostrophes, brackets, etc, cause problems.
As for filesystems, source/target can be ext4 to ext4 ext4 to HPFS/NTFS/exFAT HPFS/NTFS/exFAT to ext4
... depending on direction.
The HPFS/NTFS/exFAT is a 2TB portable Samsung SSD Model T7. I wasn't sure if I should reformat it to ext4, leave as-is, or what?
"HPFS/NTFS/exFAT" isn't a filesystem. Are you getting that from fdisk or something? What does mount say? I'm going to assume it's some type of FAT,
Yes from fdisk.
probably exFAT if it's actually one of that list. There are characters that
Looking at /etc/mtab it is reported as: /dev/sda1 /run/media/pyz/T7 exfat rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro 0 0
So, yes, exFAT.
can't be in filenames on that. Also, you'll be losing file attributes and labels which will be a problem if you want to restore in the future. I suggest reformatting it to a Linux filesystem like ext4 or btrfs.
Thanks to Samuel and Todd.
Once all systems appear stable the 2TB Samsung T7 is going in the ext4 direction.
Thank you again,
M
Max Pyziur wrote:
An example of a filename: rsync: [receiver] mkstemp "/path/to/some/directory/WNYC's Leonard Lopate Show/.wnyc_lopate.mp3?d=475.0atuCZ" failed: Invalid argument (22)
It seems blanks and characters such as apostrophes, brackets, etc, cause problems.
...
The HPFS/NTFS/exFAT is a 2TB portable Samsung SSD Model T7. I wasn't sure if I should reformat it to ext4, leave as-is, or what?
What's interesting to me is that the command rsync -avz source target on two separate machines doesn't produce this error/noise.
While rsync -av source target
where target is a USB-mounted drive does.
A '?' is invalid for a file or directory name on a FAT filesystem. Other invalid characters:
\0 " * : < > ? \ | ¿