Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Question:

Question: Using Terminal to copy home folder and the destination copy is much larger

All,


I am in recovery mode on a Mac that wont boot. I am using terminal to copy the entire home folder to an external drive. Total space used on internal drive is around 500GB.


Here is the rub - I have an 8TB drive connected and it is using 5.5TB of space so far on the copy and it isnt done yet. It has been copying for 24 hours! What gives?


Command used to copy home folder: cp -rv /Volumes/Macintosh\ HD/Users/<profile name> /Volumes/backup


I used the df-h command in a second terminal window to see how much space is used so far on the external and it far exceed the size of the data and even internal drive (1TB).


Any explanation as to what is happening? Is data being duplicated somehow?


TY in advance for any input.

Posted on May 15, 2020 7:52 AM

Reply

May 15, 2020 4:52 PM in response to schmoopy2000 In response to schmoopy2000

I was finally able to perform the create image file from folder using the home directory as the root folder. Battled all kinds of errors along the way but managed to get it done. This terminal file copy mess was and is a complete enigma to me and i have never seen that in all my years of IT. Tis a mystery.

May 15, 2020 4:52 PM

Reply Helpful

May 16, 2020 6:00 PM in response to schmoopy2000 In response to schmoopy2000

Is data being duplicated somehow?

Maybe. If you have an iPhotos and a Photos library, there are hardlinks (multiple directory entries that point to the same storage). There can be other hardlinks situations on macOS.


The 'cp' command does not know, and does not care if you have hardlinks. It sees a directory entry and copies it. You get a duplicated file.


macOS has the ability to compress stored files, but the 'cp' command is not going to trigger that compression, so a file may expand to use more space.


Depending on which version of macOS, there may be 'sparse' files, where large ranges of zeros in the file, do not even have allocated storage. So there may be files with islands of data with nothing allocated in-between. the 'cp' command does not know this, and allocates storage for those holes. NOTE: This is less likely to happen, as most consumer files do not take advantage of sparse files.


Basically the 'cp' command is rather simplistic with regards to how files are actually stored in a file system. Some of that is because the standard Unix file system API's does not make that information available to utilities such as 'cp'.


You might look into the 'ditto' command. It says it can preserve hardlinks. It also says it can provide HFS compression.


And, no I do not know what command you should use. I know ditto exists, and I can read the man page to see it says it support hardlinks and hfs compression. That does not mean I am skilled at using 'ditto'. Google would be your friend in this case.

May 16, 2020 6:00 PM

Reply Helpful
User profile for user: schmoopy2000

Question: Using Terminal to copy home folder and the destination copy is much larger