MacOSX: Creating a hard drive backup image
Thursday, 13 of December , 2007 at 12:32 pm
Recently, I have been having a lot of problems with my MacOSX machine at work. The machine contains multiple partitions each of which contains a separate server environment. Up to now, I haven’t been backing-up these partitions. This is a real pain when something goes wrong (like today) because it takes a day to re-configure a server on any given partition.
Anyways, to stop future pain, I’m starting to create compressed images of my partitions.
This is how I created my backups:
- Boot-up your system. Note: You can’t boot from the partition you want to backup.
- Start up the Terminal.
- Find the partition you want backup. You can use the following command:
$mount
/dev/disk0s9 on / (local, journaled)
devfs on /dev (local)
fdesc on /dev (union)
on /.vol
/dev/disk1s3 on /Volumes/Server1 (local, journaled)
/dev/disk0s3 on /Volumes/Server2 (local, journaled)
/dev/disk1s5 on /Volumes/Server3 (local, journaled)
/dev/disk0s5 on /Volumes/Server4 (local, journaled)
/dev/disk0s7 on /Volumes/Server5 (local, journaled)
/dev/disk0s11 on /Volumes/Server6 (local, journaled)
/dev/disk0s13 on /Volumes/Server7 (local, journaled)
/dev/disk0s15 on /Volumes/Server8 (local, journaled)
automount -nsl [176] on /Network (automounted)
automount -fstab [180] on /automount/Servers (automounted)
automount -static [180] on /automount/static (automounted)
- Unmount the partition/drive you want to backup. You can do this by throwing the partition/drive on the desktop to the trash can.
- Next, run the following command where src_name is the drive that you want to backup (ie. disk0s5 ) and dest_name is the drive you want to copy the backup to (ie. Server7)
$sudo dd if=/dev/src_name
| gzip > /Volumes/dest_name/backup.img.gz
If you need to restore the backup, you can run the following command.
$gzip -dc /Volumes/dest_name/backup.img.gz
| sudo dd of=/dev/src_name
Note: There is probably a Mac tool somewhere that does the same thing if you scared of the command prompt.
Recently, I have been having a lot of problems with my MacOSX machine at work. The machine contains multiple partitions each of which contains a separate server environment. Up to now, I haven’t been backing-up these partitions. This is a real pain when something goes wrong (like today) because it takes a day to re-configure a server on any given partition.
Anyways, to stop future pain, I’m starting to create compressed images of my partitions.
This is how I created my backups:
- Boot-up your system. Note: You can’t boot from the partition you want to backup.
- Start up the Terminal.
- Find the partition you want backup. You can use the following command:
$mount /dev/disk0s9 on / (local, journaled) devfs on /dev (local) fdesc on /dev (union)
on /.vol /dev/disk1s3 on /Volumes/Server1 (local, journaled) /dev/disk0s3 on /Volumes/Server2 (local, journaled) /dev/disk1s5 on /Volumes/Server3 (local, journaled) /dev/disk0s5 on /Volumes/Server4 (local, journaled) /dev/disk0s7 on /Volumes/Server5 (local, journaled) /dev/disk0s11 on /Volumes/Server6 (local, journaled) /dev/disk0s13 on /Volumes/Server7 (local, journaled) /dev/disk0s15 on /Volumes/Server8 (local, journaled) automount -nsl [176] on /Network (automounted) automount -fstab [180] on /automount/Servers (automounted) automount -static [180] on /automount/static (automounted) - Unmount the partition/drive you want to backup. You can do this by throwing the partition/drive on the desktop to the trash can.
- Next, run the following command where src_name is the drive that you want to backup (ie. disk0s5 ) and dest_name is the drive you want to copy the backup to (ie. Server7)
$sudo dd if=/dev/src_name
| gzip > /Volumes/dest_name/backup.img.gz
If you need to restore the backup, you can run the following command.
$gzip -dc /Volumes/dest_name/backup.img.gz
| sudo dd of=/dev/src_name
Note: There is probably a Mac tool somewhere that does the same thing if you scared of the command prompt.
Category: Programming
No Comments
No comments yet.
Leave a comment





