Return to site

Erase Disk Mac Terminal

broken image


I'm trying to delete all the partitions on my SSD drive and create new GUID (HFS+) partition table. Native Disk Utility is unable to eject disk to re-partition it. From the terminal, which is included in the OS X install, I've ran diskutil and here is the output: diskutil unmountDisk force. Locating the Disk. All of the disks that are attached to the Mac are located within the Volumes directory in Terminal. This directory is located one step away from the root of the Mac. The command used to switch from directory to directory is cd. In the terminal a /is known as the root, or lowest level, directory.

Erase Disk Mac Terminal Linux

Disk Utility within Mac OS X provides a range of disk management tools, from erasing and repartitioning hard disks to restoring images and repairing volumes. It's a simple way of interacting with attached storage on your Mac.

  1. Container disk 2 1 Macintosh HD; 1 The disk identifier may be another number. Select Container disk 2 in the sidebar and click the Erase icon in the toolbar. At the prompt, enter Macintosh HD for the Name – it will likely be pre-populated with Preboot – and select Mac OS Extended (Journaled) for the Format. Click the Erase button.
  2. If you use Disk Utility to erase an APFS volume and format it HFS+, you'll find that the old APFS container sticks around. The same thing happens if you use diskutil the wrong way.

Beyond this graphical front-end are some powerful command-line tools that we can use directly. In this series, we'll look at how to replicate the functionality of Disk Utility at the command-line.

The following guide will require the use of an external hard drive which will be erased and partitioned.

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.

In order to store data on a partition, it needs a filesystem. Once a partition has been formatted, this combination of partition and filesystem is known as a volume.

Here's a USB hard drive that has been split into 16 partitions, all of which will display separately on the Mac as separate volumes since they've been formatted, though they are all on the same drive.

Imagine you have a loft apartment that's just four outer walls. Think of partitioning as putting up dividing walls to create additional rooms. The more walls you put up, the more rooms you'll have, but all limited to the total amount of space you first had available.

But these rooms can't be used yet, not until you decide what each room will be. Formatting a disk partition is no different than deciding which room will be the bedroom or kitchen. At that point, it becomes a volume.

With the introduction of OS X Lion, your Mac's hard disk is split into two partitions with two corresponding volumes. The first is hidden and named Recovery HD for OS X Recovery, allowing you to reinstall OS X without needing any physical media. The second is the more familiar Macintosh HD.

Benefits of the Command-Line

Disk Utility is more than adequate to perform any form of disk management for most users. It's also safer than the command-line, displaying warning dialogs before proceeding with any potentially destructive functions.

For more experienced users, the command-line offers a greater level of flexibility and control so that what would normally require several different interactions and mouse clicks can be done with just one command.

Disk Information with diskutil

The diskutil command provides many of the features of Disk Utility, from verifying and repairing volumes to changing partition information.

To view the full list of available options for the command, enter the command diskutil.

Partition Information

Using the list option will display some basic information about all available volumes and drives attached. Within Terminal, enter:

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 Untitled.

There are some hidden partitions (such as EFI) used for the purposes of providing drivers and settings during boot. These aren't volumes since they cannot be mounted.

Depending on whether you have features such as FileVault 2 or Fusion Drive, your partition layout might differ slightly to what is pictured above.

For many of the options within diskutil, it's necessary to use the disk or partition's Identifier. Using list will provide you with this information.

Should you have a number of disks and only want to view information about a specific one, you can append the disk identifier to the command:

The first number represents the physical disk identifier. Is there a program like word for mac. The number following the letter 's' represents the partition number. If a disk has three partitions, it would follow this convention:

  • disk2s1
  • disk2s2
  • disk2s3

In addition to list, you can also use info with the corresponding identifier to display even further information, like so:

Verifying and Repairing Volumes

As within Disk Utility, the diskutil command can be used to verify or repair volumes of any errors and is very straightforward to do using either verifyVolume or repairVolume. These options don't need the disk identifier, just the volume's name:

If the feedback within Terminal looks familiar, that's because it's the same information Disk Utility provides.

Disk permissions can also be verified and repaired using two similar commands:

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:

You'll notice this command has a little more going on than previous ones. The structure of the command is:

Erasing a whole disk will clear any partitions and create a new, single partition, before formatting it as a volume.

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

Erasing volumes doesn't erase or affect the entire disk, only the volume you specify.

Here is an external drive that's partitioned with two volumes, FirstVolume and SecondVolume. To erase SecondVolume, the command is:

The command's structure is almost identical to using eraseDisk, only that you specify the volume rather than disk. Should a disk contain multiple volumes, only the one you specify is altered.

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 reformat option will erase the contents of the volume without requiring the filesystem or name, provided these are to remain unchanged.

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:

Wrapping Up

We've only scratched the surface of diskutil yet covered quite a lot. While the graphical interface of Disk Utility can be easier to interact with, a task that would involve several steps can be accomplished with just one single command.

In the next part of this series, we'll cover how to manage partitioning and modify volumes.

You can purchase the complete guide to Disk Management From the Command-Line that includes Building an OS X Triage Drive as an ebook in ePub and PDF format for just $0.99.

Disk Utility within Mac OS X provides a range of disk management tools, from erasing and repartitioning hard disks to restoring images and repairing volumes. It's a simple way of interacting with attached storage on your Mac.

