Target "busy" when restoring bootcamp from .dmg
Problem: asr (and the DIsk Image utility) say "Resource busy" and both refuse to do the restore. The only indication I've found that something isn't right is that gpt says "Suspicious MBR at sector 0".
Same problem occurs when attempting to erase only or use Bootcamp Assistant to remove the bootcamp partition and change to a single OS X partition. So, I'm totally stuck short of resetting the entire Macbook Pro to factory defaults. The thing is that Yosemite and WIndows 8.1 boot and run perfectly otherwise. If there is some little thing I can do to repair this issue that would save me a lot of grief. Because of the "Suspicious MBR at sector 0" I went to some effort to manually analyzed the protective MBR and the NTFS boot record from raw hex dumps but I could not find any anomalies (though I am no expert on filesystem data structures). See details below. I must be looking in the wrong place.
History: (OSes: Yosemite 10.10.2, Windows 8.1)
- I successfully created a 40 Gb bootcamp partition and installed windows (thinking 40 Gbs would be enough to play a windows game on a Macbook Pro)
- I installed the game, rebooted into OS X and immediately used the Disk Image utility to create a .dmg backup image of bootcamp.
- I then discovered that 40 Gb was not large enough after running out of diskspace playing the game -- lots of cache files.
- Before increasing the bootcamp partition size; I tested the restore of the .dmg backup using the Disk Image utility on the 40 Gb partition. This worked flawlessly (windows booted just fine and the windows snapshot state was perfect), This validated that the backup .dmg image is good.
- I rebooted back into OS X and used Bootcamp Assistant to remove the 40 Gb bootcamp partition. This worked flawlessly and OS X reclaimed the disk space.
- I rebooted into OS X again (just as a precaution) and used Bootcamp Assistant to create a 70 Gbs bootcamp partition with windows install checked but with the create bootcamp USB drive unchecked. This was because I still had a bootcamp USB stick for the previous 40 Gb install from only a week before. I was thinking why do that again.
- Bootcamp did all its magic and it successfully installed the factory default Windows 8.1 from the DVD and I ran the bootcamp setup from the USB drive. It appeared to work flawlessly. I can boot into both system just like before and both system claimed there were no disk issues after running the appropriate disk checking utilities on both.
- Then the problems began. After rebooting back into OS X, I attempted to restore the 40Gb .dmg disk image into the newly created 70 Gb bootcamp partition which I had successfully done a few hours before but this time no go. The Disk Image utility refused with "Resource busy" no matter what. That's when I dropped into command line mode to collect more info. The only indication that something is wrong is that gpt says "disk0: Suspicious MBR at sector 0".
Command line details:
SILCLT27047A:~ admin$ su
Password:
sh-3.2# umount /dev/disk0s4
sh-3.2# asr imagescan --source Downloads/Skyrim_new_install.dmg
unable to get blkx for partition 1.
unable to get UDIF info from "/Users/admin/Downloads/Skyrim_new_install.dmg" - Invalid argument.
asr: image scan failed - Invalid argument.
# I’m assuming this fails because asr doesn’t understand BOOTCAMP/NTFS images
sh-3.2# hdiutil attach /Users/admin/Downloads/Skyrim_new_install.dmg
expected CRC32 $68C957A8
/dev/disk2 /Volumes/BOOTCAMP
sh-3.2# hdiutil info
framework : 396
driver : 10.10v396
================================================
image-path : /Users/admin/Downloads/Skyrim_new_install.dmg
image-alias : /Users/admin/Downloads/Skyrim_new_install.dmg
shadow-path : <none>
icon-path : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icn s
image-type : UDIF read-only compressed (zlib)
system-image : false
blockcount : 78123008
blocksize : 512
writeable : false
autodiskmount : TRUE
removable : TRUE
image-encrypted : false
mounting user : root
mounting mode : <unknown>
process ID : 551
/dev/disk2 /Volumes/BOOTCAMP
sh-3.2# mount
/dev/disk1 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
localhost:/K4SrlfVYzI8Mv4bD6zBz_i on /Volumes/MobileBackups (mtmfs, nosuid, read-only, nobrowse)
/dev/disk2 on /Volumes/BOOTCAMP (ntfs, local, nodev, nosuid, read-only, noowners, mounted by admin)
sh-3.2# diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *750.2 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 679.3 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
4: Microsoft Basic Data BOOTCAMP 70.0 GB disk0s4
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD *678.9 GB disk1
Logical Volume on disk0s2
181BFC3C-A1A7-471A-ACB3-F7AB0C28AB0D
Unencrypted
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: BOOTCAMP *40.0 GB disk2
sh-3.2# asr --source /Volumes/BOOTCAMP --target /dev/disk0s4 --erase --verbose
Validating target...done
Validating source...done
Erase contents of /dev/disk0s4? [ny]: y
Repartitioning target device...
Could not change the partition type for /dev/disk0s4 - Resource busy
sh-3.2# gpt -r -vv show disk0
gpt show: disk0: mediasize=750156374016; sectorsize=512; blocks=1465149168
gpt show: disk0: Suspicious MBR at sector 0
gpt show: disk0: Pri GPT at sector 1
gpt show: disk0: Sec GPT at sector 1465149167
start size index contents
0 1 MBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 1326751200 2 GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
1327160840 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
1328430376 728
1328431104 136716288 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
1465147392 1743
1465149135 32 Sec GPT table
1465149167 1 Sec GPT header
sh-3.2# fdisk /dev/rdisk0
Disk: /dev/rdisk0 geometry: 91201/255/63 [1465149168 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: AC 1023 254 63 - 1023 254 63 [ 409640 - 1326751200] <Unknown ID>
3: AB 1023 254 63 - 1023 254 63 [1327160840 - 1269536] Darwin Boot
*4: 07 1023 254 63 - 1023 254 63 [1328431104 - 136716288] HPFS/QNX/AUX
sh-3.2# dd if=/dev/rdisk0 count=1 2>/dev/null | hexdump -C
00000000 33 c0 8e d0 bc 00 7c 8e c0 8e d8 be 00 7c bf 00 |3.....|......|..|
00000010 06 b9 00 02 fc f3 a4 50 68 1c 06 cb fb b9 04 00 |.......Ph.......|
00000020 bd be 07 80 7e 00 00 7c 0b 0f 85 0e 01 83 c5 10 |....~..|........|
00000030 e2 f1 cd 18 88 56 00 55 c6 46 11 05 c6 46 10 00 |.....V.U.F...F..|
00000040 b4 41 bb aa 55 cd 13 5d 72 0f 81 fb 55 aa 75 09 |.A..U..]r...U.u.|
00000050 f7 c1 01 00 74 03 fe 46 10 66 60 80 7e 10 00 74 |....t..F.f`.~..t|
00000060 26 66 68 00 00 00 00 66 ff 76 08 68 00 00 68 00 |&fh....f.v.h..h.|
00000070 7c 68 01 00 68 10 00 b4 42 8a 56 00 8b f4 cd 13 ||h..h...B.V.....|
00000080 9f 83 c4 10 9e eb 14 b8 01 02 bb 00 7c 8a 56 00 |............|.V.|
00000090 8a 76 01 8a 4e 02 8a 6e 03 cd 13 66 61 73 1c fe |.v..N..n...fas..|
000000a0 4e 11 75 0c 80 7e 00 80 0f 84 8a 00 b2 80 eb 84 |N.u..~..........|
000000b0 55 32 e4 8a 56 00 cd 13 5d eb 9e 81 3e fe 7d 55 |U2..V...]...>.}U|
000000c0 aa 75 6e ff 76 00 e8 8d 00 75 17 fa b0 d1 e6 64 |.un.v....u.....d|
000000d0 e8 83 00 b0 df e6 60 e8 7c 00 b0 ff e6 64 e8 75 |......`.|....d.u|
000000e0 00 fb b8 00 bb cd 1a 66 23 c0 75 3b 66 81 fb 54 |.......f#.u;f..T|
000000f0 43 50 41 75 32 81 f9 02 01 72 2c 66 68 07 bb 00 |CPAu2....r,fh...|
00000100 00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66 |.fh....fh....fSf|
00000110 53 66 55 66 68 00 00 00 00 66 68 00 7c 00 00 66 |SfUfh....fh.|..f|
00000120 61 68 00 00 07 cd 1a 5a 32 f6 ea 00 7c 00 00 cd |ah.....Z2...|...|
00000130 18 a0 b7 07 eb 08 a0 b6 07 eb 03 a0 b5 07 32 e4 |..............2.|
00000140 05 00 07 8b f0 ac 3c 00 74 09 bb 07 00 b4 0e cd |......<.t.......|
00000150 10 eb f2 f4 eb fd 2b c9 e4 64 eb 00 24 02 e0 f8 |......+..d..$...|
00000160 24 02 c3 49 6e 76 61 6c 69 64 20 70 61 72 74 69 |$..Invalid parti|
00000170 74 69 6f 6e 20 74 61 62 6c 65 00 45 72 72 6f 72 |tion table.Error|
00000180 20 6c 6f 61 64 69 6e 67 20 6f 70 65 72 61 74 69 | loading operati|
00000190 6e 67 20 73 79 73 74 65 6d 00 4d 69 73 73 69 6e |ng system.Missin|
000001a0 67 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74 |g operating syst|
000001b0 65 6d 00 00 00 63 7b 9a d0 f2 da d7 00 00 00 fe |em...c{.........|
000001c0 ff ff ee fe ff ff 01 00 00 00 27 40 06 00 00 fe |..........'@....|
000001d0 ff ff ac fe ff ff 28 40 06 00 e0 9d 14 4f 00 fe |......(@.....O..|
000001e0 ff ff ab fe ff ff 08 de 1a 4f 20 5f 13 00 80 fe |.........O _....|
000001f0 ff ff 07 fe ff ff 00 40 2e 4f 00 20 26 08 55 aa |.......@.O. &.U.|
00000200
sectors=08262000h=136716288d=69.998gbs
——————————————————————————————————————-
Manual Analysis of Protective MBR at sector 0
000-1BD: bootstrap loader
1BE-1CD: 00 | fe ff ff | ee | fe ff ff | 01 00 00 00 | 27 40 06 00 #1
status=00 inactive, type=ee (EFI), lba=00000001h=1d
sectors=00064027h=409639d=209.735mbs
end=1d+409639d=409640d
gap=0d
1CE-1DD: 00 | fe ff ff | ac | fe ff ff | 28 40 06 00 | e0 9d 14 4f #2
status=00 inactive, type=ac (CS), lba=00064028h=409640d
sectors=4f149de0h=1326751200d=679.296gbs
end=409640d+1326751200d=1327160840d
gap=0d
1DE-1ED: 00 | fe ff ff | ab | fe ff ff | 08 de 1a 4f | 20 5f 13 00 #3
status=00 inactive, type=ab (Darwin Boot), lba=4f1ade08h=1327160840d
sectors=00135f20h=1269536d=650.002mbs
end=1327160840d+1269536d=1327287793d
gap=1143311d=585.375mbs
1EE-1FD: 80 | fe ff ff | 07 | fe ff ff | 00 40 2e 4f | 00 20 26 08 #4
status=80 active, type=07 (NTFS), lba=4f2e4000h=1328431104d
1FE-1FF: 55 aa boot signature
——————————————————————————————————————-
sh-3.2# fdisk /dev/disk0s4
Disk: /dev/disk0s4 geometry: 8510/255/63 [136716288 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 72 80 13 10 - 371 101 51 [1920221984 - 1816210284] <Unknown ID>
2: 6C 357 43 4 - 367 32 52 [1936028192 - 1953653108] <Unknown ID>
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
# Appears fdisk can’t interpret NTFS boot sectors; this is garbage
sh-3.2# dd if=/dev/rdisk0 skip=1328431104 count=1 2>/dev/null | hexdump -C
00000000 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00 |.R.NTFS .....|
00000010 00 00 00 00 00 f8 00 00 3f 00 ff 00 00 40 2e 4f |........?....@.O|
00000020 00 00 00 00 80 00 80 00 ff 1f 26 08 00 00 00 00 |..........&.....|
00000030 00 00 0c 00 00 00 00 00 02 00 00 00 00 00 00 00 |................|
00000040 f6 00 00 00 01 00 00 00 3a ee e6 8c fe e6 8c c0 |........:.......|
00000050 00 00 00 00 fa 33 c0 8e d0 bc 00 7c fb 68 c0 07 |.....3.....|.h..|
00000060 1f 1e 68 66 00 cb 88 16 0e 00 66 81 3e 03 00 4e |..hf......f.>..N|
00000070 54 46 53 75 15 b4 41 bb aa 55 cd 13 72 0c 81 fb |TFSu..A..U..r...|
00000080 55 aa 75 06 f7 c1 01 00 75 03 e9 dd 00 1e 83 ec |U.u.....u.......|
00000090 18 68 1a 00 b4 48 8a 16 0e 00 8b f4 16 1f cd 13 |.h...H..........|
000000a0 9f 83 c4 18 9e 58 1f 72 e1 3b 06 0b 00 75 db a3 |.....X.r.;...u..|
000000b0 0f 00 c1 2e 0f 00 04 1e 5a 33 db b9 00 20 2b c8 |........Z3... +.|
000000c0 66 ff 06 11 00 03 16 0f 00 8e c2 ff 06 16 00 e8 |f...............|
000000d0 4b 00 2b c8 77 ef b8 00 bb cd 1a 66 23 c0 75 2d |K.+.w......f#.u-|
000000e0 66 81 fb 54 43 50 41 75 24 81 f9 02 01 72 1e 16 |f..TCPAu$....r..|
000000f0 68 07 bb 16 68 52 11 16 68 09 00 66 53 66 53 66 |h...hR..h..fSfSf|
00000100 55 16 16 16 68 b8 01 66 61 0e 07 cd 1a 33 c0 bf |U...h..fa....3..|
00000110 0a 13 b9 f6 0c fc f3 aa e9 fe 01 90 90 66 60 1e |.............f`.|
00000120 06 66 a1 11 00 66 03 06 1c 00 1e 66 68 00 00 00 |.f...f.....fh...|
00000130 00 66 50 06 53 68 01 00 68 10 00 b4 42 8a 16 0e |.fP.Sh..h...B...|
00000140 00 16 1f 8b f4 cd 13 66 59 5b 5a 66 59 66 59 1f |.......fY[ZfYfY.|
00000150 0f 82 16 00 66 ff 06 11 00 03 16 0f 00 8e c2 ff |....f...........|
00000160 0e 16 00 75 bc 07 1f 66 61 c3 a1 f6 01 e8 09 00 |...u...fa.......|
00000170 a1 fa 01 e8 03 00 f4 eb fd 8b f0 ac 3c 00 74 09 |............<.t.|
00000180 b4 0e bb 07 00 cd 10 eb f2 c3 0d 0a 41 20 64 69 |............A **|
00000190 73 6b 20 72 65 61 64 20 65 72 72 6f 72 20 6f 63 |sk read error oc|
000001a0 63 75 72 72 65 64 00 0d 0a 42 4f 4f 54 4d 47 52 |curred...BOOTMGR|
000001b0 20 69 73 20 63 6f 6d 70 72 65 73 73 65 64 00 0d | is compressed..|
000001c0 0a 50 72 65 73 73 20 43 74 72 6c 2b 41 6c 74 2b |.Press Ctrl+Alt+|
000001d0 44 65 6c 20 74 6f 20 72 65 73 74 61 72 74 0d 0a |Del to restart..|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 8a 01 a7 01 bf 01 00 00 55 aa |..............U.|
00000200
——————————————————————————————————————-
Manual Analysis of NTFS boot sector at sector 1328431104
000-002: EB 52 90 (short JMP=EBh offset=52h from byte after JMP=54h + noop=90h)
003-00a: 4e 54 46 53 20 20 20 20 = “NTFS “ 8 bytes (OEM ID)
00b-023: Primary BPB 25 bytes
00b: 0200h=512d bytes per sector
00d: 08h=8d sectors per cluster (cluster size=4096 bytes)
00e: 0000h=0d reserved sectors
010: 000000h always 0
013: 0000h ignored
015: f8h media descriptor
016: 0000h ignored
018: 003fh=63d sectors per track
01A: 00ffh=255d # of heads
01C: 2e400000=775946240d hidden sectors (397.284mbs) for crash dumps?
020: 00000000h ignored
024-053: Extended BPB 48 bytes
024: 80008000h ignored
028: 0000000008261fffh=136716287d total sectors (69.998gbs)
030: 00000000000c0000h=786432d cluster # for $MFT
038: 0000000000000002h=2d cluster # for $MFTMirr
040: 000000f6h=246d clusters per file record segment
044: 01h=1d clusters per index buffer
045: 000000h ignored
048: c03aeee68cfee68ch=54107993273073382d volume serial #
050: 00000000h checksum ignored
054-1fd: Bootstrap code 426 bytes
1fe-1ff: 55 aa (boot signature)
——————————————————————————————————————-
Windows 8.1 dump of Protective MBR within BOOTCAMP:
Description Disk drive
Manufacturer (Standard disk drives)
Model TOSHIBA MK7559GSXF ATA Device
Bytes/Sector 512
Media Loaded Yes
Media Type Fixed hard disk
Partitions 4
SCSI Bus 0
SCSI Logical Unit 0
SCSI Port 0
SCSI Target ID 0
Sectors/Track 63
Size 698.64 GB (750,153,761,280 bytes)
Total Cylinders 91,201
Total Sectors 1,465,144,065
Total Tracks 23,256,255
Tracks/Cylinder 255
Partition Disk #0, Partition #0
Partition Size 200.02 MB (209,735,168 bytes)
Partition Starting Offset 512 bytes
Partition Disk #0, Partition #1
Partition Size 632.64 GB (679,296,614,400 bytes)
Partition Starting Offset 209,735,680 bytes
Partition Disk #0, Partition #2
Partition Size 619.89 MB (650,002,432 bytes)
Partition Starting Offset 679,506,350,080 bytes
Partition Disk #0, Partition #3
Partition Size 65.19 GB (69,998,739,456 bytes)
Partition Starting Offset 680,156,725,248 bytes = 1328431104 sectors
MacBook Pro, OS X Yosemite (10.10.2), restore from .dmg backup