Showing posts with label partition. Show all posts
Showing posts with label partition. Show all posts

Tuesday, March 25, 2008

Leopard & Time Machine Experiences


Time Machine Logo

Ever since Time Machine was announced, I had been awaiting for it. I am one of those people that do backup from time to time, but with no regular schedule or automated system. Clearly, Time Machine seemed simple enough and could very well prevent any undesired hiccups.

Once I had Leopard installed on my iMac, I was excited to give Time Machine a try. I decided to buy a Lacie external HD to make the backups. After connecting it, I immediately got a message asking if I wanted to use the disk as a Time Machine disk. I answered positively.

The disk was connected through firewire 800. I left it backing up all night. I took several hours to get all the used space on my iMac HD, a total of 250 Gb, onto the disk. Next day, I launched Time Machine's animated interface. Wonderful. Everything seemed to work fine.

After a some minutes, Time Machine began backing up automatically. This time just a few megabytes. Unfortunately, it took around 15 minutes for something like 3 Mb. In the following days, this became a constant, and I was not happy about it. Backups took way too long. I thought that I had not chosen a good external drive, or that it was faulty.

In addition, my Leopard was not too stable, nor did it operate as fluidly as I was hopping it would. I carefully considered reformatting the iMac with Leopard, and restoring all the user files from Time Machine. I was worried, thought, that the restore process would not work as smoothly as I would want, given the slow backup times and my doubt about the external HD condition.

After some investigation, I found an article that explained how issues might arise for using an APM partitioned drive on an Intel Mac. This could be the cause of my Time Machine troubles. Time for a repartition, reformat, re-first-time-backup.

As my final goal was to get my iMac into better condition, than what the upgrade from Tiger had left it into, I decided that after repartitioning, I would make the external hard drive bootable. I took the Leopard DVD, and using Disk Utility, I "restored" it onto the external hard drive.

Now I had an external hard drive, that used GPT (GUID) instead of the the original APM partitioning, and that was not only bootable, but it had the capacity to install Leopard. Time to try to get all 250 Gb on that disk again. This time it was much faster. It took around 3 hours.

Then, I booted from the external drive. Made a Leopard clean install in around 20 minutes. When the option for transferring files from another Mac was up, I chose to restore from Time Machine. It did it.

Once the restore process finished, most things were fine. As usual, Spotlight started indexing and made the Mac a little bit slow for a while.

After careful examination, I realized that some folders at root level were duplicated. I had "/Applications" and "Applications (from old Mac)". This was true for several others. I deleted all those folders. After all, if I was to need any of those files, they would be present on the Time Machine backup.

Now both Leopard and Time Machine seem to behave reasonable well. I am, though, ready to reproduce this process if I ever need to do so again.

Sunday, July 29, 2007

Lossless same-drive Mac HD Repartition, part 2

A while ago I explained how I did repartition my iMac hard drive. Then came WWDC, and with it I got the Leopard beta. Being in SF, without access to my iMac, I decided that I had to repartition my MacBook hard disk, so I could install Leopard and follow the sessions correctly.

Using my own post, I followed the different instructions. At repartition time, everytime I executed "diskutil resizeVolume ..." I got an error message about not having enough space. My MacBook's HD had been almost full, but I had freed 26Gb in order to make a new 20Gb partition. Clearly, it was not the disk space. It was also clear that my disk was probably highly fragmented and that diskutil was unable to allocate 20 contiguous gigabytes for my new partition.

I found an app called iDefrag. After some tests, I told it to defrag my drive with the default options. I took like 45 minutes to complete the whole process. I then retried the "diskutil resizeVolume ...". This time it worked perfectly.

Monday, June 04, 2007

LateNiteSoft at WWDC '07

I have started WWDC preparation. I have downloaded some of the headstarts, based on the sessions that interest me. Now, I have to install the latest Leopard preview in my laptop. For that, I need to go back to the repartition the hard drive once again. Lucky I did documented the first time!

I believe there are some very interesting technologies in Leopard. Core Animation being one of them. As I have been always interested in Special FX, game development and movie creation, it seems like a natural choice. So, once I get Leopard installed, along with the latest Xcode 3, I will take the material for Core Animation and try to grasp the basics before getting to San Francisco. I do have some ideas of things that would be nice to implement in Xslimmer, and even some ideas about possible new apps that we could create using Core Animation and other Leopard technologies. If I just had a more time...

Anyhow, I hope next week will be a fun one. I am really looking forward to meeting other Mac developers, whatever exciting news Steve Jobs provides us with, and all the possible learnings I can get.

If you are around, and would like to meet, let us know!

Monday, March 12, 2007

Lossless same-drive Mac HD Repartition

Recently I discovered a lossless way to repartition my Mac's main hard drive, without having to boot from an external drive. I have been looking for this for quite a while, as I wanted to install the Mac OS X Leopard preview in order to test the new development tools and maybe try a new feature or two for Xslimmer.



