All of lore.kernel.org
 help / color / mirror / Atom feed
* Shrinking virtual disk with btrfs on it
@ 2011-01-21 17:20 Rodney Beede
  2011-01-21 17:34 ` Hugo Mills
  2011-01-21 19:43 ` David Pottage
  0 siblings, 2 replies; 5+ messages in thread
From: Rodney Beede @ 2011-01-21 17:20 UTC (permalink / raw)
  To: linux-btrfs

Any tools to go about zeroing about the free space on a btrfs file
system so I can shrink the VMware vmdk virtual disk?

I ran the VMware command, but the dynamic disk is still really big.  I
presume it is due to free space that isn't zeroed out.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Shrinking virtual disk with btrfs on it
  2011-01-21 17:20 Shrinking virtual disk with btrfs on it Rodney Beede
@ 2011-01-21 17:34 ` Hugo Mills
  2011-01-22 18:27   ` Rodney Beede
  2011-01-21 19:43 ` David Pottage
  1 sibling, 1 reply; 5+ messages in thread
From: Hugo Mills @ 2011-01-21 17:34 UTC (permalink / raw)
  To: Rodney Beede; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

On Fri, Jan 21, 2011 at 10:20:34AM -0700, Rodney Beede wrote:
> Any tools to go about zeroing about the free space on a btrfs file
> system so I can shrink the VMware vmdk virtual disk?
> 
> I ran the VMware command, but the dynamic disk is still really big.  I
> presume it is due to free space that isn't zeroed out.

   One solution I've used before is to write a single very large file
full of zeroes, filling the filesystem, then delete it.

$ dd if=/dev/zero of=/mountpoint/foo.dat && rm /mountpoint/foo.dat

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
          --- ...  one ping(1) to rule them all, and in the ---          
                         darkness bind(2) them.                          

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Shrinking virtual disk with btrfs on it
  2011-01-21 17:20 Shrinking virtual disk with btrfs on it Rodney Beede
  2011-01-21 17:34 ` Hugo Mills
@ 2011-01-21 19:43 ` David Pottage
  2011-01-22  8:28   ` Tomasz Torcz
  1 sibling, 1 reply; 5+ messages in thread
From: David Pottage @ 2011-01-21 19:43 UTC (permalink / raw)
  To: Rodney Beede, linux-btrfs

On 21/01/11 17:20, Rodney Beede wrote:
> Any tools to go about zeroing about the free space on a btrfs file
> system so I can shrink the VMware vmdk virtual disk?
>
> I ran the VMware command, but the dynamic disk is still really big.  I
> presume it is due to free space that isn't zeroed out.
Does btrfs issue TRIM commands to the underlying (virtual) block device?

I guess not yet, as otherwise you would not see this problem, as your
virtual storage device should catch them and discard the corresponding
virtual storage blocks.

-- 
David Pottage


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Shrinking virtual disk with btrfs on it
  2011-01-21 19:43 ` David Pottage
@ 2011-01-22  8:28   ` Tomasz Torcz
  0 siblings, 0 replies; 5+ messages in thread
From: Tomasz Torcz @ 2011-01-22  8:28 UTC (permalink / raw)
  To: linux-btrfs

On Fri, Jan 21, 2011 at 07:43:47PM +0000, David Pottage wrote:
> On 21/01/11 17:20, Rodney Beede wrote:
> > Any tools to go about zeroing about the free space on a btrfs file
> > system so I can shrink the VMware vmdk virtual disk?
> >
> > I ran the VMware command, but the dynamic disk is still really big.  I
> > presume it is due to free space that isn't zeroed out.
> Does btrfs issue TRIM commands to the underlying (virtual) block device?

  It does when mounted with - o discard.  IIRC, btrfs also supports
FITRIM ioctl (but I'm not 100% sure about this).
 
-- 
Tomasz Torcz               RIP is irrevelant. Spoofing is futile.
xmpp: zdzichubg@chrome.pl     Your routes will be aggreggated. -- Alex Yuriev


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Shrinking virtual disk with btrfs on it
  2011-01-21 17:34 ` Hugo Mills
@ 2011-01-22 18:27   ` Rodney Beede
  0 siblings, 0 replies; 5+ messages in thread
From: Rodney Beede @ 2011-01-22 18:27 UTC (permalink / raw)
  To: linux-btrfs

On Fri, Jan 21, 2011 at 10:34 AM, Hugo Mills <hugo-lkml@carfax.org.uk> =
wrote:
> On Fri, Jan 21, 2011 at 10:20:34AM -0700, Rodney Beede wrote:
>> Any tools to go about zeroing about the free space on a btrfs file
>> system so I can shrink the VMware vmdk virtual disk?
>>
>> I ran the VMware command, but the dynamic disk is still really big. =
=C2=A0I
>> presume it is due to free space that isn't zeroed out.
>
> =C2=A0 One solution I've used before is to write a single very large =
file
> full of zeroes, filling the filesystem, then delete it.
>
> $ dd if=3D/dev/zero of=3D/mountpoint/foo.dat && rm /mountpoint/foo.da=
t
>
> =C2=A0 Hugo.
>
> --
> =3D=3D=3D Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.=
org.uk =3D=3D=3D
> =C2=A0PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.=
org.uk
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--- ... =C2=A0one ping(1) to rule t=
hem all, and in the ---
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 darkness bind(2) them.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iD8DBQFNOcObIKyzvlFcI40RAodJAJ0VyXnvxNH2MxTZ08uT8WaywsA=ED=88=80=E9=BD=
=82=E4=95=BA
> 7MRCSpCsPWGiXeS73ItqnWA=3D
> =3Dngld
> -----END PGP SIGNATURE-----
>
>


I tried your method, and it made things worst.  The disk just expanded
to the maximum.  I deleted the zero filled file and made sure btrfs
compress was off.  I ran the VMware disk manage tool and told it to
defragment and shrink but it didn't get any smaller.  I think btrfs
just doesn't work that way.

I also tried btrfs filesystem defragment with no luck.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-22 18:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-21 17:20 Shrinking virtual disk with btrfs on it Rodney Beede
2011-01-21 17:34 ` Hugo Mills
2011-01-22 18:27   ` Rodney Beede
2011-01-21 19:43 ` David Pottage
2011-01-22  8:28   ` Tomasz Torcz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.