[SOLVED] Cannot get rsync script to backup files to USB
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When I execute this script, this is the error message:
Code:
len@len-satellitee45ta:~/Backup$ ./rsyncDriveFUSBBackup2.sh
sending incremental file list
rsync: [Receiver] mkdir "/media/len/DRIVE F" failed: Permission denied (13)
rsync error: error in file IO (code 11) at main.c(758) [Receiver=3.2.2]
sending incremental file list
rsync: [generator] recv_generator: mkdir "/media/len/DRIVE F" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
Documents/
sent 71 bytes received 174 bytes 490.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1287) [sender=3.2.2]
Here is the lsblk output:
Code:
len@len-satellitee45ta:~/Backup$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55M 1 loop /snap/core18/1880
loop1 7:1 0 309.8M 1 loop /snap/flightgear/36
loop2 7:2 0 29.9M 1 loop /snap/snapd/8542
loop3 7:3 0 55.3M 1 loop /snap/core18/1885
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 450M 0 part
├─sda2 8:2 0 100M 0 part
├─sda3 8:3 0 16M 0 part
├─sda4 8:4 0 465.5G 0 part
├─sda5 8:5 0 570M 0 part
├─sda6 8:6 0 1G 0 part
├─sda7 8:7 0 48.8G 0 part /media/len/rootantiX19
├─sda8 8:8 0 9.3G 0 part [SWAP]
├─sda9 8:9 0 57.5G 0 part /
├─sda10 8:10 0 1.1G 0 part
├─sda11 8:11 0 53.7G 0 part
├─sda12 8:12 0 4.2G 0 part
└─sda13 8:13 0 46.6G 0 part
sdb 8:16 0 29.8G 0 disk
sdc 8:32 1 29.8G 0 disk
└─sdc1 8:33 1 29.8G 0 part
Attached is the screenshot of the file manager listing of DRIVE F.
I am operating in SparkyLinux. Screenshot also attached.
I cannot imagine what I am doing wrong. But surely you all can help. Thanks.
It's very simple: The user account that attempts to copy to the DRIVE F directory doesn't have write permissions there.
By the way, the lsblk output shows two devices that might be 32GB drives (sdb and sdc), but they don't seem to be mounted. Which seems to conflict with the filemanager.
Find out if this drive is mounted at all, and if yes what are the mount options (the mount command is sufficient, though it outputs a lot of irrelevant lines).
Thanks, berndbausch. I executed the mount command. Here is the relevant output:
Code:
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=394528k,nr_inodes=98632,mode=700,uid=1000,gid=1000)
/dev/sdc1 on /media/len/DRIVE F type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
I agree with berndbausch, the lsblk seems to show no /media/len/DRIVE F. According to the rsync output your user does not have necessary permissions.
Try looking in /proc/mounts to see if /dev/sdc1 is, indeed, mounted where you think it is. If so, run an ls -l on /media/len/DRIVE F and see what the permissions are. If that doesn't show the problem, then unmount, disconnect and remount. See if that solves it. The problem, according to rsync is
OK! I'm rolling along with all your help. Thanks so much.
@berndbausch: Your comment on user accounts and permissions got me to thinking: I wonder if I should put "sudo" in front of my script command? And that did the trick! It started backing up my files, and writing to DRIVE F.
However, for some reason most of the output, backed up files were protected, and I couldn't look at them. It turns out that they only had privileges for the root user. I'm the only user, so that's OK. I just issued a chmod +777 on all the files, and backed them up again.
I did have some other problems, not related to my script, as I was running out of room on my hard disk. I had to shrink and grow partitions with Gparted to get things rolling again.
@agillator: Thanks for the suggestions on the -t flag. I didn't know that.
Here is the pertinent area of /proc/mounts, showing that DRIVE F is mounted:
I'm not sure why I need to run my script as root in order to get it to work, but that's something I'm willing to live with. This is the first time I've run the script on SparkyLinux. The other distros were Ubuntu and antiX, where it performed flawlessly.
Thanks so much for your quick response, and for the wisdom you offered me. You guys are the best!
The issue is how your system is mounting your partition. Obviously it is mounting it with root as the owner therefore to create a directory or to write to the directory you need to be root therefore using sudo. If you manually change the owner and/or the permissions of the partition that may change. Experiment and see what YOUR system does when you unmount and mount the partition under different conditions.
Am I missing something, or is it mounted at "/media/len/DRIVE F1", instead of "/media/len/DRIVE F"?
In case the mount point is not at issue here, I would check file and directory ownership with ls -l "/media/len/DRIVE F", and I would check if my user's ID is indeed 1000.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.