[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BTRFS file clone support for cp
From: |
Pádraig Brady |
Subject: |
Re: BTRFS file clone support for cp |
Date: |
Tue, 28 Jul 2009 00:40:14 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Giuseppe Scrivano wrote:
> Jim Meyering <address@hidden> writes:
>
>>> Another possible issue with this I can think of is
>>> depending on the modification pattern of the COW files,
>>> the modification processes could fragment the file or
>>> more seriously be given ENOSPC errors.
>> I hope btrfs takes care of this behind the scene.
>>
>> How does the clone work wrt to space consumed, a la df?
>> If copying a 1GB file this way does not update usage
>> stats to reflect the additional 1GB of space used, ...
>
> I tried to clone a big file and df reported a different "used blocks"
> stat that it was before the clone operation.
How different exactly?
OK I tried this myself on F11 with inconclusive results.
$ uname -r
2.6.29.6-213.fc11.i586
$ sudo yum install btrfs-progs
# dd bs=1M count=300 if=/dev/zero of=/btrfs.img #min size?
# mkfs.btrfs /btrfs.img
# mkdir /btrfs
# mount -o loop /btrfs.img /btrfs
# cd /btrfs
# dd bs=1M count=100 if=/dev/zero of=alloc.test
# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 300M 28K 300M 1% /btrfs
# df -h . #only allocated about 30s later
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 300M 101M 200M 34% /btrfs
# /home/padraig/clone_file alloc.test alloc.test.clone
# umount /btrfs
# mount -o loop /btrfs.img /btrfs
# cd btrfs
# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 300M 101M 200M 34% /btrfs
OK the above suggests that the clone doesn't take
any space as I would expect. Then it starts getting confusing...
# du -h *
100M alloc.test
244M alloc.test.clone #wha?
# dd bs=1M count=200 if=/dev/zero of=use.space
dd: writing `use.space': No space left on device
101+0 records in
100+0 records out
# ls -l
total 454656
-rw-r--r-- 1 root root 104857600 2009-07-28 00:06 alloc.test
-rw-r--r-- 1 root root 104857600 2009-07-28 00:07 alloc.test.clone
-rw-r--r-- 1 root root 104857600 2009-07-28 00:18 use.space
# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 300M 184M 117M 62% /btrfs
The above suggests that the clone does actually allocate space
but btrfs isn't reporting it through statvfs correctly?
If the clone does allocate space, then how can one
clone without allocation which could be very useful
for snapshotting for example?
Also I tried the above twice and both times got:
http://www.kerneloops.org/submitresult.php?number=578993
cheers,
Pádraig.
- Re: BTRFS file clone support for cp, (continued)
- Re: BTRFS file clone support for cp, Jim Meyering, 2009/07/26
- Re: BTRFS file clone support for cp, Giuseppe Scrivano, 2009/07/26
- Re: BTRFS file clone support for cp, Jim Meyering, 2009/07/27
- Re: BTRFS file clone support for cp, Andreas Schwab, 2009/07/27
- Re: BTRFS file clone support for cp, Jim Meyering, 2009/07/28
- Re: BTRFS file clone support for cp, Jim Meyering, 2009/07/29
- Re: BTRFS file clone support for cp, Jim Meyering, 2009/07/29
Re: BTRFS file clone support for cp, Pádraig Brady, 2009/07/26
- Re: BTRFS file clone support for cp, Jim Meyering, 2009/07/27
- Re: BTRFS file clone support for cp, Giuseppe Scrivano, 2009/07/27
- Re: BTRFS file clone support for cp,
Pádraig Brady <=
- Re: BTRFS file clone support for cp, Giuseppe Scrivano, 2009/07/28
- Re: BTRFS file clone support for cp, Chris Mason, 2009/07/29
- Re: BTRFS file clone support for cp, Pádraig Brady, 2009/07/29
- Re: BTRFS file clone support for cp, Chris Mason, 2009/07/29
- Re: BTRFS file clone support for cp, Pádraig Brady, 2009/07/29
- Re: BTRFS file clone support for cp, Joel Becker, 2009/07/30
- Re: BTRFS file clone support for cp, Jim Meyering, 2009/07/30
- Re: BTRFS file clone support for cp, Joel Becker, 2009/07/30
- Re: BTRFS file clone support for cp, Pádraig Brady, 2009/07/30
- Re: BTRFS file clone support for cp, Ric Wheeler, 2009/07/30