Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved]LVM2 and XFS - zero unused blocks
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1400
Location: Adelaide/Australia

PostPosted: Sat May 16, 2009 7:20 am    Post subject: [Solved]LVM2 and XFS - zero unused blocks Reply with quote

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.
_________________
...Lyall


Last edited by lyallp on Tue Jan 04, 2011 12:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
forkbomb
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2009
Posts: 115

PostPosted: Mon May 18, 2009 1:48 pm    Post subject: Reply with quote

I've heard of people zeroing or erasing unused space with dd using various special /dev nodes (/dev/random, /dev/urandom, etc).

Quote:
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
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1400
Location: Adelaide/Australia

PostPosted: Tue May 19, 2009 10:54 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1400
Location: Adelaide/Australia

PostPosted: Tue Nov 23, 2010 4:12 am    Post subject: Reply with quote

FYI: VirtualBox did not extend the vdi storage when I filled up each of my file systems in the VM.
Subsequent
Code:
VBoxManage modifyhd --compact DISK-GUID
compacted my disks by around 15% (about 1G off of a 7G image).
_________________
...Lyall
Back to top
View user's profile Send private message
forkbomb
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2009
Posts: 115

PostPosted: Tue Nov 23, 2010 4:16 am    Post subject: Reply with quote

lyallp wrote:
FYI: VirtualBox did not extend the vdi storage when I filled up each of my file systems in the VM.
Subsequent
Code:
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. ;)
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Tue Nov 23, 2010 6:05 am    Post subject: Reply with quote

forkbomb wrote:
I've heard of people zeroing or erasing unused space with dd using various special /dev nodes (/dev/random, /dev/urandom, etc).

Quote:
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.
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6108
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sat Nov 27, 2010 7:27 pm    Post subject: Reply with quote

lyallp wrote:
FYI: VirtualBox did not extend the vdi storage when I filled up each of my file systems in the VM.
Subsequent
Code:
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-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum