# rsync problem



## z662 (Dec 2, 2009)

Hello,

Today I plugged in my usb backup hdd and wanted to copy some files to my webserver.  I was in my home directory and ran the following command:  

`sudo rsync -a /media/backupHDD/backupFiles backupFiles`

However the problem was that /home/z662/backupFiles did not exist ( I assumed it would create it) but it did not, and now when I run df -ah I can see that all 160gb worth of files did copy over, (no rsync errors either) yet I can not access these files, and there is no directory containing them.  How can I either access these files, or delete them so that I can create the directory and run rsync again?  THanks


----------



## pprocacci (Dec 2, 2009)

I tried dulicating your problem, but do not have a concrete answer for you.  I would ensure you were in the right directory.  Placed somewhere else by mistake maybe?


----------



## z662 (Dec 2, 2009)

I wish that was the case, however I am certain I was in my home dir.  Is this a potential bug with rsync?  I can provide the version number if that would help.


----------



## DutchDaemon (Dec 2, 2009)

rsync _will_ create the (new) directory in the directory where you started the rsync command. There are no two ways about it. If your rsync run completed without any errors, you must have a 'backupFiles' directory somewhere on your disk. Search for it with [cmd=]find / -type d -name backupFiles[/cmd].


----------



## Pushrod (Dec 2, 2009)

Wouldn't it be in the home directory of the user he sudo'd to (root) ?


----------



## pprocacci (Dec 2, 2009)

sudo doesn't change your directory.

```
nat# cd /tmp
nat# sudo pwd
/tmp
```


----------



## phoenix (Dec 2, 2009)

z662 said:
			
		

> Today I plugged in my usb backup hdd and wanted to copy some files to my webserver.  I was in my home directory and ran the following command:
> 
> `sudo rsync -a /media/backupHDD/backupFiles backupFiles`



A few things:

You should always use *--hard-links* and *--numeric-ids* when running rsync on FreeBSD, especially if it's between systems.  To/from a backup HD you may be able to get away without the --numeric-ids, but I wouldn't trust it.  And you definitely don't want to do it without --hard-links, or your backups will be several times the size of the actual data being backed up (if doing a system backup, a plain data backup may not be affected by this).
You should *always* list the full paths to where you are copying from and where you are copying to, and always add */* to the end to tell rsync to include the directory itself.
Adding --verbose is very useful in situations like this, as you can see what files are being copied and to where.

You can run a find command starting at / with one of the time options to find files created in the past 24 hours.  That will show you all your files, and where they are.  See the find() man page for details on the syntax.


----------



## z662 (Dec 2, 2009)

Yes I thought it would create the directory as well, however that find command (along with du -s * | sort -g) produce no information that helps.  My box is also responding extremely slow, and that bothers me.  I decided now would be an excellent time to upgrade to 8.0 and remember to use absolute paths from now on (I only backup 1 master directory with all my files in it, and never do system backups with rsync so I think I can get away without using hardlinks and numeric id's) I appreciate everyones input!


----------