Beyond this graphical front-end are some powerful command-line tools that we can use directly. In this series, we'll look at how to replicate the functionality of Disk Utility at the command-line.

The following guide will require the use of an external hard drive which will be erased and partitioned.

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.

In order to store data on a partition, it needs a filesystem. Once a partition has been formatted, this combination of partition and filesystem is known as a volume.

Here's a USB hard drive that has been split into 16 partitions, all of which will display separately on the Mac as separate volumes since they've been formatted, though they are all on the same drive.

Erase disk image mac terminal

Imagine you have a loft apartment that's just four outer walls. Think of partitioning as putting up dividing walls to create additional rooms. The more walls you put up, the more rooms you'll have, but all limited to the total amount of space you first had available.

But these rooms can't be used yet, not until you decide what each room will be. Formatting a disk partition is no different than deciding which room will be the bedroom or kitchen. At that point, it becomes a volume.

With the introduction of OS X Lion, your Mac's hard disk is split into two partitions with two corresponding volumes. The first is hidden and named Recovery HD for OS X Recovery, allowing you to reinstall OS X without needing any physical media. The second is the more familiar Macintosh HD.

Benefits of the Command-Line

Disk Utility is more than adequate to perform any form of disk management for most users. It's also safer than the command-line, displaying warning dialogs before proceeding with any potentially destructive functions.

For more experienced users, the command-line offers a greater level of flexibility and control so that what would normally require several different interactions and mouse clicks can be done with just one command.

Disk Information with diskutil

The diskutil command provides many of the features of Disk Utility, from verifying and repairing volumes to changing partition information.

Disk utility can

Imagine you have a loft apartment that's just four outer walls. Think of partitioning as putting up dividing walls to create additional rooms. The more walls you put up, the more rooms you'll have, but all limited to the total amount of space you first had available.

But these rooms can't be used yet, not until you decide what each room will be. Formatting a disk partition is no different than deciding which room will be the bedroom or kitchen. At that point, it becomes a volume.

With the introduction of OS X Lion, your Mac's hard disk is split into two partitions with two corresponding volumes. The first is hidden and named Recovery HD for OS X Recovery, allowing you to reinstall OS X without needing any physical media. The second is the more familiar Macintosh HD.

Benefits of the Command-Line

Disk Utility is more than adequate to perform any form of disk management for most users. It's also safer than the command-line, displaying warning dialogs before proceeding with any potentially destructive functions.

For more experienced users, the command-line offers a greater level of flexibility and control so that what would normally require several different interactions and mouse clicks can be done with just one command.

Disk Information with diskutil

The diskutil command provides many of the features of Disk Utility, from verifying and repairing volumes to changing partition information.

To view the full list of available options for the command, enter the command diskutil.

Partition Information

Using the list option will display some basic information about all available volumes and drives attached. Within Terminal, enter:

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 Untitled.

There are some hidden partitions (such as EFI) used for the purposes of providing drivers and settings during boot. These aren't volumes since they cannot be mounted.

Mac mini 3 1 yosemite. Depending on whether you have features such as FileVault 2 or Fusion Drive, your partition layout might differ slightly to what is pictured above.

For many of the options within diskutil, it's necessary to use the disk or partition's Identifier. Using list will provide you with this information.

Should you have a number of disks and only want to view information about a specific one, you can append the disk identifier to the command:

The first number represents the physical disk identifier. The number following the letter 's' represents the partition number. If a disk has three partitions, it would follow this convention:

  • disk2s1
  • disk2s2
  • disk2s3

In addition to list, you can also use info with the corresponding identifier to display even further information, like so:

Verifying and Repairing Volumes

As within Disk Utility, the diskutil command can be used to verify or repair volumes of any errors and is very straightforward to do using either verifyVolume or repairVolume. These options don't need the disk identifier, just the volume's name:

If the feedback within Terminal looks familiar, that's because it's the same information Disk Utility provides.

Disk permissions can also be verified and repaired using two similar commands:

Erasing Disks

Erasing disks from the command-line can be a dangerous process as there aren't any warnings or confirmations. Xeon emulator mac. 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:

You'll notice this command has a little more going on than previous ones. The structure of the command is:

Erasing a whole disk will clear any partitions and create a new, single partition, before formatting it as a volume.

Filesystem

Wipe Disk Utilities

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:

Erase Disk Mac Terminal

How to unlock motorola dct700 cable box. Download acrobat reader for mac catalina. diskutil listFilesystems

Name

Mac Diskutil Erasedisk

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

Erase Disk Mac Terminal

Erasing volumes doesn't erase or affect the entire disk, only the volume you specify.

Here is an external drive that's partitioned with two volumes, FirstVolume and SecondVolume. To erase SecondVolume, the command is:

The command's structure is almost identical to using eraseDisk, only that you specify the volume rather than disk. Should a disk contain multiple volumes, only the one you specify is altered.

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 reformat option will erase the contents of the volume without requiring the filesystem or name, provided these are to remain unchanged.

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:

Wrapping Up

We've only scratched the surface of diskutil yet covered quite a lot. While the graphical interface of Disk Utility can be easier to interact with, a task that would involve several steps can be accomplished with just one single command.

Can i download microsoft word for free on mac. In the next part of this series, we'll cover how to manage partitioning and modify volumes.

You can purchase the complete guide to Disk Management From the Command-Line that includes Building an OS X Triage Drive as an ebook in ePub and PDF format for just $0.99.





broken image