Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Mike Power <dodtsair@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: copy on write misconception
Date: Fri, 22 Feb 2013 09:11:28 -0800	[thread overview]
Message-ID: <5127A6C0.6080104@alumni.calpoly.edu> (raw)

I think I have a misconception of what copy on write in btrfs means for 
individual files.

I had originally thought that I could create a large file:
time dd if=/dev/zero of=10G bs=1G count=10
10+0 records in
10+0 records out
10737418240 bytes (11 GB) copied, 100.071 s, 107 MB/s

real    1m41.082s
user    0m0.000s
sys    0m7.792s

Then if I copied this file no blocks would be copied until they are 
written.  Hence the two files would use the same blocks underneath. But 
specifically that copy would be fast.  Since it would only need to write 
some metadata.  But when I copy the file:
time cp 10G 10G2

real    3m38.790s
user    0m0.124s
sys    0m10.709s

Oddly enough it actually takes longer then the initial file creation.  
So I am guessing that the long duration copy of the file is expected and 
that is not one of the virtues of btrfs copy on write.  Does that sound 
right?

I was looking at a virtual machine solution and thought btrfs would be 
great if I could copy the vm disk to a new file at low cost and then 
launch that vm and customize it to my needs.

OS Ubuntu 12.10

Mike Power

             reply	other threads:[~2013-02-22 17:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-22 17:11 Mike Power [this message]
2013-02-22 17:16 ` copy on write misconception Hugo Mills
2013-02-22 17:41   ` Mike Power
2013-02-22 18:35     ` cwillu
2013-02-23 18:30       ` Mike Power
2013-02-22 17:24 ` cwillu

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=5127A6C0.6080104@alumni.calpoly.edu \
    --to=dodtsair@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