Some people had suggested to use the Bootcamp utility to resize and partition the drive. But I had already installed Windows (basically for gaming) and did not want to lose that partition.

So, I finally read an article on how to do this using the command line command diskutil, and its hidden feature named resizeVolume. If you check the man pages, you will see that there is no information on this matter, but you can obtain some executing "diskutil resizeVolume":

freeport:~ jorge$ diskutil resizeVolume
Disk Utility Tool
Usage: diskutil resizeVolume [Mount Point|Disk Identifier|Device Node] size
...
Non-destructively resize a disk. You may increase or decrease its size.
When decreasing size, you may optionally supply a list of new partitions to create.
Ownership of the affected disk is required.
Valid partition sizes are in the format of .
Valid sizes are B(ytes), K(ilobytes), M(egabytes), G(igabytes), T(erabytes)
Example: 10G (10 gigabytes), 4.23T (4.23 terabytes), 5M (5 megabytes)
resizeVolume is only supported on GPT media with a Journaled HFS+ filesystem.
A size of "limits" will print the range of valid values for the current filesystem.
Example: diskutil resizeVolume disk1s3 10G
JHFS+ HDX1 5G MS-DOS HDX2 5G
Valid filesystems: "Case-sensitive HFS+" "Journaled HFS+" "Case-sensitive Journaled HFS+" "HFS+" "HFS" "MS-DOS FAT32" "MS-DOS FAT16" "MS-DOS" "MS-DOS FAT12" "UFS" "Linux" "Swap"


So, as you can see, to resize a partition you first need to know its name. For that you can use "diskutil list":

freeport:~ jorge$ diskutil list
/dev/disk0
#: type name size identifier
0: GUID_partition_scheme *465.8 GB disk0
1: EFI 200.0 MB disk0s1
2: Apple_HFS Macintosh HD 434.0 GB disk0s2
3: Microsoft Basic Data WINDOWS HD 31.4 GB disk0s3


In my case, the partition was disk0s2. The partition scheme or the EFI partition should be ignored. As I said before, I already had a Mac OS partition and the Bootcamp partition. I wanted to create a new 20 Gb partition out of the main Mac OS partition, disk0s2.

Now, there are some limitations to the resizing. I guess it has to do with how much free space you have in the partition you want to divide. To verify the limitation, you use "diskutil resizeVolume partition_name limits":

freeport:~ jorge$ diskutil resizeVolume disk0s2 limits
For device disk0s2 Macintosh HD:
Current size: 466003951616 bytes
Minimum size: 213448208384 bytes
Maximum size: 466003951616 bytes


Finally, you have to provide the resizing parameters to the "diskutil resizeVolume" command. In my case, I wanted to keep 414Gb for the main partition and create a new Journaled HFS+ with 20Gb:

freeport:~ jorge$ diskutil resizeVolume disk0s2 414G JHFS+ Leopard 20G
Started resizing on disk disk0s2 Macintosh HD
Verifying
Resizing Volume
Adjusting Partitions

Finished resizing on disk disk0s2 Macintosh HD
You will need to manually reformat your new partitions.
WARNING: You must now reboot!


In my case the first step, "Verifying" was what took the longest time. After that it all went very fast.

Once done, you should reboot. After rebooting, you can use diskutil or Disk Utility to prepare that new partition for use.

freeport:~ jorge$ diskutil list
/dev/disk0
#: type name size identifier
0: GUID_partition_scheme *465.8 GB disk0
1: EFI 200.0 MB disk0s1
2: Apple_HFS Macintosh HD 414.0 GB disk0s2
3: Apple_HFS 19.9 GB disk0s3
4: Microsoft Basic Data WINDOWS HD 31.4 GB disk0s4


In my case, I used Disk Utility, selecting the new partition, the Erase tab, then proving a name for the partition, and clicking on the Erase button.

freeport:~ jorge$ diskutil list
/dev/disk0
#: type name size identifier
0: GUID_partition_scheme *465.8 GB disk0
1: EFI 200.0 MB disk0s1
2: Apple_HFS Macintosh HD 414.0 GB disk0s2
3: Apple_HFS Leopard HD 19.9 GB disk0s3
4: Microsoft Basic Data WINDOWS HD 31.4 GB disk0s4

(Update) One more thing needs to be done. This time is for Windows to keep running fine. You should edit boot.ini (I used textmate), so it knows the partition is it located in. Mine looked like this:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(3)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
As you see, it says partition(3) for the Windows partition, which is now wrong. I changed it to partition(4) and it worked like a charm. Notice partition(3) appears twice, you should change both.

All set!

Now I have Leopard on my Mac along with Tiger and Windows, thanks to these simple operations. Needless to say, before you attempt to do anything like this, you should have a backup.

[Update: I wrote a second part of this article]

Disclaimer: Visitors do assume all the risk of viewing, reading, using, or relying upon this information. We assume no responsibility for damage to computers or software of the visitor or any person the visitor subsequently communicates this information to.

Have fun!