Disk Management From The Command-Line, Part 1 - The Instructional
Disk Management From The Command-Line, Part 1 - The Instructional
Disk Management From The Command-Line, Part 1 - The Instructional
Guides
Ebooks
About
Membership
Follow
Contact
Search
Highly Recommended
TextExpander 4
Reader Support
month.
Terminology
A partition is a logical storage unit located on a hard
disk. A hard disk can contain a single partition, making
use of all the space it contains, or it can be split into
multiple partitions.
1/10
9/11/2014
volume.
Email Address
Categories
Highly Recommended
General
Offsite
Here's a USB hard drive that has been split into 16
iOS
Mac
Archives
September 2014
the more rooms you'll have, but all limited to the total
August 2014
July 2014
But these rooms can't be used yet, not until you decide
June 2014
May 2014
April 2014
March 2014
volume.
February 2014
2/10
9/11/2014
Partition Information
Using the listoption will display some basic
information about all available volumes and drives
attached. Within Terminal, enter:
diskutil list
In the following screenshot, you can see both the
Recovery HD and Macintosh HD, both partitions
contained on the Mac's internal hard disk. An external
hard disk is also connected with a volume labeled
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
3/10
9/11/2014
Untitled.
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
4/10
9/11/2014
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
5/10
9/11/2014
Erasing Disks
Erasing disks from the command-line can be a
dangerous process as there aren't any warnings or
confirmations. One typo could lead to irreversible data
loss if there's no backup to restore from. If you're not
familiar with the command-line, Disk Utility is just as
capable.
You can either erase a whole disk which will remove
any partitions stored upon it, or individual volumes
without affecting others.
To erase an entire disk, you'll need the disk identifier,
enter the following, adjusting the disk identifier to suit:
diskutil eraseDisk JHFS+ Test /dev/{disk identifier}
You'll notice this command has a little more going on
than previous ones. The structure of the command is:
diskutil eraseDisk {filesystem} {Name to use} /dev/{disk identifier}
Erasing a whole disk will clear any partitions and create
a new, single partition, before formatting it as a
volume.
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
6/10
9/11/2014
Filesystem
You can specify the filesystem to format the partition
in by using any that are supported. The most common
would be JHFS+ which is more commonly known as
Mac OS Extended (Journaled).
To find out which filesystems you can use, enter:
diskutil listFilesystems
Name
This simply refers to the name of the volume that will
be created. In this instance, I've just labelled the
volume as "Test".
Disk Identifier
Only the primary part of the identifier (i.e. disk1, disk2,
disk3...) is needed. The additional segment indicating
the partition number is omitted.
Erasing Volumes
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
7/10
9/11/2014
Reformatting Volumes
You'll notice that erasing a volume requires specifying
the filesystem and name. This can be a bit tedious if
you don't actually want to change either of these, but
simply want to erase the contents.
Instead, the reformatoption will erase the contents
of the volume without requiring the filesystem or
name, provided these are to remain unchanged.
diskutil reformat /Volumes/SecondVolume
Now, the volume will be erased but retain the existing
filesystem and name.
Renaming Volumes
Within the Finder, you can quite easily rename the
volume by selecting it on your desktop and pressing
the Return key, just like you would any file or folder.
Renaming volumes within the Terminal uses a
different method than the renaming of files and folder,
something accomplished by using the command:
diskutil rename "{current name of volume}" "{new name}"
Wrapping Up
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
8/10
9/11/2014
Remote System
Comments (2)
Newest First
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
9/10
9/11/2014
Preview
Post Comme nt
adam deyo
4 weeks ago
David Dingley
A month ago
http://www.theinstructional.com/guides/disk-management-from-the-command-line-part-1
10/10