* behavior of BTRFS in relation to inodes when moving/copying files between filesystems
@ 2015-10-13 10:39 Martin Steigerwald
2015-10-31 11:11 ` Martin Steigerwald
0 siblings, 1 reply; 2+ messages in thread
From: Martin Steigerwald @ 2015-10-13 10:39 UTC (permalink / raw)
To: linux-btrfs; +Cc: Martin Steigerwald
Hi!
With BTRFS to XFS/Ext4 the inode number of the target file stays the same in
with both cp and mv case (/mnt/zeit is a freshly created XFS in this example):
merkaba:~> ls -li foo /mnt/zeit/moo
6609270 foo
99 /mnt/zeit/moo
merkaba:~> cp foo /mnt/zeit/moo
merkaba:~> ls -li foo /mnt/zeit/moo
6609270 8 foo
99 /mnt/zeit/moo
merkaba:~> cp -p foo /mnt/zeit/moo
merkaba:~> ls -li foo /mnt/zeit/moo
6609270 foo
99 /mnt/zeit/moo
merkaba:~> mv foo /mnt/zeit/moo
merkaba:~> ls -lid /mnt/zeit/moo
99 -rw-r--r-- 1 root root 6 Okt 13 12:28 /mnt/zeit/moo
With BTRFS as target filesystem however in the mv case I get a new inode:
merkaba:~> ls -li foo /home/moo
6609289 -rw-r--r-- 1 root root 6 Okt 13 12:34 foo
16476276 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
merkaba:~> cp foo /home/moo
merkaba:~> ls -li foo /home/moo
6609289 -rw-r--r-- 1 root root 6 Okt 13 12:34 foo
16476276 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
merkaba:~> cp -p foo /home/moo
merkaba:~> ls -li foo /home/moo
6609289 -rw-r--r-- 1 root root 6 Okt 13 12:34 foo
16476276 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
merkaba:~> mv foo /home/moo
merkaba:~> ls -li /home/moo
16476280 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
Is this intentional and/or somehow related to the copy on write specifics of
the filesystem?
I think even with COW it can just overwrite the existing file instead of
removing the old one and creating a new one – but it wouldn´t give much of a
benefit unless the target file is nocow.
(Also I thought only certain other utilities had supercow powers, but well
BTRFS seems to have them as well :)
Thanks,
--
Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: behavior of BTRFS in relation to inodes when moving/copying files between filesystems
2015-10-13 10:39 behavior of BTRFS in relation to inodes when moving/copying files between filesystems Martin Steigerwald
@ 2015-10-31 11:11 ` Martin Steigerwald
0 siblings, 0 replies; 2+ messages in thread
From: Martin Steigerwald @ 2015-10-31 11:11 UTC (permalink / raw)
To: linux-btrfs
Am Dienstag, 13. Oktober 2015, 12:39:12 CET schrieben Sie:
> Hi!
>
> With BTRFS to XFS/Ext4 the inode number of the target file stays the same in
> with both cp and mv case (/mnt/zeit is a freshly created XFS in this example):
>
> merkaba:~> ls -li foo /mnt/zeit/moo
> 6609270 foo
> 99 /mnt/zeit/moo
> merkaba:~> cp foo /mnt/zeit/moo
> merkaba:~> ls -li foo /mnt/zeit/moo
> 6609270 8 foo
> 99 /mnt/zeit/moo
> merkaba:~> cp -p foo /mnt/zeit/moo
> merkaba:~> ls -li foo /mnt/zeit/moo
> 6609270 foo
> 99 /mnt/zeit/moo
> merkaba:~> mv foo /mnt/zeit/moo
> merkaba:~> ls -lid /mnt/zeit/moo
> 99 -rw-r--r-- 1 root root 6 Okt 13 12:28 /mnt/zeit/moo
>
>
> With BTRFS as target filesystem however in the mv case I get a new inode:
>
> merkaba:~> ls -li foo /home/moo
> 6609289 -rw-r--r-- 1 root root 6 Okt 13 12:34 foo
> 16476276 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
> merkaba:~> cp foo /home/moo
> merkaba:~> ls -li foo /home/moo
> 6609289 -rw-r--r-- 1 root root 6 Okt 13 12:34 foo
> 16476276 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
> merkaba:~> cp -p foo /home/moo
> merkaba:~> ls -li foo /home/moo
> 6609289 -rw-r--r-- 1 root root 6 Okt 13 12:34 foo
> 16476276 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
> merkaba:~> mv foo /home/moo
> merkaba:~> ls -li /home/moo
> 16476280 -rw-r--r-- 1 root root 6 Okt 13 12:34 /home/moo
>
>
> Is this intentional and/or somehow related to the copy on write specifics of
> the filesystem?
>
> I think even with COW it can just overwrite the existing file instead of
> removing the old one and creating a new one – but it wouldn´t give much of a
> benefit unless the target file is nocow.
>
> (Also I thought only certain other utilities had supercow powers, but well
> BTRFS seems to have them as well :)
Anyone any idea?
Thanks,
--
Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-31 11:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 10:39 behavior of BTRFS in relation to inodes when moving/copying files between filesystems Martin Steigerwald
2015-10-31 11:11 ` Martin Steigerwald
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).