Sample Header Ad - 728x90

Ask Different (Apple)

Q&A for power users of Apple hardware and software

Latest Questions

2 votes
0 answers
221 views
Sparse disk image error 'No space left on device' while limit not reached
I created a sparse disk image of 400 GB with `hdiutil` command on an empty 500 GB external drive. After I have attached the disk image, I copy data to it. After about 17 GB of data I get an error stating: No space left on device Why is it that I cannot fully utilize the 400 GB and is it raising this...
I created a sparse disk image of 400 GB with hdiutil command on an empty 500 GB external drive. After I have attached the disk image, I copy data to it. After about 17 GB of data I get an error stating: No space left on device Why is it that I cannot fully utilize the 400 GB and is it raising this error? hdiutil create -size 400g -type SPARSE -fs APFS -volname test /Volumes/data/test.dmg hdiutil attach /Volumes/data/test.dmg.sparseimage enter image description here Any help much appreciated! enter image description here enter image description here enter image description here
Robertico (121 rep)
Jul 13, 2024, 01:21 PM • Last activity: Jul 15, 2024, 07:12 AM
1 votes
1 answers
116 views
How to attach a DMG with different mount AND browse name?
I have a DMG `foo.dmg` which when I attach it via hdiutil attach foo.dmg appears in the Terminal under path `/Volumes/foo` and in the Finder side bar as "foo". Now when attaching the DMG I want to change the name under which the DMG appears. I tried hdiutil attach -mountpoint bar foo.dmg and the DMG...
I have a DMG foo.dmg which when I attach it via hdiutil attach foo.dmg appears in the Terminal under path /Volumes/foo and in the Finder side bar as "foo". Now when attaching the DMG I want to change the name under which the DMG appears. I tried hdiutil attach -mountpoint bar foo.dmg and the DMG appears in Terminal in the filessystem as /Volume/bar. So far so good. But in the Finder (for "browsing") the DMG is still listed as "foo". How can I call hdiutil and change _both_ names, the filesystem volume name and the Finder browse name? **Side note**: The DMG(s) I want to treat like this are _read-only_ DMGs, so they cannot be mounted with the -readwrite option to use diskutil rename` to rename the browse name permanently. (Thanks to [@David Anderson](https://apple.stackexchange.com/users/107222/david-anderson) for pointing out this principal method.)
halloleo (1497 rep)
Jun 19, 2024, 08:42 AM • Last activity: Jun 20, 2024, 04:38 PM
1 votes
0 answers
63 views
How to clone entire drive of 2018 MacBook Pro?
I have a 2018 MacBook Pro I borrowed and need to return. I already have a cloud backup but wanted a full disk clone for extra safety. All my attempts are done in Recovery Mode. I first tried to clone the whole disk using `hdiutil create -srcdevice /dev/disk0 -format UDZO -o /Volumes/ExternalDrive/di...
I have a 2018 MacBook Pro I borrowed and need to return. I already have a cloud backup but wanted a full disk clone for extra safety. All my attempts are done in Recovery Mode. I first tried to clone the whole disk using hdiutil create -srcdevice /dev/disk0 -format UDZO -o /Volumes/ExternalDrive/disk0.dmg. I have an 80 GB file (the SSD was 1 TB and quite full of data), so I know something was wrong. When I attached it, I just got an empty image.
/dev/disk10 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        +1.0 TB     disk10
   1:                       0xEE ⁨⁩                        125.1 GB   disk10s1
                    (free space)                         875.5 GB   -
