New answers tagged

1

You can usefully add the -i option to rsync to make it show you why it wants to copy the file again. For example, you might see .f...po.... somefilename which means the remote file has different permissions and owner. One solution is to use --size-only to only compare the sizes of files, but obviously this might cause some changed files not to be sent. ...


2

What I have done a couple of times when I wanted to move huge files and not have my rsync-based backup-script re-copy it, is to make a hardlink in the new location, run the backup-script (the -H option to rsync is the important one here) and then remove the old location. It sounds like you have done the rename/move, then I see two options: Perform the ...


0

I just use my own checking with my own script rather than rsync. Pre-Post-Secure-Copy checks a file integrity before transfer and after. If it fails deletes the remote file. This is a very raw script and needs some modifications. https://github.com/VeggieVampire/PPscp Hope this helps.


1

You can use rsync -avh --update user@IP:/folder1/folder2/folder3/FD/ /localfd1/localfd2/FD/ from man rsync : This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file. (If an existing destination file has a modification time equal to the source file’s, it will be ...


0

From man rsync --delete This tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending side), but only for the directories that are being synchronized. You must have asked rsync to send the whole directory (e.g. "dir" or "dir/") without using a wildcard for the ...


1

You should use the --exclude option in order to make rsync ignore that directory. Unless you also use --delete-excluded (which you shouldn't, in this case), it will leave it alone.


1

I've found where problem was! When I've created wrapper script, I've missed that it's in bash, and that through other tutorial, I've set the default shell to be /usr/lib/sftp-server. Afterwards, wrapper script started to work and I logged which commands I need to allow. Solution: 1.reverted shell (from /usr/lib/sftp-server), so wrapper could work: ...


1

ForceCommand is not filter, but forced command regardless the command-line as the name proposes. rsync requires to run different commands (as far as I know ... yes, sshd -ddd and ssh -vvv would be helpful to provide). One possibility is to leave the ChrootDirectory, remove ForceCommand and copy rsync, maybe some shell and it's dependencies (ldd ...


1

Without superuser you won't be able to do what you are asking. Typically you would only need to backup your /home/ folder. Some config files in /etc may be good to have backed up, but most of the rest of the root folder is for the os and shouldn't be backed up.


0

scp does overwrite files and there's no switch to stop it doing that, but you can copy things out the way, do the scp and then copy the existing files back. Examples: Copy all existing files out the way mkdir original_files ; cp -r * original_files/ Copy everything using scp scp -r user@server:dir/* ./ Copy the original files over anything scp has ...


2

What you really want to do is look at setting up public keys between the servers so they 'trust' each other and passwords are not needed. Have a read here: http://www.thegeekstuff.com/2011/07/rsync-over-ssh-without-password/


1

RAID1 will destroy everything in the case you make a mistake or a virus decides to destroy your files. But, it makes it easy to fix actual hard drive failures. rsync will cause downtime in the (very common) case that your primary hard drive fails, because you have to transfer the data back (or at least swap out the drives). But, it makes it easy to recover ...


3

My personal favourite is: create a Raid1 Software Raid (mdadm) do regular incremental backups do weekly full-backups. The software raid1 protects you from online-faults, such that the volume is active ALWAYS, as long as one drive is okay. The software raid automatically syncs the contents between the drives, so you always have the up-to-date data ...


3

Answer: It's a bug in rsync 3.1.0. This is a note from the 3.1.1. release notes, Fixed a failure to remove the partial-transfer temp file when interrupted (and rsync is not saving the partial files). Upgrade your version of rsync. Previous stuff I've just tested this on my system. tony@trinity:~$ uname -a Linux trinity 3.2.0-4-686-pae #1 SMP ...


0

For me it was sufficient to start the ssh-agent as follows: eval `ssh-agent -s` ssh-add /path/to/mykey See also a longer answer here http://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent


1

One possibility would be to create a read-only view of the directories you want that dedicated user to be able to back up, with bindfs. Do not use sudo at all; make rrsync the only command that's allowed to this user. One-time setup: mkdir /somewhere/backup-views /somewhere/backup-views/dir1 /somewhere/backup-views/dir2 chmod 700 /somewhere/backup-views ...


0

I have also considered this as a possibility, which is more generic than the excellent proposals I've accepted from meuh. listfiles() { ( # List attributes of file tree, discarding inode number cd "$1" 2>/dev/null && find . -type f -ls | sed -r 's/^ *[1-9][0-9]*//' | sort ) } listfiles hourly.1 >/tmp/list1 listfiles ...


2

After the snapshot, you can use rsnapshot diff which calls rsnapshot-diff to note the differences between two snapshots. It just compares inode numbers so is fairly efficient. Alternatively, before each backup create a file outside the backup tree to note the time, touch timestamp. Then before a new backup, create a new timestamp, touch timestamp.new, and ...


0

In BSD check the watch command. Otherwise please check the following example using strace (where 7214 is your PID): strace -e trace=write -s1000 -fp 7214 2>&1 \ | grep --line-buffered -o '".\+[^"]"' \ | grep --line-buffered -o '[^"]\+[^"]' \ | while read -r line; do printf "%b" $line; done For further explanation or more examples, check: How to ...


4

You should write your own little shell script for that. For example, "myrsync" in your PATH holding: #!/bin/bash ok(){ if [ -t 0 ] && read -p "ok? $* ? " reply && [ "$reply" = y -o "$reply" = ok ] then "$@" fi } if [ -f .myrsync ] then ok rsync $(<.myrsync) else echo "no .myrsync here in $PWD" fi This has a function ...


2

[expanded from my comment to the OP]. Create on the repo a directory flat which holds a copy of all the files, but in one flat list. The copies would be hard links, so take no space. Do the same on the local machine. You can then rsync from the local flat directory to the remote flat directory. This will update all the remote files as rsync preserves remote ...


0

You definitely can use rsync with a changing directory structure and there are some interesting options you might not be aware of, in particular -H which preserves hard links. I'll describe my own scenario. This may or may not work for you, but I hope you at least find it interesting. SCENARIO: You have a large directory with lots of files in a directory ...


0

I think that's a job for Unison ! I haven't played with it for years, but I think it could do exactly what you're asking for... The home page says: Unison is a file-synchronization tool for OSX, Unix, and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), ...


2

Use single quotes around it, that will prevent the shell from expanding it, and the string will be processed intact on the other side ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /home/backupboy/.ssh/id_rsa user@server.com '[[ $(ls -1 /mnt/dir | wc -l) -gt 4 ]] && rm /mnt/dir/*' If you want to use some local variables and ...


2

I think rsync is the wrong tool, as are find and mv. My recommendation is instead to make use of a software configuration management system. These include Subversion, Git, Mercurial, Bazaar among others. All of which can easily handle changes of tree structure. In the structure you describe, you have tree structure A on your client system and a repository ...


0

People here have mentioned using the --partial flag works, it needs to be mentioned however that it only resumes when the --append or --append-verify flag is used when resuming. --partial creates a hidden file of the file that has not finished the sync process, the file is kept when you interrupt syncing. It continues to complete the file when you use ...



Top 50 recent answers are included