Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Jim Salter <jim@jrs-s.net>
To: GEO <1g2e3o4@gmail.com>, linux-btrfs@vger.kernel.org
Subject: Re: BTRFS send: exclude directories
Date: Sun, 16 Feb 2014 15:44:36 -0500	[thread overview]
Message-ID: <53012334.3070300@jrs-s.net> (raw)
In-Reply-To: <11335246.MGjIN0NiaF@linuxpc>

Simplest way to do it is to make the directories that you don't want to 
replicate be separate subvolumes. I do this to keep from replicating 
copies of snapshot directories.

Example:

mv /home/GEO/.cache /home/GEO/.cache.tmp
btrfs sub create /home/GEO/.cache
cp -a --reflink=always /home/GEO/.cache.tmp/ /home/GEO/.cache/
cp -a --reflink=always /home/GEO/.cache.tmp/.* /home/GEO/.cache/
rm -rf /home/GEO/.cache.tmp

You could also just mv the files instead of first doing cp and then 
rm'ing them, but if you have many gigs of files, the cp --reflink=always 
will be a win - currently (at least, last I checked) mv across 
subvolumes would actually do a full copy, whereas a cp --reflink=always 
will just create new pointers to the blocks in the appropriate place 
(thereby completing instantaneously).

Anyway, once .cache (or whatever) is a subvolume instead of a directory, 
it will no longer get replicated with your btrfs send command of its 
parent directory.

On 02/16/2014 03:07 PM, GEO wrote:
> Hi,
>
> I have been experimenting with btrfs send/receive for incremental backups, but
> could not figure out how to exclude certain directories from
> subvolumes/snapshots. For example, I want to backup my data in home, but I am
> not interested in backing up hidden directories like .cache too.
> Is it currently possible to achieve something like that?
>
> Thanks for the great work!
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


      parent reply	other threads:[~2014-02-16 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-16 20:07 BTRFS send: exclude directories GEO
2014-02-16 20:32 ` WorMzy Tykashi
2014-02-16 20:44 ` Jim Salter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53012334.3070300@jrs-s.net \
    --to=jim@jrs-s.net \
    --cc=1g2e3o4@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox