Label an Unnamed ext-2/3 Partition in Mac OSX Yosemite

0

So, slight issue.

I'm attempting to label my Ubuntu partition on my Mac and cannot get access to a flash drive. Here are my resources:

  • fuse-ext2 enabled terminal emulation
  • Disk Utility
  • Mac OS Yosemite
  • Singular Ubuntu partition
  • rEFInd

I'm trying to use the dont_scan_volumes tag in the refind.conf file in the EFI partition. However, in order to use it, one must obtain the label of the volume in question. My Ubuntu install, for some reason, did not apply a label to my partition, therefore the issue. I have attempted to do this through diskutil. Here are my results:

>su
Password:
sh-3.2# mkdir /Volumes/Ubuntu
sh-3.2# mount -t fuse-ext2 /dev/disk0s4 /Volumes/Ubuntu
sh-3.2# diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            202.7 GB   disk0s2
   3:                  Apple_HFS Recovery HD             650.0 MB   disk0s3
   4: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               46.8 GB    disk0s4
   5:                 Linux Swap                         681.6 MB   disk0s6
sh-3.2# diskutil rename /Volumes/Ubuntu Ubuntu
Volume must be mounted

As you can see, I clearly mount the partition through fuse-ext2 before attempting to rename it, and it gives me an unmounted error. I have no clue why this error is thrown or how to fix it. If you need more information or command outputs, let me know and I'll try to get some more info.

EDIT:

So, I got the computer to recognize it as mounted. YAY! However, I still cannot rename it, but due to a different error:

sh-3.2# diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            202.5 GB   disk0s2
   3:                  Apple_HFS Recovery HD             650.0 MB   disk0s4
   4:       Microsoft Basic Data                         46.8 GB    disk0s5
   5:                 Linux Swap                         681.6 MB   disk0s6
sh-3.2# diskutil renameVolume /Volumes/Untitled 
Usage:  diskutil rename[Volume] MountPoint|DiskIdentifier|DeviceNode newName
The new name is subject to file system-specific naming restrictions.
Ownership of the specified volume may be required.
sh-3.2# diskutil renameVolume /Volumes/Untitled ubuntu
ubuntu does not appear to be a valid volume name for its file system

So... all lowercase, no symbols, and less than 8 characters isn't enough for "Microsoft Basic Data", or am I doing something horribly, horribly wrong?

Also, I can put the disk into read/write mode through fuse-ext2, but it doesn't really help, as far as I can see.

Addison Crump

Posted 2015-07-18T00:43:11.203

Reputation: 170

If it shows as mounted on the desktop, will it not respond to 'click; Enter; rename' from there? – Tetsujin – 2015-07-18T06:42:07.593

Totally unresponsive. I can click on it on my desktop, and when I hit enter, it does not allow me to change its name. – Addison Crump – 2015-07-18T13:07:29.193

so it's mounted read-only? – Tetsujin – 2015-07-18T15:32:47.950

Yes. But it says that it's unmounted, and doesn't appear in Disk Utility as mounted. It looks more like it's a read-only filesystem. – Addison Crump – 2015-07-18T15:41:33.197

It will be read-only if you don't have something like Paragon ExtFS idk about fuse, been too long since I used it; it got flaky around OS X 10.7 & I stopped using it

– Tetsujin – 2015-07-18T15:45:35.733

I got it to rw mode, but it hasn't helped whatsoever. – Addison Crump – 2015-07-18T17:28:02.490

Answers

1

rEFInd can read labels from either the filesystem or the partition table. Given that you're trying to do this from OS X, you're far more likely to have luck giving the partition a label you want in the partition table than in the filesystem, but you'll need to use the right tool. One tool that can handle this task is my GPT fdisk (gdisk). You can change the name with the c option, like this:

$ sudo gdisk /dev/sdd
GPT fdisk (gdisk) version 1.0.0

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sdd: 7989248 sectors, 3.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): AAA445FC-DEAB-4E2D-B2BF-5F9DF434A302
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7989214
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         7987199   3.8 GiB     0700  Foo

Command (? for help): c
Using 1
Enter name: Bar

Command (? for help): p
Disk /dev/sdd: 7989248 sectors, 3.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): AAA445FC-DEAB-4E2D-B2BF-5F9DF434A302
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7989214
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         7987199   3.8 GiB     0700  Bar

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdd.
The operation has completed successfully.

This example is on a Linux system modifying a USB flash drive at /dev/sdd, but it would work pretty much identically in OS X, except that the disk device should be /dev/disk0. There's also an EFI version of gdisk that you can run from rEFInd, but that version has bugs, particularly on some systems, so it's best to stick with the OS X version if you can.

Another option, of course, is to give the filesystem a label in Ubuntu. If it's an ext2/3/4 filesystem, you can do this with tune2fs, as in:

sudo tune2fs -L "Desired Name" /dev/sda4

Change Desired Name and /dev/sda4 as needed, of course. You can do this even if a filesystem is mounted.

Rod Smith

Posted 2015-07-18T00:43:11.203

Reputation: 18 427

I was kinda confused by what you were trying to say with the gdisk (I have it installed, I just don't quite get what you did with it), and, since I am doing this for the sake of rEFInd, I might as well do it with the filesystem method, since a) it's less scary and b) it still is a solution. Can you clarify on the partition table method, maybe with more than one partition, since I'm dealing with 5 or so? – Addison Crump – 2015-07-21T00:12:28.097

Type p to view the partition table, type c to change the name, type p to review your changes, and type w to save them. When you type c, you'll be asked for a partition number and a new name. (In the example, there's just one partition, so gdisk skips asking for it.) Note that gdisk holds all changes in memory until you hit w, so you can play with it with little risk of damaging your disk. If you do something in your testing that you think was a mistake, just hit q to quit without saving. – Rod Smith – 2015-07-21T13:06:30.250

Ah, that worked. Is there a way that I can keep its vmlinuz_(yadayada) boot available without showing the "Boot from whole partition" option, and is there a way to disable "Boot from entire disk" as well? – Addison Crump – 2015-07-21T15:21:05.913

If you're not booting Windows or some other BIOS-mode OS, you can edit refind.conf (probably in /boot/efi/EFI/refind in Linux): Uncomment the scanfor line and ensure the hdbios is not among the options. This will disable BIOS-mode boot scans on your hard disk, thus removing those extra options. – Rod Smith – 2015-07-21T15:56:33.417