Resizing Oracle VirtuaBox VDI on a Mac

Resizing Oracle VirtuaBox VDI on a Mac

Today I needed to increase the size of the VDI file on my Oracle Virtualbox virtual machine.  I run it on a MacBook Pro so I can still use Windows 7, 10, and 2016 as needed for their utilities or testing.

Resizing has to be performed from the mac Terminal (command line).  The syntax is pretty simple, but still there is room for error.

With VirtualBox closed, go to the folder where the VDI is stored and run the command below substituting your filename and size requirements respectively.  NOTE:  there are two dashes before the resize command.

The following example would resize the file to 123,456K  (123.456MB)

VBoxManage modifyhd  “Windows 7 Pro.VDI” — resize 123456

However, I received an error.  “Cannot register the hard disk  because a hard disk  already exists”.  During the course of the error there was a long number in {brackets}.    The key is to copy that number and rerun the command substituting it for your filename as shown below:

VBoxManage modifyhd  {18fd3671-1b4f-49d1-a4bc-40e52bb78051} — resize 123456

Increasing the size could take place nearly instantly on a faster computer, but no error message is a great sign.  A directory listing won’t show an increase in file size as it has not been utilized yet.  Open up VirtualBox and you will be able to see the change under storage properties.

Hope this helps!

Google Drive Trash Cleaner 

Google Drive Trash Cleaner is a command line program that can do exactly what the title says.  It’s available as a Windows or Python executable from GitHub

In my example I downloaded it on a computer that doesn’t even have Google Drive Backup & Sync.  When I ran it I was prompted that I needed to run it with a “no authorization” command line.  Once I did that it gave me a link to Google with a very long url.  By visiting that link I was able to login to Google, confirm that I wanted Drive Trash Cleaner  to have access and receive an authorization number.

Once I provided the authorization number to the app, it accesses the drive perfectly.

Using the simple command of  cleaner -d 1 -a the utility connects and deletes any files/folders older than 1 day in the recycle bin.

By default it deletes items over 30 days old.  “-d” allows your specify the number of days.  “-a” will cause it to automatically delete without requiring authorization.

Full usage and syntax are shown below

usage: cleaner [-h] [-a] [-v] [-d #] [-q] [-t SECS] [-m] [–noprogress]
[–fullpath] [–logfile PATH] [–ptokenfile PATH]
[–credfile PATH]

optional arguments:

-h, –help show this help message and exit

-a, –auto Automatically delete older trashed files in Google Drive without prompting user for confirmation

-v, –view Only view which files are to be deleted without deleting them

-d #, –days # Number of days files can remain in Google Drive trash before being deleted. Default is 30

-q, –quiet Quiet mode. Only show file count.

-t SECS, –timeout SECS Specify timeout period in seconds. Default is 300

-m, –mydriveonly Only delete files in the ‘My Drive’ hierarchy, excluding those in ‘Computers’ etc.

–noprogress Don’t show scanning progress. Useful when directing output to files.

–fullpath Show full path to files. May be slow for a large number of files. NOTE: the path shown is the ‘current’ path, may be different from the original path (when trashing) if the original parent folder has moved.

–logfile PATH Path to log file. Default is no logs

 

Google