[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Zero LVM



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 :-)


Thomas.

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.