* Intended destination for symlinks after subvolume snapshot
@ 2015-09-15 11:32 Marc O'Morain
2015-09-15 12:38 ` Kai Krakow
0 siblings, 1 reply; 3+ messages in thread
From: Marc O'Morain @ 2015-09-15 11:32 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dev
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)
Thanks,
Marc
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Intended destination for symlinks after subvolume snapshot
2015-09-15 11:32 Intended destination for symlinks after subvolume snapshot Marc O'Morain
@ 2015-09-15 12:38 ` Kai Krakow
2015-09-15 13:17 ` Marc O'Morain
0 siblings, 1 reply; 3+ messages in thread
From: Kai Krakow @ 2015-09-15 12:38 UTC (permalink / raw)
To: linux-btrfs
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Intended destination for symlinks after subvolume snapshot
2015-09-15 12:38 ` Kai Krakow
@ 2015-09-15 13:17 ` Marc O'Morain
0 siblings, 0 replies; 3+ messages in thread
From: Marc O'Morain @ 2015-09-15 13:17 UTC (permalink / raw)
To: linux-btrfs
On 15 September 2015 at 13:38, Kai Krakow <hurikhan77@gmail.com> wrote:
> 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).
Thanks Kai.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-15 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 11:32 Intended destination for symlinks after subvolume snapshot Marc O'Morain
2015-09-15 12:38 ` Kai Krakow
2015-09-15 13:17 ` Marc O'Morain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox