Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

[Solved]LVM2 and XFS - zero unused blocks

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
lyallp
Veteran
Veteran
User avatar
Posts: 1655
Joined: Thu Jul 15, 2004 12:07 am
Location: Adelaide/Australia
Contact:
Contact lyallp
Website

[Solved]LVM2 and XFS - zero unused blocks

  • Quote

Post by lyallp » Sat May 16, 2009 7:20 am

Anyone know of a tool whereby I can zero unused blocks on XFS filesystems?

I am running XFS natively on root and /boot but all my other filesystems are within LVM2.

The reason I want it is that I am building a Gentoo Virtual Machine in VirtualBox and want to, eventually, be able to compact the Virtual Disk.
Initially, I would compact with cp --sparse=always, but when VirtualBox fixes it's compact code (apparently, it's broken in 2.2.2) , I would use that.

Any assistance is greatly appreciated.
Last edited by lyallp on Tue Jan 04, 2011 12:44 pm, edited 1 time in total.
...Lyall
Top
forkbomb
Tux's lil' helper
Tux's lil' helper
Posts: 115
Joined: Wed Apr 22, 2009 11:37 pm

  • Quote

Post by forkbomb » Mon May 18, 2009 1:48 pm

I've heard of people zeroing or erasing unused space with dd using various special /dev nodes (/dev/random, /dev/urandom, etc).
dd if=/dev/zero of=/my.output.file && rm /my.output.file
It'll run out of space eventually and then be removed.

Or am I reading the question wrong?

EDIT:
Might also want to run sync after the outfile has run out of space and before you remove it.

Here's somebody doing something similar with VMware images:
http://h0bbel.p0ggel.org/shrinking-vmdk-files
Top
lyallp
Veteran
Veteran
User avatar
Posts: 1655
Joined: Thu Jul 15, 2004 12:07 am
Location: Adelaide/Australia
Contact:
Contact lyallp
Website

  • Quote

Post by lyallp » Tue May 19, 2009 10:54 am

You read my question quite accurately.
Yes, this will work but I was hoping there may be the XFS equivilent of Microsofts 'sdel' command, which has a 'clear unused space' option.
This may do the job, so long as VirtualBox does not allocate space if zeros are written to it, otherwise, I can expect my disk to fully expand out, prior to me shrinking it.

Thanks.
...Lyall
Top
lyallp
Veteran
Veteran
User avatar
Posts: 1655
Joined: Thu Jul 15, 2004 12:07 am
Location: Adelaide/Australia
Contact:
Contact lyallp
Website

  • Quote

Post by lyallp » Tue Nov 23, 2010 4:12 am

FYI: VirtualBox did not extend the vdi storage when I filled up each of my file systems in the VM.
Subsequent

Code: Select all

VBoxManage modifyhd --compact DISK-GUID
compacted my disks by around 15% (about 1G off of a 7G image).
...Lyall
Top
forkbomb
Tux's lil' helper
Tux's lil' helper
Posts: 115
Joined: Wed Apr 22, 2009 11:37 pm

  • Quote

Post by forkbomb » Tue Nov 23, 2010 4:16 am

lyallp wrote:FYI: VirtualBox did not extend the vdi storage when I filled up each of my file systems in the VM.
Subsequent

Code: Select all

VBoxManage modifyhd --compact DISK-GUID
compacted my disks by around 15% (about 1G off of a 7G image).
Good to know for future reference. Thanks for the necrobump. ;)
Top
Shining Arcanine
Veteran
Veteran
Posts: 1110
Joined: Thu Sep 24, 2009 9:08 pm

  • Quote

Post by Shining Arcanine » Tue Nov 23, 2010 6:05 am

forkbomb wrote:I've heard of people zeroing or erasing unused space with dd using various special /dev nodes (/dev/random, /dev/urandom, etc).
dd if=/dev/zero of=/my.output.file && rm /my.output.file
It'll run out of space eventually and then be removed.

Or am I reading the question wrong?

EDIT:
Might also want to run sync after the outfile has run out of space and before you remove it.

Here's somebody doing something similar with VMware images:
http://h0bbel.p0ggel.org/shrinking-vmdk-files
The meta data involved in doing that will not be zeroed, but that is probably good enough.
Top
kernelOfTruth
Watchman
Watchman
User avatar
Posts: 6111
Joined: Tue Dec 20, 2005 10:34 pm
Location: Vienna, Austria; Germany; hello world :)
Contact:
Contact kernelOfTruth
Website

  • Quote

Post by kernelOfTruth » Sat Nov 27, 2010 7:27 pm

lyallp wrote:FYI: VirtualBox did not extend the vdi storage when I filled up each of my file systems in the VM.
Subsequent

Code: Select all

VBoxManage modifyhd --compact DISK-GUID
compacted my disks by around 15% (about 1G off of a 7G image).
nice find !

thanks ! :)
https://github.com/kernelOfTruth/ZFS-fo ... scCD-4.9.0
https://github.com/kernelOfTruth/pulsea ... zer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Top
Post Reply

7 posts • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy