Last active
February 26, 2019 19:45
-
-
Save pepasflo/c0cd0858d1b76db6d057582e6ac430b8 to your computer and use it in GitHub Desktop.
Revisions
-
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Note: this is just a draft -- the last time I followed this process was a few ye In addition to using something like [Time Machine](https://support.apple.com/en-us/HT201250) to backup your Mac, I also recommend creating a "disaster recovery" backup by making an exact byte-for-byte copy of the hard drive itself. This is a universal method which can be used with any kind of computer (not just Macs). If the hard drive contents are changing while backup is in-progress, this can result in a corrupted backup. This means you can't be booted from the hard drive which you are trying to backup. In the old days, this was easy: simply remove the hard drive from the machine, plug it into another machine, and image the drive. That's a bit of a pain with modern Mac laptops. -
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,7 @@ This means you can't be booted from the hard drive which you are trying to backu In the old days, this was easy: simply remove the hard drive from the machine, plug it into another machine, and image the drive. That's a bit of a pain with modern Mac laptops. An alternative to removing the hard drive is to boot the mac off of a [USB flash drive](https://en.wikipedia.org/wiki/USB_flash_drive). ## Create a bootable flash drive -
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ This is a universal method which can be used with any kind of computer (not just However, you need to ensure that the hard drive isn't changing (being written to) as you are performing the backup. This means you can't be booted from the hard drive which you are trying to backup. In the old days, this was easy: simply remove the hard drive from the machine, plug it into another machine, and image the drive. That's a bit of a pain with modern Mac laptops. An alternative to removing the hard drive is to boot the mac off of an external drive, such as a [USB flash drive](https://en.wikipedia.org/wiki/USB_flash_drive). -
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Note: this is just a draft -- the last time I followed this process was a few ye ## Create a "disaster recovery" backup of your Mac by making an exact copy of the disk In addition to using something like [Time Machine](https://support.apple.com/en-us/HT201250) to backup your Mac, I also recommend creating a "disaster recovery" backup by making an exact byte-for-byte copy of the hard drive itself. This is a universal method which can be used with any kind of computer (not just Macs). However, you need to ensure that the hard drive isn't changing (being written to) as you are performing the backup. -
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Note: this is just a draft -- the last time I followed this process was a few ye ## Create a "disaster recovery" backup of your Mac by making an exact copy of the disk In addition to using something like [Time Machine](https://support.apple.com/en-us/HT201250) to backup your Mac, I also recommend creating a "disaster recovery" backup by making an exact copy of the hard drive itself. This is a universal method which can be used with any kind of computer (not just Macs). However, you need to ensure that the hard drive isn't changing (being written to) as you are performing the backup. -
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ Note: this is just a draft -- the last time I followed this process was a few years ago, so don't use this guide until I actually give it a test run. ## Create a "disaster recovery" backup of your Mac by making an exact copy of the disk An alternative to using [Time Machine](https://support.apple.com/en-us/HT201250) to backup your Mac is to copy an image of the hard drive directly. This is a universal method which can be used with any kind of computer (not just Macs). -
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,6 @@ Run `dd if=/dev/disk0 bs=1m | gzip --fast > /Volumes/UNTITLED/mybackup.dd.gz` This will use `dd` to read `/dev/disk0` in 1 megabyte chunks (which speeds things up a bit), uses `gzip` to compress the backup image, and writes the backup to a file named `/Volumes/UNTITLED/mybackup.dd.gz` ## Restoring from the backup If you later need to restore from this backup, boot your Mac from the same USB flash drive, open a terminal, plug in your external USB drive, and run `dd if=/Volumes/UNTITLED/mybackup.dd.gz | gunzip > /dev/disk0`. Your Mac should now be restored to the exact state at which you performed the backup. -
pepasflo revised this gist
Feb 26, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ That's a bit of a pain with modern Mac laptops. An alternative to removing the hard drive is to boot the mac off of an external drive, such as a [USB flash drive](https://en.wikipedia.org/wiki/USB_flash_drive). However, this means we need a working operating system on the flash drive. ## Create a bootable flash drive A universal way of doing this would be to install something like [Knoppix](https://en.wikipedia.org/wiki/Knoppix) to the flash drive. However, Knoppix may not be compatible with the latest Mac hardware. -
pepasflo created this gist
Feb 26, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ Note: this is just a draft -- the last time I followed this process was a few years ago, so don't use this guide until I actually give it a test run. ## Backing up your Mac by making an exact copy of the disk An alternative to using [Time Machine](https://support.apple.com/en-us/HT201250) to backup your Mac is to copy an image of the hard drive directly. This is a universal method which can be used with any kind of computer (not just Macs). However, you need to ensure that the hard drive isn't changing (being written to) as you are performing the backup. This means you can't be booted from the hard drive which you are trying to backup. In the old days, the easy way to do this was to remove the hard drive from the machine, plug it into another machine, and image the drive. That's a bit of a pain with modern Mac laptops. An alternative to removing the hard drive is to boot the mac off of an external drive, such as a [USB flash drive](https://en.wikipedia.org/wiki/USB_flash_drive). However, this means we need a working operating system on the flash drive. ## Creating a bootable flash drive A universal way of doing this would be to install something like [Knoppix](https://en.wikipedia.org/wiki/Knoppix) to the flash drive. However, Knoppix may not be compatible with the latest Mac hardware. You can instead use the Mac OS installer application to create an installer which boots and runs from a flash drive. Apple publishes a [guide](https://support.apple.com/en-us/HT201372) for doing just this. The summary is: - Partition and format the USB flash drive as Mac OS Extended. - `sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume` ## Boot from the flash drive Hold the 'option' key while booting, which should present a boot menu. ## Launch a terminal When your Mac boots from the flash drive, it should automatically start the Mac OS installer. From the menu at the top of your screen, there should be an option to open a terminal (which will exit the Mac OS Installer). ## Create the backup Plug in an external USB hard drive onto which you will write the backup file. Run `df -h` to see where your Mac mounted the external drive (e.g. `/Volumes/UNTITLED`). Run `diskutil list` and find the device name which describes the hard drive internal to your Mac (e.g. `/dev/disk0`). Run `dd if=/dev/disk0 bs=1m | gzip --fast > /Volumes/UNTITLED/mybackup.dd.gz` This will use `dd` to read `/dev/disk0` in 1 megabyte chunks (which speeds things up a bit), uses `gzip` to compress the backup image, and writes the backup to a file named `/Volumes/UNTITLED/mybackup.dd.gz` ## Restoring the backup If you later need to restore from this backup, boot your Mac from the same USB flash drive, open a terminal, plug in your external USB drive, and run `dd if=/Volumes/UNTITLED/mybackup.dd.gz | gunzip > /dev/disk0`. Your Mac should now be restored to the exact state at which you performed the backup.