Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Kai Krakow <hurikhan77@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: Intended destination for symlinks after subvolume snapshot
Date: Tue, 15 Sep 2015 14:38:57 +0200	[thread overview]
Message-ID: <24glcc-3fb.ln1@hurikhan77.spdns.de> (raw)
In-Reply-To: CAFQJxq57ZOsMy0TFpqSMNwtRaQcVp5x+gV69P-=mxL=mHD7sig@mail.gmail.com

Marc O'Morain <marc@circleci.com> schrieb:

> Hi all,
> 
> What is the intended destination of a symlink inside a subvolume after
> a snapshot?
> 
> When I take a snapshot of a subvolume that contains a symlink, the
> symlink points outside the snapshot and into the original subvolume.
> 
> Is this the intended behaviour? Or should the symlinks be patched up
> to point inside the snapshot?
> 
> Here is an example that creates a new subvolume, a file and a symlink
> to the file. It then creates a snapshot and shows the destination of
> the symlink.
> 
> root@vagrant-ubuntu-trusty-64:/mnt/btrfs# mount | grep btrfs
> /dev/loop0 on /mnt/btrfs type btrfs (rw)
> root@vagrant-ubuntu-trusty-64:/mnt/btrfs# btrfs subvolume create
> subvolume0 Create subvolume './subvolume0'
> root@vagrant-ubuntu-trusty-64:/mnt/btrfs# touch subvolume0/readme.txt
> root@vagrant-ubuntu-trusty-64:/mnt/btrfs# ln -s
> /mnt/btrfs/subvolume0/readme.txt /mnt/btrfs/subvolume0/readme.lnk
> root@vagrant-ubuntu-trusty-64:/mnt/btrfs# btrfs subvolume snapshot -r
> subvolume0 snapshot0
> Create a readonly snapshot of 'subvolume0' in './snapshot0'
> root@vagrant-ubuntu-trusty-64:/mnt/btrfs# tree
> .
> ├── snapshot0
> │   ├── readme.lnk -> /mnt/btrfs/subvolume0/readme.txt
> │   └── readme.txt
> └── subvolume0
>     ├── readme.lnk -> /mnt/btrfs/subvolume0/readme.txt
>     └── readme.txt
> 
> 2 directories, 4 files
> 
> (I was expecting snapshot0/reame.lnk to point to
> /mnt/btrfs/snapshot0/readme.txt)

If you use absolute symlinks this is intended behaviour and probably has its 
use cases (similar to when you move subdirectories or create a copy, 
symlinks aren't rewritten either).

You should use relative symlinks for your use case (this means, do not start 
with "/", instead walk up with ".." if needed).

-- 
Replies to list only preferred.


  reply	other threads:[~2015-09-15 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 11:32 Intended destination for symlinks after subvolume snapshot Marc O'Morain
2015-09-15 12:38 ` Kai Krakow [this message]
2015-09-15 13:17   ` Marc O'Morain

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=24glcc-3fb.ln1@hurikhan77.spdns.de \
    --to=hurikhan77@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