Changing a Volume's "Device / Media Name"

The Device / Media Name is set when a partition is created on a disk. The only way you could rename the "startup partition" would be to startup from another drive. The initial name is set by Apple code by the way.

On Lion you will most likely find the following device names:

disk0: The make and model of your drive

  • You'll never change this.

disk0s1: "EFI system partition"

  • Extended firmware for your drive is stored here - you won't be changing this one either.

disk0s2: "Customer"

  • Named for you, Apple's "customer" this is where your files are stored.

disk0s3: "Recovery HD"

  • Apple stores a clean install of the OS here to make restoring your computer easier.

If you add your own custom partition to the mix you will find that Apple's tools (i.e. Disk Utility) will match the visible name and the device name.

All of that said there's no reason you should worry about changing this name. Nothing will reference it at the CLI or GUI level.


The "Device / Media Name" is the partition label from the disk's partition map (GPT - GUID Partition Table).

To change the label for a volume, you'll need to use the terminal.

  1. Get the disk number of interest: diskutil list
  2. Show the current partition labels (note the index of the entry you would like to change):

    sudo gpt show -l /dev/disk0
    

    (Note: replace disk0 with the disk number from step 1)

  3. Eject the disk from the Finder (or use the unmount terminal command if you'd like). If you don't do this, you may get a Resource busy error message during the following step.

  4. Change the partition label as desired:
    sudo gpt label -i 2 -l "My New Partition Label" /dev/rdisk0
    
    (Note: replace the "0" in rdisk0 with the disk number from step 1 and replace the "2" with the index number from step 2)
  5. (optional) Verify the changes by either repeating step 2 or typing: diskutil info disk0s2

For more information see the manual page for the gpt command-line tool: man gpt


Helpfull noticed the following

The View option is not on all Mac's during an Internet recovery as seen on the top left hand corner of "Disk Utility" [Version 17.0 (1635)]- it is available after you boot from some media (eg. an external Crucial 2T SSD - where I have High Sierra installed)

fdisk is useful for finding the GEOMETRY of the disk - eg. c/h/s which stands for cylinders/heads/(sectors per track). Keep in mind that this may be important in some situations related to data recovery.

iMac27:~ cjt$ sudo fdisk /dev/disk1
Disk: /dev/disk1    geometry: 243201/255/63 [3907029164 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 - 3907029163] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
iMac27:~ cjt$ 

This is the same disk using gpt without the -l option. Note that this shows some UNIQUE information - namely a UUID which allows you to reference this 'GPT part' even if you have placed it into a new system. Some people have external disk drive enclosures that run RAID configurations.

iMac27:~ cjt$ sudo gpt show /dev/rdisk1
    start        size  index  contents
        0           1         PMBR
        1           1         Pri GPT header
        2          32         Pri GPT table
       34           6         
       40      409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
   409640  3906357344      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC

3906766984 262147
3907029131 32 Sec GPT table 3907029163 1 Sec GPT header iMac27:~ cjt$

This has more description information and no UUID's info.

iMac27:~ cjt$ sudo gpt show -l /dev/rdisk1
     start        size  index  contents
         0           1         PMBR
         1           1         Pri GPT header
         2          32         Pri GPT table
        34           6         
        40      409600      1  GPT part - "EFI System Partition"
    409640  3906357344      2  GPT part - ""
3906766984      262147         
3907029131          32         Sec GPT table
3907029163           1         Sec GPT header
iMac27:~ cjt$ 

You cannot check out the disk you boot from. iMac27:~ cjt$ sudo gpt show -l /dev/disk0 gpt show: unable to open device '/dev/disk0': Operation not permitted iMac27:~ cjt$

where as diskutil shows up a lot information about the "type, name, size and what device" - just enough information to let you know A) That your drive actually does have a recovery partition. When people take it upon themselves they ofter partition a drive without a recovery because they want to use all the space. Since the recovery partition is typically 650 MB - I think it is worth it. B) Many people have spaces in the NAME associated with the Apple_HFS - I personally do not allow spaces and I prefer to name that volume with something related to the system. eg cjt_HD or perhaps cjt_myphone_number - so I know who owns the disk and maybe someone will find it and call me.

iMac27:~ cjt$ diskutil list /dev/disk0
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS cjt_HD                  999.3 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
iMac27:~ cjt$ 

Diskutil is very comprehensive


diskutil has a rename function:

diskutil rename /dev/disk0s1 "EFI"

I just renamed my EFI partition from "NO NAME" to "EFI" using this command:

Depending on your permissions you might need: sudo diskutil rename /dev/disk0s1 "EFI"


I can suggest one reason why you would. In our network, the image for all MacBooks has three partitions:

  • One is called Macintosh HD.
  • One is called DATA
  • One is called Recovery

Macintosh HD is the system partition, DATA is the user partition, and of course Recovery is for the recovery console for Lion.

Now lets say the DATA partition name has been changed to something like "[" which always happens. Then if you are unlucky and the user restarts their MacBook, the user login box disappears and good luck retrieving it.

You have to change the DATA partition back to its original name from "[" to "DATA" for this to be fixed.

Luckily, we always backup our user's MacBooks; if we were to re-image, not a huge amount of stuff is lost.

If an easier solution is found to rename the partition, I would appreciate anyone who shares this.

Kind Regards,

Ali