Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mufufu

macrumors member
Original poster
May 21, 2009
41
0
How can I copy files from a folder (eg Volume/Users/Name/Music) inside an HD volume to an external HD (eg Lacie 500gb) via terminal commands from installation disc boot? What are the proper commands to type in the terminal?

Please note that the HD volume that stores the folder that i want to copy (which is also where I install the OSX) is unbootable due to an invalid node structure issues. Thus I can only boot from installation disc. I have tried many solutions to no result. Now I just want to transfer the files in that "failed" volume to an external HD. Also note (not sure how much it matters) that I can see all the files there in the volume through disk utility restore option although I can't access it.

So, again, suppose that copying files via terminal in installation disc boot is the only posssible solution, what commands should I type?

Thanks a lot for the help!

MacBook unibody (no FW). OS X 10.5.8
 
Last edited:
Nov 28, 2010
22,670
31
located
Thanks for the quick reply. I'm not an expert so that single command looks rather cryptic to me. Would appreciate any further explanation.

Code:
man cp
is the manual for the "cp" command. Enter that into Terminal and see this:
2012_02_22_pC1_TerminalMANCP.png
 

mufufu

macrumors member
Original poster
May 21, 2009
41
0
Code:
man cp
is the manual for the "cp" command. Enter that into Terminal and see this:
Image[/

Thanks for the explanation. Honestly I don't understand the order and structure of the letters in the synopsis above and how can I apply it to my particular situation eg. copying an iTunes music folder in an unbootable disk0s2 to an external media eg. 500 gb LaCie via terminal from installation disc boot.

Would it be a long string of commands in that case?​
 
Last edited:

mufufu

macrumors member
Original poster
May 21, 2009
41
0
And I hope that transferring files from an unbootable volume that way is still possible?
 
Nov 28, 2010
22,670
31
located
Code:
man cp
is the manual for the "cp" command. Enter that into Terminal and see this:
Image[/

Thanks for the explanation. Honestly I don't understand the order and structure of the letters in the synopsis above and how can I apply it to my particular situation ie. copying an iTunes music folder in an unbootable disk0s2 to my 500 gb LaCie via terminal from installation disc boot.

Would it be a long string of commands in that case?​


Do you have access to any other Mac or Windows computer?
You could take the internal HDD out and put it into a USB enclosure for 2.5" S-ATA HDDs (cost around 10+ €).

And I hope that transferring files from an unbootable volume that way is still possible?

If the files are accessible, then probably yes.​
 

mufufu

macrumors member
Original poster
May 21, 2009
41
0
Transferring files from "unbootable" volumes is fine. Transferring files from unmountable volumes is obviously not possible through Terminal. I'm not sure if your hard drive error rendered the drive unmountable or not.

From installation disc boot, when I type df in the terminal it shows the HD (disk0s2h). The disk utility also shows that the HD volume is mounted (and there's an option to unmount). I can also have a look of all the files inside the volume through the restore option in DIskutility (I can click the HD and all the folders and the files are there to be seen).

Does it mean that the volume in question is clearly mounted? Conversely, how can we tell that a certain drive is unmountable?

Lastly, suppose the volume turns out to be unmountable, what's the best way to retrieve the files therein? Thanks a lot. Much appreciated.
----------

Do you have access to any other Mac or Windows computer?
You could take the internal HDD out and put it into a USB enclosure for 2.5" S-ATA HDDs (cost around 10+ €).

Unfortunately now I'm stuck in a remote area but I'll consider this option once I have access. Thanks.

If the files are accessible, then probably yes.

By accessible, are you referring to the indications that I mentioned above (eg the HD and files therein can be seen through the DU restore option)?
 
Nov 28, 2010
22,670
31
located
Lastly, suppose the volume turns out to be unmountable, what's the best way to retrieve the files therein? Thanks a lot. Much appreciated.
Taking it out, like mentioned in my last post.

By accessible, are you referring to the indications that I mentioned above (eg the HD and files therein can be seen through the DU restore option)?
Yes.

But what about my question regarding having access to another Mac or Window computer and taking out the HDD and putting it into an enclosure for 2.5" S-ATA HDDs?
 

mufufu

macrumors member
Original poster
May 21, 2009
41
0
Taking it out, like mentioned in my last post.


Yes.

But what about my question regarding having access to another Mac or Window computer and taking out the HDD and putting it into an enclosure for 2.5" S-ATA HDDs?

Ow I actually answered that but it got mixed in the quote. That option is currently not doable since I'm now in a remote area with no other Mac or windows pc nearby. I'll consider that option once I have access but I really I hope I can resolve this asap with another solution since I urgently need some work-related files.
 
Nov 28, 2010
22,670
31
located
But what happens, once you are successful in retrieving the files?
Do you reinstall your OS?

As far as I have understood, you don't have a bootable OS on your external HDD.

And from what kind of computer are you posting your posts?
 

mufufu

macrumors member
Original poster
May 21, 2009
41
0
But what happens, once you are successful in retrieving the files?
Do you reinstall your OS?

As far as I have understood, you don't have a bootable OS on your external HDD.

And from what kind of computer are you posting your posts?

Well, as long as I can get ahold of the files I'll be very happy. Once I have the files, I'm thinking of reinstalling the osx from the Installation disc or any other ways. But my main concern right now is the retrieval of the work files and the iTunes folder first.

Btw, I'm posting from my iPhone. I wonder if an iPhone could be of help in any way for the retrieval attempt?
 
Nov 28, 2010
22,670
31
located
Well, as long as I can get ahold of the files I'll be very happy. Once I have the files I'm thinking of reinstalling the osx from the Installation disc or any other ways. But my main concern is the retrieval of the work files and the iTunes folder first.
Which kind of installation media do you have with you? And how much free space do you have on that HDD?

Btw, I'm posting from my iPhone.
Ah, it was missing that "mobile phone" gibberish you almost always see with posts from mobile devices.
I wonder if an iPhone could be of help in any way for the retrieval attempt?
Only for communicating for help, as you do now, nothing more.
 

mufufu

macrumors member
Original poster
May 21, 2009
41
0
Which kind of installation media do you have with you? And how much free space do you have on that HDD?

A bit of tough luck actually. Now I only have two Kingston USB flash disk 8 and 2 gb respectively, but im not sure whether those flashdisks would be useful in this situation? I'm still waiting for a friend who's now looking for a spare external HD somewhere (could be WD or LaCie I'm not sure, probably from 250 to 500 gb). That's the reason why i haven't done anything yet.

The total files I wish to retrieve is only around 150 gb, but what's urgent right now is the work folder and a recent iTunes folder with a total size of probably not more than 7 gb.

Again, for now I haven't thought of anything other than copying the folders to an external media via terminal from disc installation boot.

So what would you do if you were in my situation? Thanks a lot for your suggestions.
 
Nov 28, 2010
22,670
31
located
So what would you do if you were in my situation? Thanks a lot for your suggestions.

I would try myself with Terminal first, if I were in your situation.
If that would not work, though it should, as it seems, then I would make contact with someone with another Mac and/or installation media for Mac OS X, that is compatible with my Mac.
In Mac OS X 10.5 Leopard you have the option of an Archive and Install, which moves the old files into one folder (Previous System or so) and then reinstalls Mac OS X.
In Mac OS X 10.6 Snow Leopard you can simply reinstall Mac OS X without any loss of data.

Anyway, I always have a cloned backup with me, thus I can at least boot my Mac. I also always have the installer of Mac OS X 10.6 Snow Leopard with me on another partition of that HDD with the bootable backup.
Now I just moved that HDD from an external enclosure into my MacBook Pro, thus I have an SSD for my OS and such, and the "new" HDD as backup and data HDD.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,747
8,421
A sea of green
In Mac OS X 10.5 Leopard you have the option of an Archive and Install, which moves the old files into one folder (Previous System or so) and then reinstalls Mac OS X.

Archive and Install isn't going to help. An "invalid node structure" is significant file-system damage, and Disk Utility is unlikely to be able to repair it. A tool like DiskWarrior might, but the only way to know for sure is to try it (after preserving as much data as possible). If DiskWarrior or similar can't fix it, then the disk needs to be erased.

Google the terms invalid node structure and you'll find any number of posts about the seriousness of this.

I wouldn't count on Terminal being able to get the files reliably, either. It might work, or it might hang or crash, or it might copy them with corrupted data. No way to tell except by trying it and then opening each file to see if it's corrupted. If DiskWarrior identifies the exact files that are affected by the invalid node structure, that could be a big help in identifying which files to avoid, or to try copying last.


As to the exact commands to type in Terminal, the first step is to identify which files need to be copied. We can't give an exact command line without knowing which files or folders to copy.
 
Nov 28, 2010
22,670
31
located
Archive and Install isn't going to help. An "invalid node structure" is significant file-system damage, and Disk Utility is unlikely to be able to repair it. A tool like DiskWarrior might, but the only way to know for sure is to try it (after preserving as much data as possible). If DiskWarrior or similar tool can't fix it, then the disk needs to be erased.

Google the terms invalid node structure and you'll find any number of posts about the seriousness of this.

I wouldn't count on Terminal being able to get the files reliably, either. It might work, or it might hang, or it might copy them with corrupted data. No way to tell except by trying it and then opening each file to see if it's corrupted. If DiskWarrior identifies the exact files that are affected by the invalid node structure, that could be a big help in identifying which files to avoid, or to try copying last.

Thanks for the additional information, I have overlooked the invalid node structure part completely. :eek:
 

mufufu

macrumors member
Original poster
May 21, 2009
41
0
I would try myself with Terminal first, if I were in your situation.
If that would not work, though it should, as it seems, then I would make contact with someone with another Mac and/or installation media for Mac OS X, that is compatible with my Mac.
In Mac OS X 10.5 Leopard you have the option of an Archive and Install, which moves the old files into one folder (Previous System or so) and then reinstalls Mac OS X.
In Mac OS X 10.6 Snow Leopard you can simply reinstall Mac OS X without any loss of data.

Anyway, I always have a cloned backup with me, thus I can at least boot my Mac. I also always have the installer of Mac OS X 10.6 Snow Leopard with me on another partition of that HDD with the bootable backup.
Now I just moved that HDD from an external enclosure into my MacBook Pro, thus I have an SSD for my OS and such, and the "new" HDD as backup and data HDD.

Noted. Since you mentioned that you would also try copying files via terminal, actually my main question hasn't been answered ie the exact commands for cp (copy) to type in the terminal for my particular case. Say that I wish to copy the whole iTunes folder in the volume/disk0s2 to a..say, LaCie 500 gb portable disk?
If it's not too much, would be grateful if I could have the exact string of commands for that.

In any case, thanks a lot for all your explanations :)

----------

As to the exact commands to type in Terminal, the first step is to identify which files need to be copied. We can't give an exact command line without knowing which files or folders to copy.

Hello, many thanks for your helpful info.

As to your question on which folders to copy, and my main question i.e. the exact commands for cp (copy) to type in the terminal, let's say that I wish to copy the whole iTunes folder in the volume/disk0s2 to a..say, LaCie 500 gb portable disk?
If it's not too much, would be grateful if I could have the exact string of commands for that.

Thanks again.
 

Mac-Michael

macrumors regular
Jan 13, 2010
186
0
It would be:
Code:
cp -R [source folder] [destination directory]/[foldername]/

From the cp manual page:
-R If source_file designates a directory, cp copies the directory and
the entire subtree connected at that point. If the source_file
ends in a /, the contents of the directory are copied rather than
the directory itself. This option also causes symbolic links to be
copied, rather than indirected through, and for cp to create spe-
cial files rather than copying them as normal files. Created
directories have the same mode as the corresponding source direc-
tory, unmodified by the process' umask.

In -R mode, cp will continue copying even if errors are detected.

iTunes Music is in /Users/YourUserName/Music/iTunes/iTunes\ Music/
 

chown33

Moderator
Staff member
Aug 9, 2009
10,747
8,421
A sea of green
As to your question on which folders to copy, and my main question i.e. the exact commands for cp (copy) to type in the terminal, let's say that I wish to copy the whole iTunes folder in the volume/disk0s2 to a..say, LaCie 500 gb portable disk?

Command-lines require precision. You're not providing it.

First, the mount name isn't necessarily "disk0s2", even if that's the device name that Disk Utility shows you. Second, the name of the folder where disks are usually mounted isn't "volume", it's "/Volumes". Note: it starts with "/" and ends with "s". Third, you haven't given the name of the LaCie portable disk, and we can't possibly guess what it might be.

Because no one can give specific command-lines without knowing what the exact names are, please enter the following command in Terminal, exactly as posted. Copy and paste it if necessary.
Code:
ls -la /Volumes
Then tell us very specifically which of the names listed from /Volumes is the LaCie portable disk.

Also post the output of this command line:
Code:
mount ; echo ~ ; id

If it seems like I'm being picky, it's because the command-line must be precise. You can't leave out slashes. You must spell things correctly. If you make a mistake, the command could do something you didn't expect. In the worst case, you can overwrite something you want to preserve, and that would be bad.
 

mufufu

macrumors member
Original poster
May 21, 2009
41
0
It would be:
Code:
cp -R [source folder] [destination directory]/[foldername]/

From the cp manual page:


iTunes Music is in /Users/YourUserName/Music/iTunes/iTunes\ Music/

Thanks a lot. Firstly, pls note that I'm accessing the terminal from osx installation disc boot. So if the target volume disk is "disk0s2" and my destination external HD is "disk2s1" (a 500 GB Western Digital USB portable external HD), is it correct to type the following commands?

cp -R [disk0s2] [disk2s1]/Users/[MyUserName/Music/iTunes/iTunes\ Music]/

And should I put the brackets exactly as above? Thanks in advance.
 
Last edited:

Mal

macrumors 603
Jan 6, 2002
6,252
18
Orlando
Thanks a lot. Firstly, pls note that I'm accessing the terminal from osx installation disc boot. So if the target volume disk is "disk0s2" and my destination external HD is "disk2s1" (a 500 GB Western Digital USB portable external HD), is it correct to type the following commands?

cp -R [disk0s2] [disk2s1]/Users/[MyUserName/Music/iTunes/iTunes\ Music]/

And should I put the brackets exactly as above? Thanks in advance.

No, don't include the brackets. Also, volumes are stored in the /Volumes/ directory for this type of access, so you'll need more specific paths:

Code:
cp -R /Volumes/[disk0s2] /Volumes/[disk2s1]/Users/MyUserName/Music/iTunes/iTunes\ Music/

Remember, your drive isn't named disk0s2, so don't put that in there. Instead, replace the part in brackets with the actual name of the drive as listed in the command posted by chown33.

jW
 

chown33

Moderator
Staff member
Aug 9, 2009
10,747
8,421
A sea of green
No, don't include the brackets. Also, volumes are stored in the /Volumes/ directory for this type of access, so you'll need more specific paths:

Code:
cp -R /Volumes/[disk0s2] /Volumes/[disk2s1]/Users/MyUserName/Music/iTunes/iTunes\ Music/

Remember, your drive isn't named disk0s2, so don't put that in there. Instead, replace the part in brackets with the actual name of the drive as listed in the command posted by chown33.

jW
The order of parameters to the cp command is wrong, if the intent is to copy from the iTunes music folder to an external drive.

let's say that I wish to copy the whole iTunes folder in the volume/disk0s2 to a..say, LaCie 500 gb portable disk?

As I said before, commands require precision. I'm not picking on any one person here, just saying that unless it's very clear exactly what the names of everything is, and exactly what the goal of the command line is, imprecise or poorly formed command-lines can cause major problems.

Also, posting hypotheticals like "let's say that I wish to copy the whole iTunes folder" is a bad idea, unless that's exactly what one wishes to do. If the only goal here is saving the OP's music collection, then there may be alternatives. Heck, maybe there's an alternative for saving other files. For example, is it possible to install the OS onto the external LaCie drive, boot from that, then use Finder to copy the files? I thought the goal was saving some important work files, so let's see some specifics about exactly where those files are located.
 

Mal

macrumors 603
Jan 6, 2002
6,252
18
Orlando
The order of parameters to the cp command is wrong, if the intent is to copy from the iTunes music folder to an external drive.



As I said before, commands require precision. I'm not picking on any one person here, just saying that unless it's very clear exactly what the names of everything is, and exactly what the goal of the command line is, imprecise or poorly formed command-lines can cause major problems.

Also, posting hypotheticals like "let's say that I wish to copy the whole iTunes folder" is a bad idea, unless that's exactly what one wishes to do. If the only goal here is saving the OP's music collection, then there may be alternatives. Heck, maybe there's an alternative for saving other files. For example, is it possible to install the OS onto the external LaCie drive, boot from that, then use Finder to copy the files? I thought the goal was saving some important work files, so let's see some specifics about exactly where those files are located.

Oops, I missed that part. I wasn't paying attention to the previous posts, just trying to fix the code he'd posted.

jW
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.