Tag Archives: disk space

MacBook Air and Xcode: Free up Disk Space by Removing Unwanted/Unavailable Device Simulators Tips, Tricks and Tutorials 29 OCT 2017

iOS software development on a MacBook Air inevitably then means that you have a couple of Xcode versions installed on your device, and as we all know, these chew up a fair bit of disk space in the process. One way to free up some disk space is to remove some of the unwanted or perhaps unavailable device simulators that build up with each Xcode update.

The first step is of course to see what you do in fact have installed, and the easiest is to do this is to make use of the simctl tool that comes with Xcode 6+. To do this, launch a terminal and run:

xcrun simctl list devices

Note the use of xcrun to locate and execute the latest development tools. In a user friendly twist, simctl allows you to bulk delete all unavailable simulators with:

xcrun simctl delete unavailable

You can also target specific devices for deletion by simply specifying them either by name or ID:

xcrun simctl delete D26C18BC-268C-6F0B-9CD8-8EFFDE6619E3

This process can actually free up quite a bit of space, particularly if you’ve been through a number of Xcode updates in the past.

Related Link: Xcode

Mac OS X: Hunt Hard Drive Disk Space Hogs with Disk Inventory X Software & Sites 01 MAR 2016

Software development tools are often quite large and clunky, meaning that software developers often face the prospect of running out of hard drive disk space on their work machines.

I’m particularly fond of applications that use “treemaps” to visualize disk space usage, and have in the past mentioned how great Uderzo Software’s SpaceSniffer works when trying to figure out where and what to delete on a Windows machine. (If you are on Linux, then either KDirStat or QDirStat will do the trick!)

disk inventory x

Having to now publish Appcelerator apps to the Apple App Store for use on an iPad, I’ve been handed a MacBook Air (pretty little thing, but can’t say I’m a fan of the interface), and almost instantaneously ran into a space issue triggered by my installing of some development tools.

Naturally, completely new to the Apple environment, I had no idea where to even start looking for the most likely space hogging culprits!

Pleasingly, following a little time spent with good friend Mr. Google, I stumbled across Disk Inventory X, which bills itself as a disk usage utility for Mac OS X 10.3 (and later) and which uses treemaps to show the sizes of files and folders – in other words, exactly what I was looking for!

I downloaded and ran the software, and wouldn’t you know it – turns out that Android SDK had already pulled down more than 30GB of SDK related files.

Sigh, at least I now know where to start chopping…

Related Link: Disk Inventory X

Clear Up Some Space on your Ubuntu Server Install Tips, Tricks and Tutorials 25 NOV 2013

ubuntu orange logoI ran into an issue the other day installing VMWare Tools on a virtual server whereby the installer was moaning about not having enough space in the /boot directory in order to continue with the installation.

(Now of course, unless you’re a seasoned Linux pro, you don’t really want to be messing about with your /boot folder, even if you’re confident that after running uname -r you’re kind of 100% sure which kernel files you can safely remove! In other words, tread carefully and always have backups on hand.)

Thankfully there are some pretty useful commands that you can run in order to help you free up some much needed space, commands that remove unused kernels, left over dependencies, and just plain old cached .deb files!

To remove old kernels, inspect your /boot folder. If you run uname -r you’ll see your currently used kernel version. This is the one you want to keep, so make a note. (Oh, and it’s also usually a good idea to hang on one older one for just in case.)

The Ubuntu Forums offered up this particularly handy little command to list all the kernels and headers that can be removed, excluding the current running kernel:

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')"

Now you can remove unneeded kernels one by one using the apt-get purge command (e.g. sudo apt-get purge linux-image-x.x.x-x), or you can make use of the above snippet to blast everything away at once:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

(Risky, I know, but it is a time saver if you have a lot of unused kernels lying around)

Next up in terms of clearing up some space on your Ubuntu install is making use of the sudo apt-get commands ‘autoclean’, ‘clean’ and ‘autoremove’.

From the apt-get MAN pages:

clean: clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.

autoclean: Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control.

autoremove: is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no longer needed.

First, run the autoclean package command that essentially removes partial package from the system, followed by the clean command that removes .deb packages that apt caches when you install, update, or upgrade:

sudo apt-get autoclean
sudo apt-get clean

Now run the autoremove command to remove any packages that should technically no longer be needed:

sudo apt-get autoremove

There, that should have freed up some space for you!

(Reminder to myself: I tend to Google this to get here: ubuntu server /dev/sda1 full)

Ubuntu Server: How to Free up Disk Space Software & Sites 03 APR 2013

ubuntu-10-logoEvery now and then your server will throw up its hands and declare that it has run out of space, which means that you need to go in and figure out what is taking up all the space and then a) increase the amount of available disk space or b) delete or archive things in order to free up some disk space.

As it turns out, this is mostly a manual process of locating things and deleting or clearing out if possible, and more often than not, you’ll find that overzealous logging, which even logrotate couldn’t effectively deal with, sitting at the root of your problem.

Now we’re interested in b) for this particular post, so we start by doing a Disk Free check to get a better idea of our current situation:

sudo df -h

With that information in hand we then systematically look at the problem areas with targeted calls to Disk Usage:

sudo du -h –-max-depth=1 /
sudo du -h –-max-depth=1 /var/
sudo du -h –-max-depth=1 /var/log/

Once you’ve identified a particularly large folder, check it’s contents with the usual human readable listing:

sudo ls -lha

Spot the overly large offenders and happily delete with the usual rm command. Note that for log files it might be necessary to first identify the controlling service and stop that, in order to allow you to remove the file. Also, a nifty trick if you don’t want to delete what could be important program files is to simply overwrite them with blank, thus leaving their group and file permissions perfectly intact.

Ubuntu Terminal: How Much Disk Space do I have Left? CodeUnit 19 AUG 2011

To see how much disk space you have left on your Ubuntu linux desktop or server via the terminal is made easy thanks to the standard df command that comes bundled in most Linux distros.

The most default way to use this is:

df -hT

where the h switch returns the size in user readable units like GBs or MBs, while the T switch prints out the filesystem type.