On 15 September 2015 at 13:38, Kai Krakow <hurikhan77@xxxxxxxxx> wrote: > Marc O'Morain <marc@xxxxxxxxxxxx> 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. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
