public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Avi Kivity <avi@qumranet.com>
Cc: KVM list <kvm@vger.kernel.org>
Subject: Re: 63 sectors
Date: Wed, 03 Sep 2008 09:15:40 -0700	[thread overview]
Message-ID: <48BEB82C.2090105@zytor.com> (raw)
In-Reply-To: <48BE46DD.1070703@qumranet.com>

Avi Kivity wrote:
> 
> That setting has some unfortunate side effects.  Partitioning tools will 
> locate the first partition at the second cylinder, which is at the 63rd 
> sector.  This means that if the guest uses a 4K block filesystem on the 
> first partition (an incredibly common occurance), then every single 
> access will not be 4K aligned with respect to the virtual block device.  
> This will cause fragmentation and read/modify/write cycles with:
> 
> - qcow2 (which uses aligned 4K blocks)
> - any host filesystem which uses 4K blocks
> - any host disk which uses 4K blocks (not yet common)
> 
> I can think of a few workarounds, all bad:
> - add a partitioning tool (or option to qemu-img) to format the disk, 
> placing the first partition on the fourth cylinder, aligning it.  tell 
> the users not to wipe the disks out but instead install to one of the 
> existing parititions
> - add a tool to optimize an existing disk by extending it and moving the 
> partitions around so they are aligned.  may break boot loaders.
> - make qcow4 use 512 byte sectors.  will increase overhead and doesn't 
> solve problems on the host filesystem and disk.
> - have qcow51 detect misaligned accesses and adjust itself somehow.  
> doesn't help raw and other formats.  likely very difficult.
> 
> Does anybody know if scsi will have the same problems?  Can anyone 
> suggest other workarounds?
> 

This is not just limited to KVM.  The right thing is for partitioning 
tools to realize that this isn't 1981 and actually align partitions to 
block boundaries.  Windows Vista aligns partitions to megabyte 
boundaries; I personally think that is somewhat excessive, but aligning 
partitions to 128K (or possibly 64K) would be better.

This idiotic default damages virtualizers, flash drives, hardware RAID, 
and pretty soon spinning media as well.

	-hpa

  parent reply	other threads:[~2008-09-03 16:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-03  8:12 63 sectors Avi Kivity
2008-09-03  8:35 ` David Mair
2008-09-03  9:32   ` Avi Kivity
2008-09-03 11:26 ` Gerd Hoffmann
2008-09-04  8:49   ` Gerd Hoffmann
2008-09-03 16:15 ` H. Peter Anvin [this message]
2008-09-04  3:20 ` Liu Yu-B13201
2008-09-04  3:33   ` H. Peter Anvin
2008-09-04  3:39     ` Liu Yu-B13201
2008-09-04  3:56       ` H. Peter Anvin
2008-09-04  7:47         ` Itamar Heim
2008-09-07  8:20           ` Avi Kivity
2008-09-04  8:58 ` Ian Kirk
2008-09-04 11:15   ` Laurent Vivier
2008-09-04 12:18   ` H. Peter Anvin
2008-09-04 13:56     ` H. Peter Anvin
2008-09-04 17:56   ` Charles Duffy

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=48BEB82C.2090105@zytor.com \
    --to=hpa@zytor.com \
    --cc=avi@qumranet.com \
    --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