{"id":60,"date":"2011-07-14T23:16:21","date_gmt":"2011-07-15T03:16:21","guid":{"rendered":"http:\/\/provideotech.org\/wp\/?p=60"},"modified":"2012-02-02T01:06:54","modified_gmt":"2012-02-02T06:06:54","slug":"converting-a-volume-with-data-on-it-to-a-mirrored-raid-volume-in-macos-x","status":"publish","type":"post","link":"https:\/\/provideotech.org\/?p=60","title":{"rendered":"Converting a volume with data on it to a mirrored RAID volume in MacOS X"},"content":{"rendered":"<p>Since the days of Panther, Apple has included the ability to create and boot from Apple software RAIDs. \u00a0Unfortunately, regardless of how you ordered your XServe (RIP) or MacPro or mini server, the system comes with two drives, one with a clean system installed, the other completely empty. \u00a0While it is easy to reinstall and reformat the system from scratch, I find more beneficial to simply add that second empty drive to a &#8220;hot&#8221; RAID set that can be created on the fly. \u00a0This can be done fairly easily with a few simple command line arguments.<\/p>\n<p>First things first, we need to promote our current volume to a RAID set. \u00a0We can&#8217;t do that while we are booted from the volume, so the best bet is to boot from a diagnostic drive or the system install DVD. \u00a0Once you have booted into your diagnostic system of choice, open up a terminal so we can get down to business.<br \/>\n<!--more--><br \/>\nWe will be using the built in &#8220;diskutil&#8221; command to do all of our operations. \u00a0For more info on the tool, simply type &#8220;man diskutil&#8221;.<\/p>\n<p>The first command we are going to run is going to tell us what disks we have in the system and their identifiers. \u00a0We will need some of this info for future tasks.<\/p>\n<pre>MikesMacbookPro17:~ szumlins$ diskutil list\r\n\/dev\/disk0\r\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\r\n   0:      GUID_partition_scheme                        *500.1 GB   disk0\r\n   1:                        EFI                         209.7 MB   disk0s1\r\n   2:                  Apple_HFS System_Drive            499.8 GB   disk0s2\r\n\/dev\/disk1\r\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\r\n   0:      GUID_partition_scheme                        *4.0 GB     disk1\r\n   1:                        EFI                         209.7 MB   disk1s1\r\n   2:                  Apple_HFS New RAID Member         3.6 GB     disk1s2\r\n\/dev\/disk2\r\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\r\n   0:      GUID_partition_scheme                        *2.0 GB     disk2\r\n   1:                  Apple_HFS Volume With Data On It  1.9 GB     disk2s1<\/pre>\n<p>You will notice I have a couple of volumes created for this tutorial.  The first is a volume labeled &#8220;Volume With Data On It&#8221;, the other is &#8220;New RAID Member&#8221;.  I am using small thumb drives for this, so you can see the volume size is small.  It is important to remember that you can&#8217;t add a member to a RAID set that is smaller than the existing volume size.  The next thing we need to do is convert our standard HFS+ volume into a RAID set using the &#8220;appleRAID&#8221; command set in diskutil.<\/p>\n<pre>MikesMacbookPro17:~ szumlins$ diskutil appleraid enable mirror disk2s1\r\nStarted RAID operation on disk2s1 Volume With Data On It\r\nResizing disk\r\nUnmounting disk\r\nAdding booter for disk\r\nCreating RAID set\r\nBringing RAID partition online\r\nWaiting for new RAID to spin up \"3301DE90-DF2C-4EF7-B0A6-8467D0ADE8AE\"\r\nFinished RAID operation on disk2s1 Volume With Data On It<\/pre>\n<p>Lets break down the command.  First we call &#8220;diskutil&#8221;.  The next command enters into the RAID command set using &#8220;appleraid&#8221;.  We are going to enable a RAID set, so we call &#8220;enable  &#8220;.  Our options for RAID type or mirror or concatenated disk set.  We can&#8217;t do RAID0 here as that would require a reformat.  After that, we call out our partition with existing data on it, in this case &#8220;disk2s1&#8221;.  To find this info, refer to our first command.  Don&#8217;t forget to make note of the RAID UUID, we will use it later.<\/p>\n<p>Lets run that first command command again.<\/p>\n<pre>MikesMacbookPro17:~ szumlins$ diskutil list\r\n\/dev\/disk0\r\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\r\n   0:      GUID_partition_scheme                        *500.1 GB   disk0\r\n   1:                        EFI                         209.7 MB   disk0s1\r\n   2:                  Apple_HFS System_Drive            499.8 GB   disk0s2\r\n\/dev\/disk1\r\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\r\n   0:      GUID_partition_scheme                        *4.0 GB     disk1\r\n   1:                        EFI                         209.7 MB   disk1s1\r\n   2:                  Apple_HFS New RAID Member         3.6 GB     disk1s2\r\n\/dev\/disk2\r\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\r\n   0:      GUID_partition_scheme                        *2.0 GB     disk2\r\n   1:                 Apple_RAID                         1.9 GB     disk2s1\r\n   2:                 Apple_Boot Boot OSX                134.2 MB   disk2s2\r\n\/dev\/disk3\r\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\r\n   0:                  Apple_HFS Volume With Data On It *1.9 GB     disk3<\/pre>\n<p>You will see that we now have an Apple_RAID disk at disk2.  Note that now our disk labeling may have changed since we started.  If we got this far, we can run one more command to verify our RAID set is set up.<\/p>\n<pre>MikesMacbookPro17:~ szumlins$ diskutil appleraid list\r\nAppleRAID sets (1 found)\r\n===============================================================================\r\nName:                 Volume With Data On It\r\nUnique ID:            3301DE90-DF2C-4EF7-B0A6-8467D0ADE8AE\r\nType:                 Mirror\r\nStatus:               Degraded\r\nSize:                 1.9 GB (1877934080 Bytes)\r\nRebuild:              manual\r\nDevice Node:          disk3\r\n-------------------------------------------------------------------------------\r\n#   Device Node       UUID                                   Status\r\n-------------------------------------------------------------------------------\r\n0   disk2s1           694F3618-0317-4DC3-A8F1-44B4D5961E5C   Online\r\n===============================================================================<\/pre>\n<p>At this point, it is safe to restart back into our system install to complete the process.  You can continue on from the diagnostic drive, but you will have to wait until the RAID rebuilds itself otherwise it will enter a failure state.  If you enter a failure state at this stage, you will have to remove your secondary failed drive and re-add it.<\/p>\n<p>After the reboot, fire up another Terminal session so we can complete the process.<\/p>\n<p>Run &#8220;diskutil appleraid list&#8221; again as well as &#8220;diskutil list&#8221; to get all of your important info, and then it is time to add our new RAID member.<\/p>\n<pre>MikesMacbookPro17:~ szumlins$ diskutil appleraid add member disk1 3301DE90-DF2C-4EF7-B0A6-8467D0ADE8AE\r\nStarted RAID operation on disk3 Volume With Data On It\r\nUnmounting disk\r\nRepartitioning disk1 for RAID\r\nThe added target disk is larger than the RAID set. This will result in unused disk space on the target disk 'disk1s2'\r\nAdding disk1s2 to RAID Set\r\nFinished RAID operation on disk3 Volume With Data On It<\/pre>\n<p>It is important to note that disk1 is the actually root device, not the partition of our secondary disk.  All the data on the  disk will be deleted when your run this command.  We are in our &#8220;appleraid&#8221; command subset, but this time we use the &#8220;add&#8221; command.  The first variable is the root disk of our new mirror member, the second command is the UUID of the RAID set we are adding it to.   If all goes well, you now have a live RAID1 set!<\/p>\n<p>Run our &#8220;diskutil appleraid list&#8221; command one more time and you can see our volume is rebuilding.  Launching \/Applications\/Disk Utility.app will also bring up a GUI meter of the rebuild process.<\/p>\n<pre>MikesMacbookPro17:~ szumlins$ diskutil appleraid list\r\nAppleRAID sets (1 found)\r\n===============================================================================\r\nName:                 Volume With Data On It\r\nUnique ID:            3301DE90-DF2C-4EF7-B0A6-8467D0ADE8AE\r\nType:                 Mirror\r\nStatus:               Degraded\r\nSize:                 1.9 GB (1877934080 Bytes)\r\nRebuild:              manual\r\nDevice Node:          disk3\r\n-------------------------------------------------------------------------------\r\n#   Device Node       UUID                                   Status\r\n-------------------------------------------------------------------------------\r\n0   disk2s1           694F3618-0317-4DC3-A8F1-44B4D5961E5C   Online\r\n1   disk1s2           22DCB47D-081E-4843-9483-4EAA02D3A9F7   4% (Rebuilding)\r\n===============================================================================<\/pre>\n<p>One last note:  Don&#8217;t restart the system until the RAID is finished rebuilding and shows online.  Doing a little command line piping we can pretty quickly see from a Terminal how far along we are and can monitor remotely.<\/p>\n<pre>MikesMacbookPro17:~ szumlins$ diskutil appleraid list | tail -2 | head -1\r\n1   disk1s2           22DCB47D-081E-4843-9483-4EAA02D3A9F7   4% (Rebuilding)<\/pre>\n<p>The tail command takes the last two lines, the head command takes only the first line from that.  Doing this just returns the line we care about.  You could use something like &#8220;cut&#8221; to even refine further if you wanted.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since the days of Panther, Apple has included the ability to create and boot from Apple software RAIDs. \u00a0Unfortunately, regardless of how you ordered your XServe (RIP) or MacPro or mini server, the system comes with two drives, one with a clean system installed, the other completely empty. \u00a0While it is easy to reinstall and &hellip; <a href=\"https:\/\/provideotech.org\/?p=60\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Converting a volume with data on it to a mirrored RAID volume in MacOS X&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11,6],"tags":[],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-apple","category-storage"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bwLw-Y","_links":{"self":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=60"}],"version-history":[{"count":0,"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/60\/revisions"}],"wp:attachment":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}