Disk Utility - Make full use of it ! (by Naquaada)
Here's an article about the Disk Utility. Normally it stays lonely in the Utilities folder and is often overseen. But it's more than a harddisk formatter - it's an backup program, a burning program, an very effective archiver and much more. I'm using the Disk Utility nearly every day and it was the reason why i never updated from 10.4.7 till now because all images since 10.4.8 had a bug in it.
To expand the options, start Onyx and look in Parameters/Various. At the top are some additional options for the Disk Utility, activate them. Now to some things how to use the program.
Make use of Disk Images (.dmg, .sparseimage)
The Mac's Disk Images are a great thing. You can use them to burn, sort and archive files. There are two main types: The standard disk image (.dmg) which uses all the space on disk you define it. Then there's the growing image (.sparseimage). This image only uses so much space on the disk which it contains. Both types have advantages and disadvantages. The .dmg image needs more space on disk, but it works more like a real drive, f.e. it can be better defragmented. A .sparseimage needs less space, but if you delete files in it the space will not be freed on the real HD. If you defragment it also will grow. But in the most cases the .sparseimage is the better choice.
How do I create a disk image? Start DIsk Utility and use 'New Image' in the toolbar or 'File/New/Empty Image' from the menu. You get a requester for the name with a lot of options at the bottom. At the top you can select the path and the file name it should have. At the bottom you can enter the name the disk image will have if you open it (can be changed later, of course). In the next field you can change the size. In the most cases select 4,7 GB DVD Image. If you want to use a disk image on a FAT32 drive (f.e. portable harddisk) enter 4095 MB as custom size. Encryption is normally unneccessary. For the partition table use always 'No partition map', i have encountered problems with other types. For the image format 'read/write disk image' will create a .dmg, 'sparse disk image' will create a .sparseimage file. If you click create, a new removable drive will appear on the right side.
For what can I use a disk image ?
It helps you f.e. to clean up the harddisk. I had from former times a collection of about 100.000 MIDI files. I you have them directly on your HD, spotlight has to collect all 100.000 files - and normally are MIDIs unneccessary for Spotlight. So I put them all in an image. I have the files, they are sorted but on the real HD there are 99.999 files removed. It is good for all files with small file sizes, f.e. Amiga MOD files. It's also good for complete sets, f.e. a comic collection. I also have a image of useful Tools, installer packages, system drivers, Icons and so on. I created a sparseimage with 4095 MB for them and so I have the stuff fine sorted. If I want to install a program I havn't to search the whole HD, I only have to do look in that image. And I can open it via menu and with a hotkey, so it's very handy. And it could never be bigger than 4095 MB, so I always could be sure it fits on a FAT32 disk or an a DVD.
Using Disk Utility as compressor
Disk Utility can save disk images compressed. if you activate the special options with Onyx, you also can compress in bzip2 format which is very effective. I still have the importantst OS X images as DVD images on my harddisk. But I converted them in bzip2 format and this saves a lot of size. Other examples: My MIDI collection were uncompressed about 3,1 GB. bzip2-compressed they only need 700 MB! A small collection of 4 videos (quicktime and divX format) were uncompressed 96 MB, compressed only 37. That's a good ratio for already compressed files.
Disk Utility has an option 'File/New/Image from Folder' in the menu. This allows easily to convert a folder in a disk image, this is the easiest way to compress files for mailing or for rapidshare.
The most important aspect of an compressed dmg: You have access to them without decruncing! If you want to access files from a normal archive, you have to decompress the whole stuff on the HD first, even if you only need one file. This uses a lot of space. A .dmg could be used like a harddisk. In my case, I always have access to my MIDI files without to decompressing them to my HD first.
Burning DVDs with Disk Utility
Burning DVD images is easy with Disk Utility. Select 'Burn' in the toolbar and select an image. It supports of course .dmg, .sparseimage, but also .iso, .bin and also .toast (not tested). RW-Disks could also be erased. Disk Utility always checks the burnt media.
File burning works with Disk Images. You create a disk image, put the files in and burn it. But I think that's only working with the Mac filesystem.
But now we come to the advantages of burning a Mac image. With .dmgs you can create very nice looking discs. At first, you can give the image an own disk icon. But there's more: Every window can have seperate background pictures! If you downloaded programs from the internet, there was often a background picture in the image.
My last project was rather complex. It contains three movies, the english versions, all Soundtracks (5 MP3s-CDs), 3 available Musicals and Specials including 18 additional movies. The additional movies were music videos from known songs lip-syncronisized with scenes cutted of the film, some are really amazing well made. I searched for every song the fitting CD-Cover from from Amazon and created an Icon (You only need FastIcns and Preview for this). Every folder has a different backgroundpic, the icons are in size and position individual fixed. It was a lot of work, but it was really fun. And I still have the .sparseimage, so if I want to make changes, I could do it every time. Tip: If you want to use more than one background pic, create at best a folder 'backgrounds' in the main directory and make it invisible when you're finished (use Path Finder or a similar program for this). See - it's possible to create great looking DVDs without needing much special software.
BTW: You also can rip a DVD to an read/write-image with Disk Utility. So it's easy possible to make modifications on it!
Create Backups with Disk Utility
I always have two bootable partitions on my harddisk (three total), a big main partition and a small (15GB) partition for recovery reasons. If the main partition crashes - that could already happen only by installing one false kext - it is possible to reboot in the other system and fix the problem from there. I used this method since Tiger 10.4.5 and it saved me a lot of re-installations. And it saves a lot of new installations! You create once that installation as good as possible. Then you create a compressed .dmg of it and save it on another partition or external harddrive. How saves this an installation? Easy: Select the partition the image should get a new installation. Select 'Restore' in the main window of Disk Utility. Since Leopard the image must be checked once before restoring: Use 'Scan Image for Restore' from the image menu and select the image you just created. After it suceeded successfully, select it with the 'Image' button in the restore window or drag it on the 'Source' field. Drag the volume on which it should be installed on the 'Destination' field and select 'Erase destination'. After the password it rewrites the image to the new partition. It is no problem to restore a smaller image to a larger drive. That's why my Recovery partition is so small. Although, it's still oversized. I have a lot of Tools on it, but I removed unneccessary kexts and the PPC part of the most programs, so only 7 GB are used. That's only nearly the size of a standard installation. As a bzip2-compressed image it uses only 2,7 GB. So it's possible to keep it on a portable FAT32 harddrive or on a DVD.
Tips: before compression defragment the harddisk. Thats normally not neccessary, but it moves the files to the beginning to the drive. This is better for the compressing process. You can also optmize the compression if you overwrite the unnused blocks with zeroes before. The creating and rewriting of .dmg backups is also possible with the Installation DVD, select the Disk Utility from the Utilites menu and do the process as described above.
In all Tiger images since 10.4.8 you get an Error -5308 if you do this and your destination partition is destroyed. If you don't select 'erase harddisk' you'll get an Error 19, 'drive not supported'. But I also got much worse error messages with an 8-digit error number and so on.
Create a very safe Mac OS X system (by Naquaada)
This should be a guide for a very safe OS X system. It makes a lot of use of the Disk Utility, so it won't work correctly with all Tiger versions since 10.4.8 because the Disk Utility is faulty there.
The system is based on two boot partitions and one storage partition, so if one fails you can boot with the other and repair it from there without needing to boot from the DVD in single user mode or something else. If a partition crashed totally, you can easily restore it with the Disk Utility.
1. Setting up the HD drive
You need a full seperate harddisk for this type of system, not too small. I'm using 320 GB IDE harddisks for booting, IDE is often faster as SATA. I wouldn't recommend IDE harddisks larger as 400GB.
Boot from your favourite installation DVD, select your language and wait until the menu bar is available. Select the Disk Utility in the menu. After it's open and your HD is recognized, click on it and select 'Partition' on the right side. Select your partition map, the most common is MBR. Now choose in 'Volume Scheme' 3 Partitions. You'll get three partitions the same size. Resize the partitions to the following sizes, beginning at the last partition:
3rd partition: 30,90 GB
2nd partition: 15,90 GB
1st partition: The rest of it.
This is for a 320 GB harddisk, on smaller harddisks you can vary the sizes, but don't make them to small. The 2nd partition should be not smaller than 10-12 GB, the third should be at least 20 GB. If you're wondering about this ,90 at the end: On Tiger my second partition was 7,90 GB so that it could fit on a double-layer DVD. For Leopard the partition had to be bigger, but I kept the ,90 at the end. You don't have to do this.
For the names I use for the first partition 'Leopard', for the second 'Recovery' and for the third 'Shared'. I will use these names in the guide from now on. You can change them, but I would recommend not to use Spaces because it's more difficult in use with the Terminal. After you are finished click on 'Apply'. It all went fine you'll get a partition table like this:
I also want to say that you can't partiton the drive earlier from a working OS X system because the Disk Utility works a bit different in the Installation DVD. You'll see this because the partitions have a different size after partitioning. The 2nd partition 'Recovery' will be bumped from 15,90 to 16,03 GB, the 'Shared' partition will be lowered from 30,90 GB to 30,65 GB. Only the main partition 'Leopard' will stay the same size, 251,42 GB on a 320 GB harddisk (which has an effective space of 298,1 GB).
Now reformat the partitions using the security option 'Zero out Data'. This removes all existing data, checks the harddisk and every block of the disk came in touch with the HFS+ file system. This can take a while, so you can do something more important than staring of the blue format process bar ;-)
Install OS X first on the Leopard partition and configure it a bit, but don't spend too much work on it. After this install again on the Recovery partition. Hmmm… what's the sense of this? So I have to do twice an installation and twice the work? Don't judge too early, we haven't just started.
Now begin to install the Recovery partition. Configure it much better, especcially system-based. Establish the Internet connection and download ASU. Update your system and the kernel. If something wents wrong, you can boot in the Leopard partition using the Darwin boot selector and try to repair the error from there. If it's not possible, you have to install again. Install some very neccessary software, f.e. your favourite browser and I always recommend Onyx for cleaning the system.
3. Creating the first Backup
If you think the system is fine, restart and boot into the Leopard partition using the Darwin boot selector. Note: You can easily see from which partition you booted: The drive icon is always on the top. Start Disk Utility and select the Recovery partition. Now use either the button 'New image' from the toolbar or use it in the menu 'File -> New -> Disk Image from diskXs2 (Recovery)'. Now a save requester opens. If you don't have the path options, use the triangle right to the file name.
The image format 'compressed' is selected by default. If you use Onyx and activate the hidden Disk Utility options you'll get a bzip2-compression which is much more effective. Now select the Shared partition and best create a folder 'Disk Images' on it. Save the image in there, name is f.e. '10.5.x Recovery 1' and/or the date. I only use a number because at the beginning you create more than one version at one day.
The generating on the image can take a while depending on the partition size and your processor. After it's successfully finished, select in the Disk Utility's menu the option 'Images -> Scan Image for Restore'. This option is neccessary in Leopard, in Tiger you didn't need it. It checks the image if its valid. If there was an error during the check, try again to create an image. If this also wasn't working, try the repair option of the Disk Utility or boot back into the Recovery partition and use Onyx. But I only had once error at all on more than 20 backups, and it worked correctly after the second try. A compressed image from this installation (which is about 7 Gig or more) should be about 2,5 GB, so it would easily fit on a DVD.
4. Optmizing the Recovery partition
Now you can continue optmizing your Recovery partition. I recommend to use the standard Apple background pic so that you can differentiate it from your main partition with a custom background picture. I always use these things to optimize a system.
- Remove unneccessary kexts
Removing unneccessary kexts saves space on the harddisks and could speed up booting. Especcially graphics card kexts could be removed. I have an ATI Radeon X1600, so I can remove all Geforce* kexts, all NV* kexts and all ATI kexts except ATINDRV.kext and the ATIRadeonX1000* kexts. It is also possible to remove AppleHWSensor.kext and ALF.kext. But - backup them. For this you can use again the Shared partition. But you can optimize it a bit more. Create with Disk Utility (again this tool) an empty Disk Image with the type 'sparse disk image'. This is a disk image which needs only so much space on disk which is needed. The advantage of using a disk image instead of a folder is that every kext (which are containing much more files) don't use a single entry in the directory, they will only stored in this disk image. Best use a subfolder 'Extensions' because you can backup more system data in there. Tip for creating an portable image: create an sparse image size with the size of 4095 MB. So the image will never reach the 4 GB border, which is the maximum file size for FAT32 (standard for external drives), and you can use the HFS+ filesystem on an FAT32 formatted drive.
- Editing system files
Editing system files directly in the /System/Library or /Library folders can be difficult because of the permisisions. For this you could again use the Shared partition. Copy the file you want to edit (f.e. com.apple.boot.plist) to this partition, now you can edit and save it without problems. Then copy it back to it's original place (you have to authorize) and repair the permissions with Disk Utility (what would we do without this tool). Tips: Backup the original file and use a color for the edited file.
- Optimize applications
I always can recommend the Xslimmer. It removes the PowerPC part and/or unneccessary languages from the programs and saves a lot of space this way. For exmaple, iChat will shrink from 117 to 17 MB! The program has a blacklist, so programs which are problematic (f.e. Mail, Safari and Adobe products) won't be slimmed. I never had problems with slimmed programs. It also has a function to backup programs, but I won't use it because it's rather slow. If you want to backup programs copy the files to another drive. You can use again the Shared partition, and maybe use a disk image again.
- Applications I can recommend:
These apps I have installed on my Recovery partition:
- AMD Tools: ASU, About this Mac modifier
- AppZapper: Removes applications and additional files. But it's not really neccessary.
- Butler: Great program selector for the menu bar
- ClamXav: Freeware Virus killer. Not very important for the Mac, but it's there.
- DivX: DivX Decoder/Encoder
- Docker: Allows manipulations on the Dock, color, 2D mode and so on. I use it to get the arrows back.
- FastIcns: Very easy to use program to create icons up to 512x512 pixels.
- Firefox: Don't know what's this for a prog ;-)
- Flip4Mac: WMV plugin for Quicktime
- Gutenprint: Freeware printer driver which supports a lot of printers
- iDefrag: Defragmenting program, useful before creating backups
- iTar: a prog which uses UNIX archive types which have a very high efficency
- KeyViewer: Applescript which shows the MacOS keyboard table.
- Leopaque: Changes the menu bar's transparency in %
- Little Snitch: Personal Firewall, great program
- LiteIcon: Freeware version of CandyBar, allows to change system icons. I use it mainly for the folders.
- NFOViwer: Shows the .NFO and .DIZ files which come from so bad web sites ;-)
- Perian: A freeware Quicktime plugin with codecs for nearly every format.
- PrefEdit: Allows editing all preferences files
- RapidoStart: Nice program launcher
- RealPlayer: Needed for the web.
- Renamer4Mac: A program and context menu entry which can easily batch rename files
- The Unarchiver: an extractor for a lot of archive types. I made new icons which look like the system icons.
- Toast Titanium 9: You know this.
- Transmission: Lightweight Bitt*rrent client
- VLC player: Multiformat media player which inbuilt codecs. Plays nearly everything.
- Xbench: Our standard benchmark program.
- XSlimmer: was already described above.
I didn't create links to all these progs, but you can find them all in www.macupdate.com.
If you now think, wow, with these progs the 16 gig of the partition are all used - wrong. With all optimizations and so on it's only 7,16 GB! A bzip2-compressed backup image needs only 2,59 GB. Not bad, eh?
5. Creating the main partition
Now boot back into the Leopard partition and create again a backup of the Recovery partition as described in instruction no. 3. Then boot back in the Recovery partition. Start Disk Utility and select the Leopard partition. Select 'Restore' on the right side of the Disk Utility. Now drag the just created Disk Image to the 'Source' field. Alternative you can use the 'Select' button, then you'll get a file requester. Then drag the 'Leopard' drive from the left side of the Disk Utility to the 'Destination' filed. At least set the marker 'Erase destination'. It should look like this now:
If you now click on 'Restore' the image will be written blockwise to the Leopard partition. This will work because the Leopard partition is bigger than the Recovery partition. After it's finished successfully, you have two volumes with the name 'Recovery'. Rename your main partition back to Leopard and reboot into it. Wait until it's completely finished booting, it is also possible that the Spotlight process starts, so it can take a while. After it's finished, use Onyx (if installed) and reboot. You now have two identical systems. To see the difference, use a custom background pic on your main partition.
Now we have to make the Leopard partition bootable. Reboot the computer and boot from the installation DVD in single user mode (option -s). If the prompt is there, enter these commands:
fdisk -e /dev/rdisk0 update f 1 w q
and reboot. Now the computer should reboot in the Leopard partition without using the Darwin boot selector. If this works, boot into the Recovery partition and create an image from the Leopard partition.
Now you have backups from your Leopard and your Recovery partitions. You can use both partitions to defrag, repair, backup and restore each other. A new installation is so nearly unneccessary. And the backups are quick available on the Shared partition. If both partitions are smashed, you can boot with the installation DVD, use disk Utility and restore a backup from the installation DVD. This method should be safe enough for the most users.
6. Advanced optimizing
Before this, continue installing your main partition. Configure Mail, copy some things like Colloquy, Skype and some other programs you use more often. But no too big programs like iLife or something like that, the image should still be so small that it's easy to backup. My main partition which was prepared for backup had already some games, an Amiga emulator, ScummVM, CrossOver, Parallels, about 500 MB mails and so on, but it still it needed only 8,7 GB on disk and less than 3,6 GB as an image.
If your image is ready for backing up, you can use the following optimizing methods: First use iDefrag or another defragmenting prog that moves all blocks to the beginning of the harddisk. Then use Disk Utility and use 'Erase free space' with the Zero Out function. With this method the free blocks can be crunched more effective. If you have activated the Disk Utility's hidden features and use the bzip2 compression it will even be more effective.
7. Using the system
If you use the system, test new things always on the Recovery partition. If it crashes, restore it and try again or don't try this feature again. Use it only if it works stable on the Recovery partition. Your main partition won't be affected from this. If install bigger programs on your main partition it will be to big to backup sometime, so be careful at all.
I would recommend to keep more than one backup of the partitions. It can happen that there's a hidden problem on a newer version, but the older hasn't it. So you can restore the older one and try to avoid this problem. This is the reason why the Shared partition should not be too small.
The method with the backups also works great if you have rather compatible systems. I have four systems with three different boards, but all have nForce 4 chipsets and an X1600. I don't need to create extra installations, only write the images to the system and fix network drivers and settings (IP and computer name).
Make use of the Shared partition. It's called Shared at all because you have access to it from both boot systems. If you would f.e. only use the folder of your Leopard home directory it's difficult to access to it from the Recovery partition. Use it for quick downloads and as a temporary partition, so it helps to keep the desktop clean. You can add a folder Douments in where you create a notepad file. If you're using Butler you can add it in the menu bar and add a hotkey. I always keep a well sorted disk image on this partition which contains drivers and software which I need. It's also added in Butler, so I can open it with a hotkey. This is a screenshot of my Butler menu, if anyone wants the preferences files mail me, there are no private data in it.