{"id":2013,"date":"2014-10-24T08:18:33","date_gmt":"2014-10-24T08:18:33","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=2013"},"modified":"2014-10-24T13:29:39","modified_gmt":"2014-10-24T13:29:39","slug":"corestorage-secret-command-overview","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=2013","title":{"rendered":"CoreStorage Secret Command Overview"},"content":{"rendered":"<p>NOTE : 10.10 all of the CS Command&#8217;s now work so you can add a new drive to an existing CS LV !!!<\/p>\n<p>The\u00a0<strong>diskutil<\/strong>\u00a0command is the core command line interface for CoreStorage, along with regular disk partitioning, AppleRAID, and other disk activities.<\/p>\n<p>All CoreStorage functions use the \u201ccoreStorage\u201d adverb, which can be abbreviated \u201ccs\u201d. For example, to show status of all CoreStorage volumes, one may type either:<\/p>\n<pre>diskutil coreStorage list<\/pre>\n<p>or<\/p>\n<pre>diskutil cs list<\/pre>\n<p>Typing just \u201cdiskutil cs\u201d will show a list of nine supported \u201cverbs\u201d, but there are six other undocumented commands as well. Perhaps these are not fully functional (though all worked fine in my testing), or perhaps Apple simply wasn\u2019t ready to expose them for end users to use.<\/p>\n<p>I have grouped all 15 CoreStorage verbs by functional area, and note here which are officially listed and which are undocumented.<\/p>\n<p><strong>Informational Commands<\/strong><\/p>\n<ul>\n<li>list \u2013 Show all CoreStorage volumes<\/li>\n<li>info[rmation] \u2013 Get detailed information about a physical volume<\/li>\n<\/ul>\n<p><strong>Conversion Commands<\/strong><\/p>\n<ul>\n<li>convert \u2013 Convert a volume into a CoreStorage volume<\/li>\n<li>revert \u2013 Revert a CoreStorage volume to its native type<\/li>\n<\/ul>\n<p><strong>Logical Volume Group Commands<\/strong><\/p>\n<ul>\n<li>create \u2013 Create a new CoreStorage logical volume group<\/li>\n<li>delete \u2013 Delete a CoreStorage logical volume group<\/li>\n<\/ul>\n<p><strong>Physical Volume (Disk) Commands<\/strong><\/p>\n<ul>\n<li>resizeDisk (undocumented) \u2013 Resize a physical volume<\/li>\n<li>removeDisk\u00a0(undocumented) \u2013 Remove a physical volume from a logical volume group<\/li>\n<li>addDisk\u00a0(undocumented)\u00a0\u2013 Add a new physical volume to a logical volume group<\/li>\n<\/ul>\n<p><strong>Logical Volume Commands<\/strong><\/p>\n<ul>\n<li>createVolume \u2013 Create a new logical volume<\/li>\n<li>unlockVolume \u2013 Mount an existing encrypted logical volume<\/li>\n<li>changeVolumePassphrase \u2013 Change the encryption password for a logical volume<\/li>\n<li>deleteVolume\u00a0(undocumented) \u2013 Delete a logical volume and all of its contents<\/li>\n<li>resizeVolume\u00a0(undocumented) \u2013 Grow or shrink a logical volume (non-destructive)<\/li>\n<li>resizeStack\u00a0(undocumented) \u2013 Grow or shrink a logical volume as well as the logical volume group and physical volume that supports it<\/li>\n<\/ul>\n<h3>CoreStorage Informational Commands<\/h3>\n<p>Two commands are for information about volumes and disks. Note that these only return information about CoreStorage volumes: Use the bare \u201cdiskutil list\u201d and \u201cdiskutil info\u201d commands for non-encapsulated storage.<\/p>\n<h4>list<\/h4>\n<pre>Usage:  diskutil coreStorage list\r\n        diskutil coreStorage list -plist\r\n        diskutil coreStorage list UUID\r\nList all current CoreStorage objects in a tree-like view.<\/pre>\n<h4>info[rmation]<\/h4>\n<p>The verbs \u201cinfo\u201d or \u201cinformation\u201d get CoreStorage information by UUID.<\/p>\n<h3>CoreStorage Conversion Commands<\/h3>\n<p>These commands are used to convert a drive or volume to or from CoreStorage.<\/p>\n<h4>convert<\/h4>\n<pre>Usage:  diskutil coreStorage convert\r\n        MountPoint|DiskIdentifier|DeviceNode\r\n        [-stdinpassphrase | -passphrase [passphrase]]\r\nConvert a regular JHFS+ partition into a CoreStorage logical volume.\r\nThe file system must be mounted and resizable (i.e. Journaled HFS+).\r\nOwnership of the affected disk is required.<\/pre>\n<p>Note that CoreStorage only functions on drives that meet the following criteria:<\/p>\n<ol>\n<li>Partition type is GPT<\/li>\n<li>Filesystem type is Journaled HFS+ (JHFS+)<\/li>\n<\/ol>\n<p>Conversion from the command line is non-destructive (unlike using Disk Utility) and is the one shot you have to encrypt a volume. If you convert it without the passphrase, it will be placed in a LVF with no encryption and there is no command to encrypt it later!<\/p>\n<h4>revert<\/h4>\n<pre>Usage:  diskutil coreStorage revert\r\n        MountPoint|DiskIdentifier|DeviceNode|lvUUID\r\n        [-stdinpassphrase | -passphrase [passphrase] | -recoverykeychain file]\r\nConvert a CoreStorage logical volume back to its native type.\r\nThe file system must be mounted and resizable (i.e. Journaled HFS+).\r\nOwnership of the affected disk and a passphrase (if encrypted) is required.<\/pre>\n<p>Reverting a CoreStorage volume completely returns it to its original state, including restoring the partition type and removing encryption. And it\u2019s non-destructive. Slick!<\/p>\n<h3>CoreStorage Logical Volume Group Commands<\/h3>\n<p>These commands manipulate logical volume groups (LVGs) that have previously been created. Most use the \u201cLVG Name\u201d, which you can discover using the \u201cdiskutil cs list\u201d command.<\/p>\n<h4>create<\/h4>\n<pre>Usage:  diskutil coreStorage create lvgName\r\n        MountPoint|DiskIdentifier|DeviceNode ...\r\nCreate a CoreStorage logical volume group from one more more disks.\r\nThe specified disks will become the initial set of PVs.\r\nAll existing data on the drive will be lost.\r\nOwnership of the affected disk is required.\r\nExample: diskutil coreStorage create MyLVG disk1<\/pre>\n<p>Note that this command is destructive. Say goodbye to your data or use the \u201ccs convert\u201d command! It automatically creates a PV for you.<\/p>\n<h4>delete<\/h4>\n<pre>Usage:  diskutil coreStorage delete lvgUUID\r\nDelete a CoreStorage logical volume group. All logical volumes will be removed.\r\nOwnership of the affected disk is required.<\/pre>\n<p>This is destructive as well. Your volume will be returned to a usable state, but your data will be lost. Use \u201cconvert\u201d and \u201crevert\u201d instead if possible!<\/p>\n<h3>CoreStorage Physical Volume (Disk) Commands<\/h3>\n<p>All physical volume commands are undocumented in Lion 10.7. Proceed with caution! But these are pretty cool, since they allow a LVG to span multiple physical disks!<br \/>\nPV commands use the word, \u201cDisk\u201d, which tells you a lot about what they are and what they do.<br \/>\nNote that the \u201cpvUUID\u201d and \u201clvgUUID\u201d can be discovered in \u201cdiskutil cs list\u201d and refer to the PV and LVG, respectively.<\/p>\n<h4>resizeDisk (undocumented)<\/h4>\n<pre>Usage:  diskutil coreStorage resizeDisk pvUUID size\r\n        [part1Format part1Name part1Size part2Format part2Name part2Size\r\n         part3Format part3Name part3Size ...]\r\nResize a physical volume, which is one of one or more disks that provide storage\r\nto a logical volume group. The logical volume group will have less or more\r\navailable space after this operation, if it was a shrink or grow, respectively.\r\nIf this is a shrink operation, you can optionally request that new partitions\r\nbe created in the newly-formed free space gap.\r\nExample: diskutil coreStorage resizeDisk\r\n         11111111-2222-3333-4444-555555555555 10g JHFS+ New 1g<\/pre>\n<p>This crazy-complicated command allows you to resize (both grow and shrink) active partitions non-destructively.<\/p>\n<h4>removeDisk\u00a0(undocumented)<\/h4>\n<pre>Usage:  diskutil coreStorage removeDisk pvUUID\r\nRemove a physical volume from its CoreStorage logical volume group.\r\nOwnership of the affected disks is required.\r\nExample: diskutil coreStorage removeDisk 11111111-2222-3333-4444-555555555555<\/pre>\n<p>It is unknown what will happen if a used PV is removed from an LVG. Using a combination of addDisk and removeDisk should non-destructively move data from one physical disk to another, but I couldn\u2019t get any of this to work.<\/p>\n<h4>addDisk\u00a0(undocumented)<\/h4>\n<pre>Usage:  diskutil coreStorage addDisk lvgUUID NewMemberDeviceName\r\nAdd a new physical volume to a CoreStorage logical volume group.\r\nOwnership of the affected disks is required.\r\nExample: diskutil coreStorage addDisk\r\n         11111111-2222-3333-4444-555555555555 disk4<\/pre>\n<p>This adds additional physical capacity to an existing LVG.<\/p>\n<h4>CoreStorage Logical Volume Commands<\/h4>\n<p>The logical volume commands are much more functional and friendly. Right now, the only way to really use these is to create a larger-than-needed LV and then shrink it and use the resulting space for new volumes, since you cannot yet fully create a LVG from scratch.<\/p>\n<h4>createVolume<\/h4>\n<p>This creates a new LV (and LVF) within an existing LVG, using space cleared by a previous resizeVolume or deleteVolume command. It appears to always create a new LVF rather than placing an LV within an existing one. And there are no LVF manipulation commands right now.<\/p>\n<pre>Usage:  diskutil coreStorage createVolume lvgUUID type name size\r\n        [-stdinpassphrase | -passphrase [passphrase]]\r\nAdd a new logical volume to a CoreStorage logical volume group.\r\n\r\nType is the file system to initialize on the new logical volume. Valid types\r\nare Journaled HFS+ or Case-sensitive Journaled HFS+ or their aliases.\r\n\r\nSize is the amount of space to allocate from the parent logical volume group.\r\nValid sizes are floating-point numbers with a suffix of B(ytes), S(512-byte-\r\nblocks), K(ilobytes), M(egabytes), G(igabytes), T(erabytes), P(etabytes),\r\nor (%) a percentage of the current size of the logical volume group.\r\n\r\nExample: diskutil coreStorage createVolume\r\n         11111111-2222-3333-4444-555555555555 jhfs+ myLV 10g<\/pre>\n<h4>unlockVolume<\/h4>\n<p>One of the seemingly-handier commands that isn\u2019t really all that useful. It\u2019s rare that you\u2019ll want to do this alone. Use hdiutil to mount a volume instead.<\/p>\n<pre>Usage:  diskutil coreStorage unlockVolume lvUUID\r\n        [-stdinpassphrase | -passphrase passphrase | -recoverykeychain file]\r\nUnlock a logical volume that is encrypted and currently locked. You must\r\nspecify the logical volume by its CoreStorage UUID, because if it is locked\r\nit is not online. A passphrase is mandatory: you must either supply it\r\ninteractively or with one of the above parameters.\r\nExample: diskutil coreStorage unlockVolume 11111111-2222-3333-4444-555555555555<\/pre>\n<h4>changeVolumePassphrase<\/h4>\n<p>A very handy command allowing you to change the passphrase of an existing VileVault 2 encrypted volume. This is probably the one verb that will be somewhat frequently used by the average user!<\/p>\n<pre>Usage:  diskutil coreStorage changeVolumePassphrase|passwd lvUUID\r\n        [-recoverykeychain file] | [-oldpassphrase old]\r\n        [-newpassphrase new] | [-stdinpassphrase]\r\nChange an encrypted logical volume's password. Beyond the CoreStorage UUID,\r\nyou will be prompted interactively for parameters that you do not specify.\r\nParameters must be given in the above order.\r\nExample: diskutil coreStorage changeVolumePassphrase\r\n         11111111-2222-3333-4444-555555555555<\/pre>\n<h4>resizeVolume (undocumented)<\/h4>\n<p>This appears to work fine. You can resize a volume (given its UUID) using this command, and you won\u2019t even lose your data!<\/p>\n<pre>Usage:  diskutil coreStorage resizeVolume lvUUID size\r\nResize a logical volume, which is one of one or more disks that consume storage\r\nout of a logical volume group. The logical volume group will have more or less\r\navailable space after this operation, if it was a shrink or grow, respectively.\r\nExample: diskutil coreStorage resizeVolume\r\n         11111111-2222-3333-4444-555555555555 10g<\/pre>\n<h4>deleteVolume\u00a0(undocumented)<\/h4>\n<p>This also works fine. Create a volume and you can delete it, as long as you get the right UUID from \u201cdiskutil cs list\u201d.<\/p>\n<pre>Usage:  diskutil coreStorage deleteVolume lvUUID\r\nDelete a logical volume.\r\nExample: diskutil coreStorage deleteVolume 11111111-2222-3333-4444-555555555555<\/pre>\n<h4>resizeStack (undocumented)<\/h4>\n<p>Probably the coolest undocumented command, resizeStack takes a complete 1:1:1:1 CoreStorage stack (PV:LVG:LVF:LV) and resizes everything non-destructively. You\u2019re left with a fully-operational but smaller volume and partition. Nifty!<\/p>\n<pre>Usage:  diskutil coreStorage resizeStack lvUUID size\r\n        [part1Format part1Name part1Size part2Format part2Name part2Size\r\n         part3Format part3Name part3Size ...]\r\nResize both a logical volume and its underlying physical volume in a single\r\noperation. The setup must be simple: Exactly one logical volume and one\r\nrelated physical volume can, and must, exist.\r\nIf this is a shrink operation, you can optionally request that new partitions\r\nbe created in the newly-formed free space gap.\r\nExample: diskutil coreStorage resizeStack\r\n         11111111-2222-3333-4444-555555555555 10g JHFS+ New 1g<\/pre>\n<h3>What\u2019s Missing<\/h3>\n<p>These undocumented CoreStorage commands are eye-opening, since it shows that Apple really is working on a complete full-featured volume manager. But lots of functionality is lacking still:<\/p>\n<ol>\n<li>You can create a logical volume group (LVG) by hand, adding multiple disks. It seems like you could, but not on all OS&#8217;s.<\/li>\n<li>There are no commands for manipulating logical volume families (LVFs), and they can\u2019t even be specified when creating new logical volumes (LVs).<\/li>\n<li>The physical volume (PV or disk) commands don\u2019t seem to work on all OS&#8217;s. I guess that\u2019s why they\u2019re undocumented!<\/li>\n<li>There are no advanced data protection features (mirror, snapshot, RAID, replicate)<\/li>\n<li>There is no ability to specify where or how an LV is created or to move an LV from one LVF, PV, or LVG to another.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>NOTE : 10.10 all of the CS Command&#8217;s now work so you can add a new drive to an existing CS LV [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2013","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2013"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2013\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}