Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 03-23-2008, 06:06 AM   #1
LQ Newbie
Registered: Mar 2008
Location: Austria
Distribution: Debian & Ubuntu
Posts: 2

Rep: Reputation: 0
Question tool to sync files considering free space left on target

Hey all!

I'm in need of a command line tool much like rsync to do an exact copy of a specified folder. (Meaning all the files, that were deleted in the source folder shall also be deleted in the target folder)

I know this can be done using something like:
rsync -a --delete /source/folder /target/folder
However I'd prefer a slightly different behaviour:
Files should only be deleted if there is no space left on the target. With other words: Only as many files as necessary should be deleted. (It would be a great bonus if the files that were only deleted a short time ago in the source directory survive longest in the target directory)

I'd like to use this as a backup tool - So if a files gets deleted in the source directory there'd be at least a slight chance that it would still be there in the target directory.

Is there anything like that? (Is it probably just another rsync parameter I missed?)
Old 03-24-2008, 10:30 AM   #2
Senior Member
Registered: Mar 2004
Location: Wales, UK
Distribution: Debian, Ubuntu
Posts: 1,075

Rep: Reputation: 45
This probably isn't the right approach... How do you decide (or know later) exactly what is less important and can be safely thrown away? The value of a backup is really that it lets you be sure that you can get back multiple known previous versions on demand.

You can run commands to the remote machine over SSH in a script and then run rsync with flags based on the results if you need to fine-tune the sync, but I don't recommend that you use rsync cloning for data backup. rdiff-backup is a good command-line backup tool that is specifically designed to maintain multiple versions of your files in a space-efficient way.
Old 03-25-2008, 03:54 AM   #3
LQ Newbie
Registered: Mar 2008
Location: Austria
Distribution: Debian & Ubuntu
Posts: 2

Original Poster
Rep: Reputation: 0
Yeah - I guess, you're right...
I was already going to write a script myself, when I realized that this might not be good backup practice. People would start depending on the fact that there are backups even of the files they deleted the day before. But the truth is we just don't have enough hard disk space to assure this. So it's probably better to backup only existing files.
Thanks for your reply!


backup, rsync, synchronize

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
No space left on device even though it has free space? enine Linux - General 8 05-30-2007 04:22 PM
How to find how much free space left on my hard disk? DataSheet Linux - Newbie 5 01-06-2007 10:35 PM
Samba: 70 Gb free space, samba reports no space left? HansLuijten Linux - Networking 1 08-18-2004 04:40 PM
"no space left on device" - But df shows free space! monita Linux - General 7 03-30-2004 01:14 PM
How much free space left on a tape? bfloeagle Linux - General 0 08-07-2001 07:55 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:30 AM.

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