Tar and Gzip When Low On Disk Space

Anyone who knows me knows how I feel about AIX :-P.  One of my peeves is that out of the box, I cannot tar/gzip a directory with the “tar -cvz” command without breaking it up into two separate tar/gzip commands.

Every once in a while, you need to pull a large directory off your server to your local machine or just to copy it to another server.  Sometimes it’s easy just to copy the entire directory uncompressed.  Other times, it just makes sense to tar and gzip the directory so that the file that you are transferring is in a single archive and is compressed as to shorten the transfer time.

The problem with the tar/gzip option is that if you tar then gzip, you need the disk space to do so.

On AIX, here is a solution that will allow you to send what you tar to stdout then gzip it on stdin with no problems with disk space unless the gzip’d tar is still bigger than the diskspace you have available.  This *should* work on other *NIX systems that you cannot throw the gzip switch in the tar command.

tar -cvf - /path/to/dir/you/want/to/tar | gzip > /destination/for/gzip'd/tar.tgz-boogybren

Run A Command Every N Seconds

Short story long…

This week, Apple officially release support for Windows 7 in BootCamp 3.1.  I thought to myself “Self, you have a wonderfully powerful Mac Pro with 8 cores and 10GB RAM that is being completely unused by your XP install, you really should upgrade to to Win7 x64 now that Apple officially supports it”.

So, that’s what I did, with no thought as to how much MORE disk space I would need on my BootCamp partition.

So after installing Windows 7 and a bunch of games, I received my you only have < 500MB of disk space left alert.

This brought me to a point where I needed to resize my OSX HFS partition and grow my Windows NTFS partition.  During this madness, I realized that with BootCamp 3.1, I could view my HFS partitions from Windows!  But much to my chagrin, I couldn’t see my slice that had all of my useful data because it was a part of a concatenated RAID.

After resizing my OS partitions, I decided to move data off my RAID slice so I could break it then just create a normal HFS partition that can be viewed from Windows.  The problem is, moving almost a TB of data can take a long time and turning from my laptop to my left 45 degrees to my desktop on my right every time I wanted to see how my disk space looked left me with a pain in my neck!

I was at that very moment reminded about using while & sleep. Below is a handy little command that will run any command every number of seconds until you break (ctrl-c) it.

while truedocommandsleep 30 (seconds)done

I personally ran:

while truedodf -h | grep disk1s2sleep 30done

Which allowed me to monitor the growth of the destination disk I was copying to.

-boogybren