This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-users] Zero LVM

To: Jonathan Tripathy <jonnyt@xxxxxxxxxxx>
Subject: Re: [Xen-users] Zero LVM
From: Thomas Ronner <thomas@xxxxxxxxxx>
Date: Mon, 06 Dec 2010 18:04:43 +0100
Cc: Xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 06 Dec 2010 09:06:25 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4CFD14C1.3030709@xxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <4CFD0E36.7000201@xxxxxxxxxxx> <4CFD11CD.6010109@xxxxxxxxxx> <4CFD14C1.3030709@xxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20101027 Thunderbird/3.1.6
On 12/6/10 5:52 PM, Jonathan Tripathy wrote:
dd if=/dev/zero of=/dev/vg0/lvname bs=1M

Thanks for that!

I'm now getting No space left on device. I'm guessing I have to use a count parameter. What value would I set it at?

That's because it tries to write beyond the last block. Don't worry, that's normal if not specifying count, which works just fine. When scripting this I think it's best to use the count parameter to get a zero exit status. count is the amount of blocks. In this case, a block is 1M, so count is the total amount of megabytes of your lv. To know exactly how big your lv is, here an example from my machine:

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               vg
  PV Size               463.71 GB / not usable 3.00 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              118710
  Free PE               4552
  Allocated PE          114158
  PV UUID               gRkqNW-VDea-4LA4-mK1k-oBo0-ri1U-ZQOD2l

The PE size is 4096 kb. You can use this as your block size.

# lvdisplay /dev/vg/netbsd
  --- Logical volume ---
  LV Name                /dev/vg/netbsd
  VG Name                vg
  LV UUID                ypfOxB-MtCK-oZj9-v2OC-yekH-37t6-42X7dc
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.00 GB
  Current LE             2560
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:35

2560 LE's; this is the amount of blocks. So the complete command:

# dd if=/dev/zero of=/dev/vg/netbsd bs=4096K count=2560

Untested, because I don't want to hose my LV :-)


Xen-users mailing list

<Prev in Thread] Current Thread [Next in Thread>