Move files out of disk image on volume to same volume without copying possible?

Apple community. This may seem like a trivial question and a non starter, but I thought I'd post in case someone knows of a clever way to do this:


Is it possible to move files out of a disk image that is on a RAID and onto the RAID itself without copying the files?


The issue is that technically these files are already on the physical RAID taking up the space, but they're inside a sparse disk image. It would be great if I could just move them out of the diske rather than copying them onto the same RAID volume, dealing with the time this takes, and deleting files from the disk image after they've been copied out of it so that I don't fill up the RAID.


Hope this makes sense.

MacBook Pro (M2 Max, 2023)

Posted on Jun 23, 2023 11:01 AM

Reply

Similar questions

7 replies

Jun 23, 2023 11:13 AM in response to Barney-15E

Holding down the command key does work...sort of. Instead of copying, the operation says "moving" and it just seems like it's going to take just as long as copying. So in this case, one of my folders which is 1.4 TB is taking just as long to copy it out of the disk image as it does to hold down command and move it out. The only difference is that it will no longer exist in the disk image when the operation is done and I won't have to mange duplicate folders worth of space before deleting one.



The hope was that the OS can just move it out like moving between folders.

Jun 23, 2023 7:03 PM in response to Tangier Clarke1

No.


In my day job, I'm a Unix file system developer. What you want to do is not possible.


From the perspective of the file system on the RAID, the disk image is a single file, and the external file system does not know anything about the structure of the file system inside the disk image. And there is "NO" API for removing storage from a disk image, along with all the metadata, and giving that to the enclosing file system as a new file.


What you want to do is like taking an upstairs ensuite bathtoom and moving it to the downstairs living room AND expecting the water to run, the toilet to flush without the plumbing and electrical hooked up. And the bedroom to automatic reconfigure itself as if the bathroom never existing in the bedroom. And the living room will dynamically expand to accommodate the bathroom without getting smaller.


A file consists of a file name stored in a directory. The directory basically has the file name and a pointer to the file metadata stored elsewhere in the file system (metadata keeps track of file storage, ownership, permissions, file attributes, etc....).


Moving a file without copying basically involves deleting the current directory entry, and creating an entry with the same name in a new directory. The new directory still points to the same metadata that is keeping track of your file.


The primary restriction for moving a file without copying is that both directories must exist in the same file system.


What you want to do is move a file between 2 file systems, and that involves copying the data and creating new metadata in the destination file system.


If you can keep the disk image mounted, or at least mounted when you want to access this file, you could create a macOS Alias in the RAID based file system that points to the file in the disk image. A macOS Alias should work for any GUI based app. One advantage of an Alias is that it should automatically mount the disk image. The disadvantage is that an Alias will only work with GUI based apps.


If you want non-GUI base apps to access the file, then you could create a symbolic link via either a 3rd party GUI based utility that will create symbolic links, or you could create it from an Applications -> Utilities -> Terminal session:


ln -s /Volumes/name-of-disk-image-when-mounted/path/to/file  /RAID-file-system/path/to/where/you/want/to/use/the/file


Google can help you with examples on creating symbolic links.


The advantage of a symbolic link is it will work with any application. The disadvantage is the disk image must already be mounts, as the symbolic link will not trigger a mount.

Move files out of disk image on volume to same volume without copying possible?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.