I then tried to clone the APFS synthesized disk. It seemed to work, but the volumes are encrypted and I don't know how to decrypt them. On the 2018 MacBook, I have:
+-- Container disk3 AD3E4EE4-1440-468C-9CA5-677DE00BC5A8
|   ====================================================
|   APFS Container Reference:     disk3
|   Size (Capacity Ceiling):      1000240963584 B (1.0 TB)
|   Capacity In Use By Volumes:   733871874048 B (733.9 GB) (73.4% used)
|   Capacity Not Allocated:       266369089536 B (266.4 GB) (26.6% free)
|   |
|   +- Volume disk3s1 5220F233-F35B-4AAD-A056-41DA26FFB5EE
|   |   ---------------------------------------------------
|   |   APFS Volume Disk (Role):   disk3s1 (Data)
|   |   Name:                      Macintosh HD - 数据 (Case-insensitive)
|   |   Mount Point:               Not Mounted
|   |   Capacity Consumed:         721904885760 B (721.9 GB)
|   |   Sealed:                    No
|   |   FileVault:                 No (Encrypted at rest)
|   |
|   +-> Volume disk3s2 1578E60E-1F24-42F4-81D6-B14C53D1D51A
|   |   ---------------------------------------------------
|   |   APFS Volume Disk (Role):   disk3s2 (Preboot)
|   |   Name:                      Preboot (Case-insensitive)
|   |   Mount Point:               Not Mounted
|   |   Capacity Consumed:         1775439872 B (1.8 GB)
|   |   Sealed:                    No
|   |   FileVault:                 No
|   |
|   +-> Volume disk3s3 CB271A30-7E14-4CE5-9AF2-AEDE35166F74
|   |   ---------------------------------------------------
|   |   APFS Volume Disk (Role):   disk3s3 (Recovery)
|   |   Name:                      Recovery (Case-insensitive)
|   |   Mount Point:               Not Mounted
|   |   Capacity Consumed:         1116946432 B (1.1 GB)
|   |   Sealed:                    No
|   |   FileVault:                 No
|   |
|   +-> Volume disk3s4 4EE2238A-AD9A-4030-BFFB-42A03E737CD6
|   |   ---------------------------------------------------
|   |   APFS Volume Disk (Role):   disk3s4 (System)
|   |   Name:                      Macintosh HD (Case-insensitive)
|   |   Mount Point:               Not Mounted
|   |   Capacity Consumed:         8865898496 B (8.9 GB)
|   |   Sealed:                    Broken
|   |   FileVault:                 No (Encrypted at rest)
|   |
|   +-> Volume disk3s6 CDCF8CA7-0DAC-41A2-AB14-8D5458E159E4
|       ---------------------------------------------------
|       APFS Volume Disk (Role):   disk3s6 (VM)
|       Name:                      VM (Case-insensitive)
|       Mount Point:               Not Mounted
|       Capacity Consumed:         20480 B (20.5 KB)
|       Sealed:                    No
|       FileVault:                 No
|
but for the disk image:
/dev/disk11 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                                                   +1.0 TB     disk11

/dev/disk12 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.0 TB     disk12
                                 Physical Store disk11
   1:                APFS Volume ⁨Macintosh HD - 数据⁩     721.9 GB   disk12s1
   2:                APFS Volume ⁨Preboot⁩                 1.8 GB     disk12s2
   3:                APFS Volume ⁨Recovery⁩                1.1 GB     disk12s3
   4:                APFS Volume ⁨Macintosh HD⁩            8.9 GB     disk12s4
   5:                APFS Volume ⁨VM⁩                      20.5 KB    disk12s6
+-- Container disk12 AD3E4EE4-1440-468C-9CA5-677DE00BC5A8
    =====================================================
    APFS Container Reference:     disk12
    Size (Capacity Ceiling):      1000240963584 B (1.0 TB)
    Capacity In Use By Volumes:   733871874048 B (733.9 GB) (73.4% used)
    Capacity Not Allocated:       266369089536 B (266.4 GB) (26.6% free)
    |
    +- Volume disk12s1 5220F233-F35B-4AAD-A056-41DA26FFB5EE
    |   ----------------------------------------------------
    |   APFS Volume Disk (Role):   disk12s1 (Data)
    |   Name:                      Macintosh HD - 数据 (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         721904885760 B (721.9 GB)
    |   Sealed:                    No
    |   FileVault:                 Yes (Locked)
    |
    +-> Volume disk12s2 1578E60E-1F24-42F4-81D6-B14C53D1D51A
    |   ----------------------------------------------------
    |   APFS Volume Disk (Role):   disk12s2 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         1775439872 B (1.8 GB)
    |   Sealed:                    No
    |   FileVault:                 No
    |
    +-> Volume disk12s3 CB271A30-7E14-4CE5-9AF2-AEDE35166F74
    |   ----------------------------------------------------
    |   APFS Volume Disk (Role):   disk12s3 (Recovery)
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         1116946432 B (1.1 GB)
    |   Sealed:                    No
    |   FileVault:                 No
    |
    +-> Volume disk12s4 4EE2238A-AD9A-4030-BFFB-42A03E737CD6
    |   ----------------------------------------------------
    |   APFS Volume Disk (Role):   disk12s4 (System)
    |   Name:                      Macintosh HD (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         8865898496 B (8.9 GB)
    |   Sealed:                    Broken
    |   FileVault:                 Yes (Locked)
    |   Encrypted:                 No
    |
    +-> Volume disk12s6 CDCF8CA7-0DAC-41A2-AB14-8D5458E159E4
        ----------------------------------------------------
        APFS Volume Disk (Role):   disk12s6 (VM)
        Name:                      VM (Case-insensitive)
        Mount Point:               Not Mounted
        Capacity Consumed:         20480 B (20.5 KB)
        Sealed:                    No
        FileVault:                 No
I tried various things on both the 2018 borrowed Mac and my new MacBook, but I couldn't figure out what the problem was:
jin@Joy-MBP ~ > diskutil apfs listcryptousers /dev/disk12s1
No cryptographic users for disk12s1
jin@Joy-MBP ~> diskutil apfs unlockVolume disk12s1 -user disk
Passphrase:
Unlocking the "disk" cryptographic user on APFS Volume disk11s1
User does not exist; try "diskutil apfs listCryptoUsers"
What should I try next?
Joy Jin (3043 rep)
Apr 19, 2024, 03:02 AM • Last activity: May 3, 2024, 02:33 PM
0 votes
1 answers
545 views
hdiutil: create failed - Operation timed out
I am trying to create a Backup.dmg disk image in a folder on an SMB file system. 1. Using Disk Utility 2. Using hdiutil - `hdiutil create -size 4t -fs APFS -volname backup Backup.dmg` Both operations start, but after a few minutes, they always fail with create failed - Operation timed out It fails t...
I am trying to create a Backup.dmg disk image in a folder on an SMB file system. 1. Using Disk Utility 2. Using hdiutil - hdiutil create -size 4t -fs APFS -volname backup Backup.dmg Both operations start, but after a few minutes, they always fail with create failed - Operation timed out It fails the same way when trying to create an image on a USB-attached disk drive. I recall doing this over a year ago on the same Windows box and sharing SMB folders with no problems. Chat GPT has many options but nothing useful. Google search shows other people with the same problem but not many good solutions. Does anyone have any insight into what is going on here? ---------- *Getting some more insight here from Carbon Copy Cloner...* Some SMB volumes can't support macOS sparse disk images We have received several reports that macOS is unable to create disk images on SMB volumes hosted by various NAS devices. If you attempt to create the disk image in Disk Utility (for example), Disk Utility reports an "RPC Error". After months of investigation, we have concluded that macOS Catalina has more stringent requirements for sparse disk images than previous OSes. Solution: Several users have reported that adjusting the SMB configuration on the NAS to support Time Machine can resolve the problem. Time Machine also uses sparse disk images on NAS volumes, so its requirements for the NAS file sharing service would be the same as those required for generic sparse disk image support. Workaround A: Several users are reporting that connecting to the network volume via AFP rather than SMB resolved the problem: 1. Eject the NAS volume if it's currently mounted 2. Choose "Connect to Server" from the Finder's Go menu 3. Type in "afp://{server address}" to connect to the NAS volume via AFP 4. Choose "New disk image..." from CCC's Destination selector and specify a new disk image on the AFP-mounted NAS volume Workaround B: If connecting to your NAS volume via AFP is not an option, then you can back up user data (e.g. your home folder) directly to the NAS volume (i.e. don't use a disk image). We also recommend disabling support for extended attributes (via the Advanced Settings). ---------- *I still have not solved the issue... still researching...*
Eric Kolotyluk (111 rep)
Nov 21, 2023, 04:40 AM • Last activity: Nov 22, 2023, 04:53 AM
0 votes
0 answers
318 views
Should hdiutil create image from physical or synthesized disk?
When using `hdiutil` to create a backup image from a terminal in recovery mode (Command-R) `hdiutil create -srcdevice /dev/disk3 /Volumes/backups/ ` where `disk3` is the "synthesized" drive (see diskutil output below), should `/dev/disk0` (internal, physical) be sourced instead? The image (.dmg) wou...
When using hdiutil to create a backup image from a terminal in recovery mode (Command-R) hdiutil create -srcdevice /dev/disk3 /Volumes/backups/ where disk3 is the "synthesized" drive (see diskutil output below), should /dev/disk0 (internal, physical) be sourced instead? The image (.dmg) would be used for a full restore, although individual file browsing/restoration would be nice too (which seems like sourcing disk3 should provide for)? ___ -bash-3.2# diskutil list /dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.3 GB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk3 500.0 GB disk0s2 /dev/disk1 (disk image): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme +1.2 GB disk1 1: Apple_APFS Container disk2 1.2 GB disk1s1 /dev/disk2 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +1.2 GB disk2 Physical Store disk1s1 1: APFS Volume macOS Base System 942.9 MB disk2s1 2: APFS Volume Preboot 81.3 MB disk2s2 /dev/disk3 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +500.0 GB disk3 Physical Store disk0s2 1: APFS Volume Macintosh HD 11.8 GB disk3s1 2: APFS Volume Macintosh HD - Data 91.9 GB disk3s2 3: APFS Volume Preboot 3.6 GB disk3s3 4: APFS Volume Recovery 1.1 GB disk3s4 5: APFS Volume VM 20.5 KB disk3s5 --- [**Note**:](https://support.apple.com/guide/disk-utility/create-a-disk-image-dskutl11888/mac) You can’t create images of individual APFS volumes. You can’t create images of APFS containers on Mac computers with Apple silicon or an Apple T2 Security Chip.
samus (204 rep)
Aug 31, 2023, 05:23 PM • Last activity: Sep 8, 2023, 06:57 PM
1 votes
1 answers
1326 views
Error hdiutil: create failed - File exists -> but the file does not exist until this command fails
Trying to create a .dmg file on an NFS share. ``` % rm -f store.dmg && ls -l store.dmg ls: store.dmg: No such file or directory % hdiutil create -size 300g -fs APFS -volname Temp store.dmg || ls -l store.dmg hdiutil: create failed - File exists -rw-r--r-- 1 risner wheel 0 Sep 13 22:44 store.dmg ```...
Trying to create a .dmg file on an NFS share.
% rm -f store.dmg && ls -l store.dmg
    ls: store.dmg: No such file or directory
    % hdiutil create -size 300g -fs APFS -volname Temp store.dmg || ls -l store.dmg
    hdiutil: create failed - File exists
    -rw-r--r--  1 risner  wheel  0 Sep 13 22:44 store.dmg
Disk Utility also fails with a file exists error. I can read and write files on the NFS share fine. No issues. The mount in vifs is as such: 192.168.40.10:/store /System/Volumes/Data/Store nfs rw,resvport,hard,bg,intr,rw,tcp,nfc,noatime Still not working directly on the NFS, but bmike suggested I create it locally and move to the NFS share. I created a sparse bundle by adding -type SPARSE to the hdiutil and moved the sparse image to the NFS share. I can read/write files with the image open. Why can I not directly create on the NFS share? macOS 12.4 on M1 Mac Mini 8Gb
James Risner (544 rep)
Sep 14, 2022, 11:08 AM • Last activity: Dec 19, 2022, 03:27 AM
0 votes
0 answers
134 views
How do I compress an encrypted time machine disk image?
I have an archived read-only Time Machine drive sitting on a NAS. It is a straight dump (made with `dd`) of a CoreStorage encrypted HFS+ hard disk. It's taking up 10TB, and I expect that the much of the data is eminently compressible, but of course, being encrypted, things like `gzip` will not be ab...
I have an archived read-only Time Machine drive sitting on a NAS. It is a straight dump (made with dd) of a CoreStorage encrypted HFS+ hard disk. It's taking up 10TB, and I expect that the much of the data is eminently compressible, but of course, being encrypted, things like gzip will not be able to meaningfully compress the file itself. I would normally just try things myself before asking a question, but given the need for between 20TB and 30TB of scratch space to attempt this, I want to have a very good sense beforehand of whether this will work. My requirements are: - It should be compressed substantially more than it is in its 'raw dump' state. - It must remain legible to Time Machine for restores and browsing. - It must remain encrypted in some form. Nice to have: - It would be nice to be able to do this in a way that is both in-place and safely resumable. - In-place because I would really like to reduce the necessary scratch space on the NAS. - Resumable because while I do have a 10GbE nic in the NAS and 2.5GbE on my mac, but even at wire-speed just reading the image is 10 hours, and in practice going through the SMB and Btrfs layers to the actual disk, it is likely to take more like 30-40 hours just for a straight read and then write; it would be nice to be able to reboot in the middle and not lose progress if we have a power cut or something. Non-requirements: - I don't want the resulting file to be read/write. In fact I plan to make the file itself read-only; this is historical data, not a live backup of a current computer. My guess would be to do something like this:
hdiutil convert input.dmg -o output.dmg \
    -format ULMO \
    -encryption AES-128
so the question is: should I expect that to work, and to result in a usable disk image at this scale of data?
Glyph (1828 rep)
Dec 1, 2022, 06:08 PM
4 votes
1 answers
1952 views
How to mount a .dmg file with a different volume name (or modify it once mounted)?
MacOS Catalina, 10.15.6 Given a `.dmg` file, `foo.dmg`, I want to be able to attach it so that its contents will be visible in the Finder application under the `Locations` section with an arbitrary name, `bar`. When I attach/mount it with the command ``` $ hdiutil attach foo.dmg ``` It's being mount...
MacOS Catalina, 10.15.6 Given a .dmg file, foo.dmg, I want to be able to attach it so that its contents will be visible in the Finder application under the Locations section with an arbitrary name, bar. When I attach/mount it with the command
$ hdiutil attach foo.dmg
It's being mounted by default under /Volumes/foo and is visible in MacOS Finder application under the Locations section as foo. I don't care what is the directory name (on disk) it's being mounted under in the /Volumes but I care about the name of the volume visible in the Finder under the Locations section. Is it possible to do (programmatically) either * attach the foo.dmg under a different name (that will be visible in the Finder's Locations section). * rename the volume once it has been mounted with the default name. * modify the foo.dmg file to amend its volume name to be used when mounting (however my understanding is that the volume name is baked into the .dmg file at the creation time and I have no control of it) When running
$ diskutil list
I can see the mounted disk image:
/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +494.4 MB   disk2
   1:                  Apple_HFS foo					 494.4 MB   disk2s1
Running command
$ diskutil rename /Volumes/foo "/Volumes/bar"
gives me /Volumes/bar does not appear to be a valid volume name for its file system because of the naming limitations (having a / in the name) and running
$ diskutil rename /Volumes/foo "bar"
fails because one cannot write under the root (/) - Failed to rename volume: Read-only file system (49182).
Alex Tereshenkov (141 rep)
Sep 17, 2020, 10:36 AM • Last activity: Nov 14, 2022, 08:07 PM
1 votes
1 answers
368 views
hdiutil within "darling" can't do anything but "attach" and "detach". Can it be improved or something else?
When I run `hdiutil` within [Darling](https://www.darlinghq.org/) I get: Darling [/Volumes/SystemRoot/home/user]$ hdiutil Usage: hdiutil Possible actions: attach [options] Mounts a .dmg file and prints the mount locaton detach [options] Unmounts a .dmg file mounted at I need to run `hdiutil create ....
When I run hdiutil within [Darling](https://www.darlinghq.org/) I get: Darling [/Volumes/SystemRoot/home/user]$ hdiutil Usage: hdiutil Possible actions: attach [options] Mounts a .dmg file and prints the mount locaton detach [options] Unmounts a .dmg file mounted at I need to run hdiutil create ..., is it even possible?
Сергей Попков (113 rep)
Oct 12, 2022, 06:49 AM • Last activity: Oct 12, 2022, 07:45 AM
8 votes
1 answers
5923 views
All of a sudden can't open .dmg files on Monterey
My MacBook Pro 13" M1 crashed last night, I think because I switched off my external USB-C monitor. I logged in as normal but since then I am not able to open .dmg files. When I try to open using DiskImageMounter.app, nothing at all happens, no errors, nothing. When I try to open from the terminal,...
My MacBook Pro 13" M1 crashed last night, I think because I switched off my external USB-C monitor. I logged in as normal but since then I am not able to open .dmg files. When I try to open using DiskImageMounter.app, nothing at all happens, no errors, nothing. When I try to open from the terminal, it just hangs for a while then says operation timed out:
$ hdiutil attach GoogleDrive.dmg
hdiutil: attach failed - Operation timed out
If I try to ctrl+c while it's trying to mount, I see this:
$ hdiutil attach DropboxInstaller.dmg # tried with different dmgs
^Ccanceling...^[[A2022-07-19 13:59:29.626 hdiutil[1971:21611] -[DIHelperProxy(Thread) waitForHelperDone] timed out waiting for helper registration
Strangely, it does show in diskutil:
$ diskutil list
...

/dev/disk4 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        +334.0 MB   disk4
   1:        Apple_partition_map                         32.3 KB    disk4s1
   2:                  Apple_HFS Install Google Drive    334.0 MB   disk4s2
                    (free space)                         291.3 GB   -
However, trying to eject it, it also just hangs until saying timed out.
$ diskutil eject /dev/disk4
Volume timed out while waiting to eject
What I tried so far: 1. Reboot several times 2. Create another admin account - didn't help, same issue. 3. Boot in safe mode, then it just says resource not available, not sure you can open dmg files in safe mode! 4. Did "first aid" of the Mac drive in disk utility (no errors found) 5. Tried different dmg files, including ones that worked yesterday, same result. I just did a clean install of my MacOS a few days ago, so there's not much third party apps except things like Slack, Chrome. Any ideas?
Hackeron (268 rep)
Jul 19, 2022, 01:00 PM • Last activity: Jul 19, 2022, 01:38 PM
2 votes
0 answers
92 views
How dangerous is 'sudo hdiutil eject -force /Volumes/path' for filesystem integrity in terms of cache flushing and open file integrity?
I find myself having some trouble sometimes with ejecting volumes normally. Usually this seems to happen with volumes that really don't (or shouldn't) have any files open that are non-negotiably being accessed or used. For example, these are usually volumes that have neither any open documents nor a...
I find myself having some trouble sometimes with ejecting volumes normally. Usually this seems to happen with volumes that really don't (or shouldn't) have any files open that are non-negotiably being accessed or used. For example, these are usually volumes that have neither any open documents nor any files that should be being accessed by anything other than Time Machine or Spotlight. Usually a sudo hdiutil eject -force /Volumes/path will resolve the issue, but I've recently had a friend raise a concern about whether or not a -force ejection might not flush any caches and perhaps not finalize writing data to the disk when given the -force directive. Is there any definitive information or testing in this regard so we can know with certainty what occurs here when -force is used with eject?
ylluminate (5787 rep)
Jun 27, 2022, 03:58 PM
1 votes
1 answers
516 views
Shrink disk image to eliminate free space
I created a larger-than-necessary writable disk image, copied content to it, then shrunk the partition with `diskutil resizeVolume`. This left a big gap at the end of the partition table: ``` MEDIA: ""; Size 20 GB [41943040 x 512]; Max Transfer Blocks 2048 SCHEME: 1 APM, "Apple Partition Scheme" [1]...
I created a larger-than-necessary writable disk image, copied content to it, then shrunk the partition with diskutil resizeVolume. This left a big gap at the end of the partition table:
MEDIA: ""; Size 20 GB [41943040 x 512]; Max Transfer Blocks 2048
SCHEME: 1 APM, "Apple Partition Scheme" 
SECTION: 1 Type:'MAP'; Size 20 GB [41943040 x 512]; Offset 1 Blocks (41943039 + 1) x 512
ID Type                 Offset       Size         Name                      (4)
-- -------------------- ------------ ------------ -------------------- --------
 1 Apple_partition_map             1           63 Apple               
 2 Apple_Free                     64       262144 Explicit Record     
 3 Apple_HFS                  262208     25941040 disk image          
 4 Apple_Free               26203248     15739792 Explicit Record
I cannot figure out how to eliminate this gap and shrink the disk image down to the minimal size. The obvious command does nothing (with or without -nofinalgap): hdiutil resize -sectors min image.dmg I can even edit the file with a hex editor to change the partition count, which results in this partition table (note Free not Apple_Free), but even then I cannot get figure out how to eliminate the free space.
ID Type                 Offset       Size         Name                      (3)
-- -------------------- ------------ ------------ -------------------- --------
 1 Apple_partition_map             1           63 Apple               
 2 Apple_Free                     64       262144 Explicit Record     
 3 Apple_HFS                  262208     25941040 disk image          
   Free                     26203248     15739792
rgov (641 rep)
Apr 3, 2022, 04:02 PM • Last activity: May 3, 2022, 10:00 PM
0 votes
0 answers
248 views
Owner and group of an hdiutil attached disk image
It's known that a disk image attached with ignored owners (`vsdbutil -c` prints disabled) will have owner and group to match whatever user is accessing the disk. However, the following bit from diskutil's man says it may behave differently: > The behavior is different when disk images are attached....
It's known that a disk image attached with ignored owners (vsdbutil -c prints disabled) will have owner and group to match whatever user is accessing the disk. However, the following bit from diskutil's man says it may behave differently: > The behavior is different when disk images are attached. With disk > images, the owner of all files in a filesystem mount for which owners > are ignored is the user attaching the disk image. The attaching owner > is also used when creating new files. I cannot replicate this. Despite the attaching user, owner and group are always set to match whomever is accessing disk's files.
Kentzo (379 rep)
Apr 7, 2022, 05:37 AM
1 votes
1 answers
1015 views
Why use the legacy Apple Partition Map scheme for macOS install media?
[Several][a] [guides][b] to creating disk images of macOS install media (using the `createinstallmedia` command) recommend creating the disk image like this: [a]: https://osxdaily.com/2020/07/20/how-convert-macos-installer-iso/ [b]: https://www.tweaking4all.com/software-development/create-macos-inst...
Several guides to creating disk images of macOS install media (using the createinstallmedia command) recommend creating the disk image like this: hdiutil create \ -size 10g \ -type UDTO -layout SPUD -fs JHFS+ \ ~/Desktop/installer.cdr Here, -layout SPUD creates the disk image with an Apple Partition Map , rather than the default, more modern GUID Partition Table . According to the hdiutil manpage, > SPUD causes a DDM and an Apple Partition Scheme partition map with a single entry to be written. GPTSPUD creates a similar image but with a GUID Partition Scheme map instead. When attached, multiple /dev entries will be created, with either slice 1 (GPT) or slice 2 (APM) as the data partition. (e.g. /dev/disk1, /dev/disk1s1, /dev/disk1s2). > > Unless overridden by -fs, the default layout is GPTSPUD (PPC systems used SPUD prior to Mac OS X 10.6). Other layouts include MBRSPUD and ISOCD. create -help lists all supported layouts. Some [decades old blogs](https://www.informit.com/articles/article.aspx?p=517379&seqNum=3) also note that GPT disks are not compatible with PowerPC Macs, and very old versions of macOS (prior to 10.4.2) do not understand GPT partition maps at all. And years ago there was briefly an [incompatibility with VirtualBox](https://www.virtualbox.org/ticket/14490) when using GPT-formatted install media. So perhaps APM was considered a more broadly compatible format. But these are just theories. Note that the createinstallmedia tool keeps the existing partition map flavor of the target disk, and Apple's KB articles indicate no preference for one over the other. The default when formatting a disk with Disk Utility in macOS Monterey is GPT, though, so this is likely what most people use. (As an experiment, I followed identical steps to created APM- and GPT-flavored install ISOs for macOS Big Sur and tried booting them with VMware Fusion, and only the APM-flavored installer could boot. I'm investigating this further.) **Is there actually a specific reason to continue using APM-flavored partition maps for macOS install media?**
rgov (641 rep)
Apr 3, 2022, 05:11 PM • Last activity: Apr 5, 2022, 05:18 PM
3 votes
0 answers
1895 views
hdiutil image still busy after unmout
I'm using hdiutil managing disk images. I mount the images with the following command: `$ hdiutil mount test.dmg` And I unmount them like this: `$ umount /Volume/device_name` It works fine, the device gets unmounted. However, `$ hdiutil info` still shows the unmounted images. ``` framework : 621 dri...
I'm using hdiutil managing disk images. I mount the images with the following command: $ hdiutil mount test.dmg And I unmount them like this: $ umount /Volume/device_name It works fine, the device gets unmounted. However, $ hdiutil info still shows the unmounted images.
framework       : 621
driver          : 621
images          : 3
================================================
image-path      : /private/tmp/test.dmg
shadow-path     : 
icon-path       : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type      : read/write
system-image    : false
blockcount      : 61440
blocksize       : 512
writeable       : TRUE
autodiskmount   : TRUE
removable       : TRUE
image-encrypted : TRUE
mounting user   : UserName
mounting mode   : -rwx------ 
process ID      : 37029
framework name  : DiskImages
/dev/disk3	GUID_partition_scheme	
/dev/disk3s1	7C3457EF-0000-1100-AA11-00306543ECAC	
/dev/disk4	EF57347C-0000-11AA-AA11-23406543ECAC	
/dev/disk4s1	41504653-0000-11AA-AA11-00306543ECAC
And, df also shows these devices:
$ df -h
Filesystem       Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk1s5s1  466Gi   15Gi  156Gi     9%  577263 1640990560    0%   /
devfs           391Ki  391Ki    0Bi   100%    1352          0  100%   /dev
/dev/disk1s4    466Gi  5.0Gi  156Gi     4%       7 1640990560    0%   /System/Volumes/VM
map auto_home     0Bi    0Bi    0Bi   100%       0          0  100%   /System/Volumes/Data/home
/dev/disk7s1    500Mi   24Ki  498Mi     1%       2    5102120    0%   /Volumes/untitled
In this, /dev/disk1s4 is the test.dmg image. When I try to detach it with hdutil detach, it's saying that the resource is busy.
$ hdiutil detach -force /dev/disk1s4
hdiutil: couldn't unmount "disk1" - Resource busy
$ hdiutil detach /dev/disk1s4
hdiutil: couldn't unmount "disk1" - Resource busy
Is there a way I can completely detach these devices such that hdutil info doesn't list these devices?
sammy (31 rep)
Jan 19, 2022, 09:13 AM
1 votes
2 answers
657 views
How extract a Time Machine snapshot as a full machine volume?
From an old Time Machine backup (`Backups.backupdb` folder) on a physical external disk I would like to extract some snapshots to other external disks as complete machine volumes. These resulting volumes don't need to be bootable, but if they are, even better. How can I do this? A command line solut...
From an old Time Machine backup (Backups.backupdb folder) on a physical external disk I would like to extract some snapshots to other external disks as complete machine volumes. These resulting volumes don't need to be bootable, but if they are, even better. How can I do this? A command line solution would be the best. I had a look at hdiutil, but wasn't sure whether it can help with this problem. ### Background: I am coming to this because I would like to archive old Time Machine backups (El Capitan system), but I have huge problems to copy the whole Time Machine folder to other locations. (I'm now on Mojave.) Therefore I thought I extract instead some snapshots of the Time Machine as complete system volumes to separate disk images. These volumnes should look like the original disk when the snapshot was created.
halloleo (1497 rep)
Dec 19, 2021, 01:35 PM • Last activity: Jan 4, 2022, 06:35 AM
3 votes
1 answers
4701 views
Using hdiutil to create a blank .dmg image in the current directory
As a workaround to [this issue][1], I want to use the `hdiutil` to create a blank image in the current directory. The settings should be identical to these of the GUI Disk Utility (`File` > `New Image` > `Blank Image`): So far I have figured out the below options for `hdiutil create`: - `-size 100m`...
As a workaround to this issue , I want to use the hdiutil to create a blank image in the current directory. The settings should be identical to these of the GUI Disk Utility (File > New Image > Blank Image):
               
So far I have figured out the below options for hdiutil create: - -size 100m or -megabytes 100 - -type SPARSEBUNDLE --> It seems like -type SPARSE and -type UDIF should be possible. I am not sure what is the difference though, or which one is better. - -fs 'Case-sensitive APFS' --> That seems to be more performant than the conventional -fs 'Case-sensitive Journaled HFS+' file system the part I can't figure out are: - how to make a blank image, not from a folder - how to place it in the current directory - what other options should I specify I would appreciate it if you could help me figure out the above issues and, if possible, answer my other questions.
Foad (163 rep)
Dec 17, 2021, 10:56 PM • Last activity: Dec 17, 2021, 11:45 PM
1 votes
1 answers
1734 views
Creating floppy disk images from folders of data files for VirtualBox
VirtualBox is able to pass floppy disk images (in a format called IMA) to VMs. For a data preservation project, I need to create a lot of those images. My host system is macOS 11.6 Big Sur, and I have Homebrew tools available. My data files are on my APFS disk, in a folder hierarchy where every fold...
VirtualBox is able to pass floppy disk images (in a format called IMA) to VMs. For a data preservation project, I need to create a lot of those images. My host system is macOS 11.6 Big Sur, and I have Homebrew tools available. My data files are on my APFS disk, in a folder hierarchy where every folder contains the files that were originally on the corresponding floppy. Those folders seem to have been created by just copying floppy contents on an old DOS/Win311 machine. Example: disk1 file1.ext file2.ext disk2 another1.txt another2.txt None of the disks need to be bootable, so boot sector creation is irrelevant in this context. I tried to just create the images using hdiutil, but the resulting image files would not work: hdiutil create -size 1440k -fs "MS-DOS FAT12" -layout NONE -srcfolder disk2 -format UDRW -ov diskimage2.ima So, can you suggest a (scriptable, non-interactive) way to go through a folder hierarchy and convert every folder to a disk image for VirtualBox containing that folder's files?
jstarek (3716 rep)
Nov 3, 2021, 08:28 AM • Last activity: Nov 4, 2021, 01:45 PM
3 votes
3 answers
1237 views
Can I attach a .dmg without mounting the drive that it is sitting in?
I have a .dmg sitting on an external drive (which also contains other data). The .dmg is an image of a failed drive so I can't mount it but I want to attach the .dmg _without_ mounting the partition it is in. Is this possible? I ask because, if I mount the partition, attach the .dmg and then try to...
I have a .dmg sitting on an external drive (which also contains other data). The .dmg is an image of a failed drive so I can't mount it but I want to attach the .dmg _without_ mounting the partition it is in. Is this possible? I ask because, if I mount the partition, attach the .dmg and then try to run TestDisk, TestDisk returns this message:
Write access for this media is not available.
TestDisk won't be able to modify it.

- No partition from this disk must be mounted:
Open the Disk Utility (In Finder -> Application -> Utility folder)
and press Unmount button for each volume from this disk
I tried what I thought would work:
attach /dev/disk2s2/cfp/disk0s2-clone.dmg
it didn't,
failed - Not a Directory
I guess a different way of asking my question is, "How can I use TestDisk on a .dmg if I can't mount the partition that the .dmg is in?"
tripleman (43 rep)
Mar 1, 2020, 12:27 AM • Last activity: Oct 20, 2021, 12:01 PM
0 votes
1 answers
799 views
hdiutil convert -format UDRW not truly editable
Trying to add a single file to an existing ISO I ran into a bit of hiccup I can't see through. Here it is: Having never done it before but encouraged by reading the advice from this question: https://apple.stackexchange.com/questions/228116/add-delete-modify-files-within-a-disk-image-dmg I ran: hdiu...
Trying to add a single file to an existing ISO I ran into a bit of hiccup I can't see through. Here it is: Having never done it before but encouraged by reading the advice from this question: https://apple.stackexchange.com/questions/228116/add-delete-modify-files-within-a-disk-image-dmg I ran: hdiutil convert -format UDRW -o EditableImage.dmg givenImage.ISO and although it created a DMG that was was "mount-able" - I was not able to edit it in any way. Trying to run hdiutil resize -size 400m EditableImage.dmg gave me a failure with Resource temporarily unavailable. (I rebooted just to be sure there was nothing using it) running hdiutil imageinfo EditableImage.dmg indicated it was of Format: UDRW but I couldn't actually write to it.. and this led me to asking here the question: what am I doing wrong? [Runnning Catalina on a less than 1 yr old Mac with all updates]
CodeCanoer (11 rep)
Dec 23, 2020, 12:23 AM • Last activity: Oct 20, 2021, 06:48 AM
Showing page 1 of 20 total questions