1

I was converting the recovery partition from Apple_HFS to Apple_Boot as per instructions here. It was successful. As an experiment though, I tried an intentional typo to see if it would reflect on diskutil list. It didn't, and the record is messed up.

As I'm not aware what exactly asr adjust does, I'm asking here first. What exactly does the command do, and how can I recover from such a typo?

Annotated terminal session:

########### Convert successful, reflected on diskutil ###########
test-session:~ pnda$ sudo asr adjust --target /dev/disk0s3 -settype "Apple_Boot"
Password:
Fsck /dev/disk0s3 ....10....20....30....40....50....60....70....80....90....100
Adjust completed successfully

########### intentional typo here ###########
test-session:~ pnda$ sudo asr adjust --target /dev/disk0s3 -settype "Apple_Boo"
Fsck /dev/disk0s3 ....10....20....30....40....50....60....70....80....90....100
Adjust completed successfully

########### oh sh*t ###########
test-session:~ pnda$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:         Microsoft Reserved                         16.8 MB    disk0s1
   2:                  Apple_HFS Macintosh HD            40.9 GB    disk0s2
   3: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF               650.1 MB   disk0s3
   4:           Linux Filesystem                         18.5 GB    disk0s4
   5:           Linux Filesystem                         261.1 MB   disk0s5
   6:           Windows Recovery                         523.2 MB   disk0s6
   7:                        EFI NO NAME                 104.9 MB   disk0s7
   8:       Microsoft Basic Data                         59.1 GB    disk0s8

########### mission abort ###########
test-session:~ pnda$ sudo asr adjust --target /dev/disk0s3 -settype "Apple_Boot"
asr: Volume adjustment failed: Invalid argument
test-session:~ pnda$ sudo asr adjust --target /dev/disk0s3 -settype "Apple_HFS"
asr: Volume adjustment failed: Invalid argument

.....

1
  • Manual checking shows that the data is pretty much intact. I guess the header record is simply the one "damaged" (doesn't look like it). Maybe diskutil dimply doesn't know how to parse "Apple_Boo"?
    – Aloha
    Aug 24, 2018 at 3:26

1 Answer 1

2

You can use gdisk to edit the type of partition in the GUID partition table. It's installed with homebrew:

brew install gptfdisk

l will list out the types of partitions, then you can use t to change the partition type to the one you want, then write it to disk with w

sudo gdisk /dev/disk3
GPT fdisk (gdisk) version 1.0.4

Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): ?
b   back up GPT data to a file
c   change a partition's name
d   delete a partition
i   show detailed information on a partition
l   list known partition types
n   add a new partition
o   create a new empty GUID partition table (GPT)
p   print the partition table
q   quit without saving changes
r   recovery and transformation options (experts only)
s   sort partitions
t   change a partition's type code
v   verify disk
w   write table to disk and exit
x   extra functionality (experts only)
?   print this menu

Command (? for help): l
Type search string, or <Enter> to show all codes:
0700 Microsoft basic data  0c01 Microsoft reserved    2700 Windows RE
3000 ONIE boot             3001 ONIE config           3900 Plan 9
4100 PowerPC PReP boot     4200 Windows LDM data      4201 Windows LDM metadata
4202 Windows Storage Spac  7501 IBM GPFS              7f00 ChromeOS kernel
7f01 ChromeOS root         7f02 ChromeOS reserved     8200 Linux swap
8300 Linux filesystem      8301 Linux reserved        8302 Linux /home
8303 Linux x86 root (/)    8304 Linux x86-64 root (/  8305 Linux ARM64 root (/)
8306 Linux /srv            8307 Linux ARM32 root (/)  8308 Linux dm-crypt
8309 Linux LUKS            8400 Intel Rapid Start     8e00 Linux LVM
a000 Android bootloader    a001 Android bootloader 2  a002 Android boot 1
a003 Android recovery 1    a004 Android misc          a005 Android metadata
a006 Android system 1      a007 Android cache         a008 Android data
a009 Android persistent    a00a Android factory       a00b Android fastboot/ter
a00c Android OEM           a00d Android vendor        a00e Android config
a00f Android factory (alt  a010 Android meta          a011 Android EXT
a012 Android SBL1          a013 Android SBL2          a014 Android SBL3
a015 Android APPSBL        a016 Android QSEE/tz       a017 Android QHEE/hyp
a018 Android RPM           a019 Android WDOG debug/s  a01a Android DDR
a01b Android CDT           a01c Android RAM dump      a01d Android SEC
a01e Android PMIC          a01f Android misc 1        a020 Android misc 2
a021 Android device info   a022 Android APDP          a023 Android MSADP
Press the <Enter> key to see more codes:
2
  • Ayy, the partition is alive! Changed it back to ab00 Recovery HD, and all is well. Thanks! This implies that asr adjust simply changes the partition type, right?
    – Aloha
    Aug 24, 2018 at 7:17
  • "This implies that asr adjust simply changes the partition type, right?" Yes, although could also be doing other things. The GPT is simple enough though that I image it's just setting the code to the partition type.
    – Alex
    Aug 24, 2018 at 23:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .