Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-attach resized disk with SSD TRIM feature enabled. #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ycanty
Copy link

@ycanty ycanty commented Jan 18, 2019

This allows to shrink the .vdi file on the host when disk space
is reclaimed in the guest OS.

For some reason VirtualBox doesn't expose this feature on its
GUI. It's only available in VBoxManage when attaching a
virtual hard disk. So this plugin is the perfect place to
enable this feature.

More information about this feature here:
https://www.virtualbox.org/manual/ch08.html

Look at the storageattach --discard option.

I've been using it for many months on my Ubuntu guest VMs with
no ill side-effects.

This allows to shrink the .vdi file on the host when disk space
is reclaimed in the guest OS.

For some reason VirtualBox doesn't expose this feature on its
GUI.  It's only available in VBoxManage when attaching a
virtual hard disk.  So this plugin is the perfect place to
enable this feature.

More information about this feature here:
https://www.virtualbox.org/manual/ch08.html

Look at the `storageattach --discard` option.

I've been using it for many months on my Ubuntu guest VMs with
no ill side-effects.
@noaho
Copy link

noaho commented Jun 23, 2019

I would love to have this too. But maybe it can be an optional feature? TRIM might cause unexpected behavior down the line, especially since it changes the disk to appear to be an SSD. (which it might not be)

@ycanty
Copy link
Author

ycanty commented Jun 23, 2019

Sure, it could be an option. I don’t know Ruby much so adding an option is not trivial for me. I wouldn’t mind trying if first I could get this PR merged. :-)

However, I’m not sure an option would be that useful as in a VM the hardware is virtualized so as far as I know it doesn’t matter what the physical disk type actually is, the OS in the VM will think it’s an SSD and virtualbox will handle writing to the virtual hard disk, which is just a file on the real file system.

@noaho
Copy link

noaho commented Jun 24, 2019

Well, using windows as an example, if the disk type is HDD, it will run defragmenter every week, if SSD, it will run TRIM. So it does change the behavior of the VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants