Score:0

unable to use rsync into a usb drive

rs flag

I have this rsync command: rsync -auv -delete /home/user/mc-server-files /home/user/sandisk-usb/mc-server-files >> /home/user/mylogs/school-server-backup.log 2>&1

I also have it in crontab. When I try to run it manually, it doesn't work. The log file gives me a lot of Permission denied (13) I think this is because of the usb drive permissions:

Output of ls -l
drwxr-xr-x   4 root root   32768 Aug  2 16:09 sandisk-usb
Output of dF -Th
/dev/sdb1      exfat   29G  320K   29G   1% /home/user/sandisk-usb
Drive mounted with:
mount /dev/sdb1 /home/user/sandisk-usb

My user is in the sudo group, but not the root group. I am also unable to change the permissions with sudo chmod g=rw /home/user/sandisk-usb/mc-server-files. The command doesn't say anything after running and keeps permissions the same.

waltinator avatar
it flag
How is it mounted? `mount | grep "/dev/sdb"` will tell. Read `man mount`, there is a section on mounting ExFAT volumes. FAT and NTFS format volumes don't support Linux file ownership or permissions. Can you backup your data and format it as `ext4`. **Warning** No data survives a format. **Warning** `ext4` is incompatible with Windows.
waltinator avatar
it flag
`rsync` is complaining that it cannot read the files you have told it to back up. In the terminal, you'll have to `sudo rsync ...`. To get your command to work via `crontab`, you'll have to set up passwordless `sudo` access to the `rsync` command. Read `man sudo sudoers` to learn how. Wrap your `sudo rsync ...` command in a `#!/bin/bash` script for easier control, and use the full path for `rsync`
spirledaxis avatar
rs flag
The solution for me was to umount the drive, then mount it again with ``sudo mount -o uid=1000 /dev/sdb1 /home/user/sandisk-usb``. When I mounted it before I did not specify a user or group like this, so I guess it defaulted to root.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.