Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Stephane CHAZELAS <stephane_chazelas@yahoo.fr>
To: kvm@vger.kernel.org
Subject: Re: Convert one .img disk created with sparse=true to no sparse
Date: Thu, 20 Oct 2011 14:56:40 +0000 (UTC)	[thread overview]
Message-ID: <slrnja0dl8.h81.stephane.chazelas@spam.is.invalid> (raw)
In-Reply-To: CA+JKwSWrdLPreN=MLBNAXmyw=YSFqO2gTQz3ypa=h3VVpkrj2A@mail.gmail.com

2011-10-20, 13:21(+02), Gonzalo Marcote Peña:
> I have one guest that I created with virt-install comand option 'sparse=true'.
> As i want to use now this guest for I/O tasks (DDBB) and i want to
> improve performance, I want to convert the disk.img from sparse to no
> sparse (obviusly without format it).
> How can I do this task without loosinf the disk image data?.
> Thank you.
[...]

You'll have to make a separate copy anyway as your aim is to
have all the data contiguous on disk.

If it's a raw image.

cat < old.img > new.img

cp --sparse=never old.img new.img

Or you can use qemu-img convert.

Or you could use a LVM volume instead of file. This way, you
have more control on which sectors are allocated and can force
them to be contiguous.

On extent based FS (ext4, btrfs...), there might be a way to
guarantee as few extents as possible, but I don't know it.

-- 
Stephane


  parent reply	other threads:[~2011-10-20 15:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 11:21 Convert one .img disk created with sparse=true to no sparse Gonzalo Marcote Peña
2011-10-20 14:43 ` Stefan Hajnoczi
2011-10-20 21:28   ` Simon Wilson
2011-10-21 10:24     ` Stephane CHAZELAS
2011-10-21 11:20     ` Gonzalo Marcote Peña
2011-10-20 14:56 ` Stephane CHAZELAS [this message]
2011-10-20 15:57   ` Stephane CHAZELAS

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=slrnja0dl8.h81.stephane.chazelas@spam.is.invalid \
    --to=stephane_chazelas@yahoo.fr \
    --cc=kvm@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