LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-28-2019, 11:39 PM   #1
betajuice
LQ Newbie
 
Registered: Jul 2019
Posts: 2

Rep: Reputation: Disabled
Rsync failure? Strange deletion happened today.


I have a code project I was working on all day, and wanted to back up the project directory to an external hard drive. I reviewed the rsync manual page to make sure I had the options and source/destination correct. After executing rsync, my project directory was empty, and so was the intended destination. The command history below tells the full story, (ALMOST exactly as shown but I have only modified local username for privacy):

Details:
OS: Ubuntu 18.04.2 LTS
External HDD: WD Elements WDBPCK0010BBK 1TB usb 3.0
Starting directory: /home/bob/code/pgf

Code:
> ls -l /media/bob/Elements/code/Cpp/
> mkdir /media/bob/Elements/code/Cpp/pgf
> ls -l /media/bob/Elements/code/Cpp/
> man rsync
> cd ..
> rsync -rlptg pgf/ /media/bob/Elements/code/Cpp/pgf/
> ls -la /media/bob/Elements/code/Cpp/pgf/
> ls pgf
> ls
> ls -l pgf
> cd pgf
> ls
> man rsync
> ls
> ls
> ls -la
As you can see I was using ls frequently after the rsync command in disbelief that my files and sub-folders were gone.

Does anyone know what went wrong? My project is gone it seems and I have no idea how.
 
Old 07-29-2019, 09:04 AM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 3,606

Rep: Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617Reputation: 1617
1. I note you did not run any command to show us your current directory during the command run.
2. Runnig an rsyn from a folder onto itself is not recommended, and I cannot confirm from the information provided that this did not occur.
3. The options
Quote:
rsync -av
would be a more secure and correct way to implement your options.
4. I note you did not include anything like to -del option or from that family of options, so nothing SHOULD have been deleted.
5. Copying to a new directory, why were you using rsync? IT is a wonderful tool for syncing, but there are faster ways to get that initial copy.
6. I would almost ALWAYS (a) include the -v option for verbose output, and (b) use full path names for safety and clarity when running rsync.
 
1 members found this post helpful.
Old 07-29-2019, 02:01 PM   #3
betajuice
LQ Newbie
 
Registered: Jul 2019
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by wpeckham View Post
1. I note you did not run any command to show us your current directory during the command run.
2. Runnig an rsyn from a folder onto itself is not recommended, and I cannot confirm from the information provided that this did not occur.
3. The options would be a more secure and correct way to implement your options.
4. I note you did not include anything like to -del option or from that family of options, so nothing SHOULD have been deleted.
5. Copying to a new directory, why were you using rsync? IT is a wonderful tool for syncing, but there are faster ways to get that initial copy.
6. I would almost ALWAYS (a) include the -v option for verbose output, and (b) use full path names for safety and clarity when running rsync.
1: At the time I was just running rsync, I wanted to paste the exact commands I ran in order, and in the beginning of my post I mentioned I was in the ~/code/pgf folder
2: Not sure what you mean? I ran rsync outside the source folder (see command #5, "cd .."), and to an external HDD directory.
3: ?
4: Right, which is why I'm confused.
5: Would cp have been a better command?
6: I will be sure to do this from now on (IF I ever use rsync again).

Thanks.
 
Old 07-29-2019, 09:25 PM   #4
quickbreakfast
Member
 
Registered: Oct 2015
Posts: 206

Rep: Reputation: Disabled
Quote:
Originally Posted by betajuice View Post
Code:
> rsync -rlptg pgf/ /media/bob/Elements/code/Cpp/pgf/
> ls -la /media/bob/Elements/code/Cpp/pgf/
> ls pgf
Does anyone know what went wrong? My project is gone it seems and I have no idea how.
My guess is that you are missing the / at the beginning of the source of the command.

try
Code:
ls /pgf
and

Code:
rsync -rvlptg --update /home/bob/code/pgf/ /media/bob/Elements/code/Cpp/pgf
How big is the folder (100G or 1T?) and how long did it take?

The --update "switch" tells the computer to only deal with files that have appeared/ changed since last update, so will save heaps of time when next you do an upate of your back up.

Last edited by quickbreakfast; 07-29-2019 at 09:29 PM. Reason: remove the last slash
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] rsync IO error encountered - skipping file deletion, how to tell where error is? anon091 Linux - General 1 06-12-2013 02:55 PM
RSync without deletion nidhoegger Linux - Server 2 02-16-2010 07:49 AM
rsync error: IO error encountered - skipping file deletion lwainscott Linux - General 1 08-21-2009 01:15 PM
LXer: What happened to fire on Linux Today? LXer Syndicated Linux News 0 02-25-2006 05:31 PM
Odd thing happened in YOU today iain.ross SUSE / openSUSE 3 01-30-2005 09:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration