LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-05-2018, 01:47 PM   #1
qrange
Senior Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable/testing, amd64
Posts: 1,061

Rep: Reputation: 47
virtualbox Linux guest, dynamic hdd


'dynamically allocated storage' grows over time due to obvious reasons (updates, etc..).
could 'trim' be used to shrink it automatically on file delete?
thanks.
 
Old 10-05-2018, 02:04 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,363

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
Don't think so. Trim understands hd partitions, but would probably see the dynamic disk as one big hex file. Some filesystems wouldn't take kindly to being altered on the sly while the VM was off.

You'd have to run trim from inside the VM. Then it might work.
 
2 members found this post helpful.
Old 10-05-2018, 02:57 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,744

Rep: Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924
Not when you delete files but it will respond to trim commands if the VDI is configured with the discard option.

http://www.virtualbox.org/manual/ch0...-storageattach

https://superuser.com/questions/6465...ommand-support
 
2 members found this post helpful.
Old 10-06-2018, 05:48 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,363

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
Code:
VBoxManage storageattach
Is this console control (e.g. in a server environment without X) or Point & click in X?
 
Old 10-07-2018, 08:40 AM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
What I do to compact my dynamic vdis from time to time is:

• Delete any snapshots.

• Boot up into VM.

• Free up space:

(Linux) purge old kernels; apt autoremove; apt clean.

(Windows) CCleaner etc. followed by defrag.

• Fill free space with zeros:

(Linux) reboot to advanced options->recovery mode->root; df to determine root partition; mount -n -o remount,ro -t ext4 /dev/sda1 /; zerofree -v /dev/sda1; systemctl poweroff.

(Windows) (cmd as admin) sdelete.exe c: -z (may stick on 100% for a while).

• Close down VM.

• Determine UUID with vboxmanage list hdds

• vboxmanage modifyhd UUID --compact

For these, Linux needs zerofree to be installed, while Windows needs sdelete (https://docs.microsoft.com/en-gb/sys...nloads/sdelete).
 
1 members found this post helpful.
Old 10-08-2018, 03:37 AM   #6
qrange
Senior Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable/testing, amd64
Posts: 1,061

Original Poster
Rep: Reputation: 47
yeah, but that is rather tedious, this trim thing is neat when it works.


@business_kid
yes its console command. seems there is no gui option for 'discard' yet. pity.


edit:
in any case, consolidating free space would help a lot, but most filesystems scatter data.

Last edited by qrange; 10-08-2018 at 04:51 AM.
 
Old 10-08-2018, 05:37 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,363

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
I have a windows 10 vdi that is getting out of hand.

That has such an awful %$&£@€! interface. CCleaner is stuck at 100 percent (well, Vbox is over 100% in top). Is that normal? Mind you, it has a half share of meager resources.

I only dip into windows in absoloute necessities. Even then, a rusty Vista starts quicker, outperforms w10 and has a much more pleasing interface. It uses half the space. Is there a way to get rid of that sucky alphabetic listing of useless bits I get in the Start menu. I just want to get in to set up stuff, or use one program.
Code:
bash-4.4$ ls -lh Mint-19_/*.vdi Vista/*.vdi Windoze\ 10/*.vdi
-rw------- 1 dec users 12G Oct  3 14:49 Mint-19_/Mint-19.0.vdi
-rw------- 1 dec users 29G Oct  2 12:26 Vista/Vista.vdi
-rw------- 1 dec users 50G Oct  8 11:34 Windoze 10/Windoze 10.vdi
And where have they hidden defrag?
 
Old 10-08-2018, 05:48 AM   #8
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by business_kid View Post
I have a windows 10 vdi that is getting out of hand.

That has such an awful %$&£@€! interface. CCleaner is stuck at 100 percent (well, Vbox is over 100% in top). Is that normal? Mind you, it has a half share of meager resources.

I only dip into windows in absoloute necessities. Even then, a rusty Vista starts quicker, outperforms w10 and has a much more pleasing interface. It uses half the space. Is there a way to get rid of that sucky alphabetic listing of useless bits I get in the Start menu. I just want to get in to set up stuff, or use one program.
Code:
bash-4.4$ ls -lh Mint-19_/*.vdi Vista/*.vdi Windoze\ 10/*.vdi
-rw------- 1 dec users 12G Oct  3 14:49 Mint-19_/Mint-19.0.vdi
-rw------- 1 dec users 29G Oct  2 12:26 Vista/Vista.vdi
-rw------- 1 dec users 50G Oct  8 11:34 Windoze 10/Windoze 10.vdi
And where have they hidden defrag?
Yup, I only maintain a Windows 10 VM because I support some people who use it. The thing that gets me is how long the updates can take. Anyway, installing Classic Shell gives you back a reasonable start menu. If you type "defrag" into the search box, you will find the link to the defragger, but if you still can't find it, the executable is at %windir%\system32\dfrgui.exe.
 
1 members found this post helpful.
Old 10-08-2018, 06:09 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,363

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
Thanks. It is AWFUL, but I have little choice because they are cutting off all others. Vista is already EOL. I'll get that classic shell when I've finished on the disk, if I finish on the disk ... :-/.

EDIT: I just noticed your location for defrag
Quote:
%windir%\system32\dfrgui.exe.
Are they still writing 32 bit software for 64 bit pcs? how sad. This is the system that's going to go for evermore - half 32 bit?

There's fully functional linux systems that are only 64 bit, and a compatibility layer has to be installed for 32 bit. Slackware is probably a good example, because of the detail you get on the 32bit layer.

Last edited by business_kid; 10-08-2018 at 06:34 AM.
 
Old 10-08-2018, 06:21 AM   #10
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by business_kid View Post
Thanks. It is AWFUL, but I have little choice because they are cutting off all others. Vista is already EOL. I'll get that classic shell when I've finished on the disk, if I finish on the disk ... :-/.
If you just need a Windows VM, and it doesn't need specifically to be Windows 10, then Windows 8.1 is still quite useable and will be supported for several years. I use it for some of my Windows work, although I do use Windows 7 as my main Windows VM and will continue doing so until support is dropped (and then I'll move everything over to 8.1). Again, Classic Shell makes its start menu normal again.
 
Old 10-08-2018, 08:20 AM   #11
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,363

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
For completeness, further to Post #5.

I don't know your version of Virtualbox, I'm on 5.2.16 and the options Are
  1. CCleaner & defrag as you said
  2. I got no option to fill with zeroes until sdelete
  3. sdelete64 sure ate up the (little)cpu. Options OK.
  4. vboxmanage is completely different. The best I could manage was 'vboxmanage modifymedium /path/to/Windoze\ 10.vdi --compact
The effect was DRASTIC
Code:
bash-4.4$ ls -lh Mint-19_/*.vdi Vista/*.vdi Windoze\ 10/Windoze\ 10.vdi
-rw------- 1 dec users 12G Oct  3 14:49 Mint-19_/Mint-19.0.vdi
-rw------- 1 dec users 29G Oct  2 12:26 Vista/Vista.vdi
-rw------- 1 dec users 26G Oct  8 14:00 Windoze 10/Windoze 10.vdi
bash-4.4$
As you can see, the disk size was nearly halved. I must have allocated too much space, but there's at least one 15G software suite I may have to install some dark day in the future, and perhaps 2 or 3:-((.
 
Old 10-08-2018, 08:46 AM   #12
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by business_kid View Post
For completeness, further to Post #5.

I don't know your version of Virtualbox, I'm on 5.2.16 and the options Are
  1. CCleaner & defrag as you said
  2. I got no option to fill with zeroes until sdelete
  3. sdelete64 sure ate up the (little)cpu. Options OK.
  4. vboxmanage is completely different. The best I could manage was 'vboxmanage modifymedium /path/to/Windoze\ 10.vdi --compact
The effect was DRASTIC
Code:
bash-4.4$ ls -lh Mint-19_/*.vdi Vista/*.vdi Windoze\ 10/Windoze\ 10.vdi
-rw------- 1 dec users 12G Oct  3 14:49 Mint-19_/Mint-19.0.vdi
-rw------- 1 dec users 29G Oct  2 12:26 Vista/Vista.vdi
-rw------- 1 dec users 26G Oct  8 14:00 Windoze 10/Windoze 10.vdi
bash-4.4$
As you can see, the disk size was nearly halved. I must have allocated too much space, but there's at least one 15G software suite I may have to install some dark day in the future, and perhaps 2 or 3:-((.
Great to see!

I'm running VirtualBox 5.2.18 r124319 on Mint 19 MATE.

sdelete.exe c: -z fills the unused file space on C: with zeroes automatically.

modifyhd works on my machine, although it is an older vboxmanage command and now mapped to modifymedium. Both should work, but thanks for the heads-up - I'll change that in my notes.

It doesn't really matter how much space you allocate for a dynamic VDI - the file will only grow when it needs to and is only large enough in reality to contain the guest, so you can "allocate" as much as you want without affecting the real file size.
 
Old 10-08-2018, 01:12 PM   #13
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,363

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
Figured out the overloading. Windows is using 100% of ram available to it, & swapping out (defragging vista this time); Linux feels crowded but is going ok. If I hadn't an ssd, this would be an overnight job. It's the first defrag for vista, which has been there some time (Jun 2017). I still haven't got to sdelete. From top in the host
Code:
   PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                    
 5031 dec       20   0 4896416   3.1g   3.0g S 100.3  55.1 115:12.66 VirtualBox
Interestingly, windoze 10 picked up the correct screen resolution for the 1st time. There was an update downloaded when I closed it to clean up, and applied after. Allowing for menubars, I want 1600x788, and I got it! Wonders never cease, it seems when m$ exceeds my low expectations. God help poor guys having to work with this stuff...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
4MLinux as VirtualBox guest - how can I install VirtualBox Guest Additions? wghay 4MLinux 11 09-30-2018 12:17 PM
[SOLVED] how to check version of virtualbox guest additions currently installed in guest syste masuch Linux - Virtualization and Cloud 3 09-03-2012 01:05 AM
Host Fedora14, Windows 7 is running as Virtualbox guest- Mic is not working on Guest mwaheed Linux - Virtualization and Cloud 1 10-20-2011 12:51 PM
[SOLVED] VirtualBox 4.0.4 + crashing guest HDD Cesare Slackware 7 06-07-2011 08:07 PM
LXer: Install Guest additions and run fullscreen mode on VirtualBox Guest OS | Linux LXer Syndicated Linux News 0 01-17-2010 05:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration