Need urgent help copying folder from desktop to USB drive in Single User Mode

I would be most grateful if someone with knowledge of Single User Mode commands could help me out to copy one specific folder from the desktop to a USB drive. I know the path of the folder, the USB drive is formatted to Mac Extended (Journaled).


All other avenues have been exhausted (Apple support have tried to guide me through it). Local recovery does not work, I have tried Internet recovery and loaded a bootable version of High Sierra on to a USB drive but although it recognises it as bootable it just refuses to install the OS (fails at the last bit of the progress bar). I have a time machine backup from a few weeks ago but it's missing this particular important folder unfortunately. I am currently in Thailand so I don't have the installation CD, no access to another Mac and no tools to open take out the SSD and put it in an enclosure to recover the files.


In summary, I can get into single user mode and I need help to mount the USB drive (disk2s1, volume is called "thumb" and formatted to Mac OS extended journaled), instruct it to copy from the SSD (disk0, the volume is called SSD), the specific folder path to copy from is "SSD/users/rastefatah/desktop/Outlook Festival 2017 RAW files"


Any help is greatly appreciated.


Raste

Posted on Oct 5, 2017 8:33 AM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on Oct 8, 2017 9:48 AM

ditto -X -rsrc /SSD/users/rastefatah/Desktop/Outlook Festival 2017 RAW files/* /Volumes/thumb

You will note that the path contains spaces. You need to escape all spaces.You need to put quotes around all file names with a space in them. I'm not so sure about the asterisk [ * ]. I think you need to do:

ditto -X -rsrc "/SSD/users/rastefatah/Desktop/Outlook Festival 2017 RAW files" /Volumes/thumb

the ditto command copies over a directory / folder at a time.

------------------------------------------

A basic explanation of Unix terminal commands is here: https://discussions.apple.com/docs/DOC-11071


Here is an overview of the terminal commands.


In case you have spaces in your filenames or directories, you need to escape them. See examples:

Use quotes around the name

mac $ ls -l ~/"see it"
-rw-r--r-- 1 mac staff 3171 Oct 26 23:38 /Users/mac/see it
mac $

Use the backslash character to escape the next character
mac $ cd /Users/mac/Desktop/ttt\ html\ copy/




Lets assume that your account has a short user name of mac.

Macintosh-HD -> Applications -> Utilities -> Terminal

What is my short user name? Type the whoami command.

mac $ whoami
mac
mac $

How to list all of your disks.
The ls command is for list

mac $ ls /Volumes/
Audio CD Macintosh-HD Spotless Tiger-ext
mac $

Let's say your flash drive is named Spotless


# cd is change directory

mac $ cd /Volumes/Spotless
# pwd is Print Working Directory. A directory is the Unix name for a folder. You are always in a directory.
mac $ pwd
/Volumes/Spotless
mac $

# The ls command is for list
# l is long
# F is type of file where / is directory. For directories, the slash is pasted to the end of the name.

mac $ ls -lF
total 134704
-rw-r--r-- 1 mac staff 64560 Mar 3 2009 A-picture-of-Youpi-key.png
drwxr-xr-x 83 mac staff 2822 Nov 7 14:52 Applescript files/
drwxrwxrwx 12 mac staff 408 Dec 13 2008 Christmas Cards/
drwxr-xr-x 9 mac staff 306 Dec 21 17:39 Christmas Cards 2009/
... trimmed ...

What does all this mean?

drwxrwxrwx

d = directory
r = read
w = write
x = executeable program

drwxrwxrwx
|| | |
|| | all other users not in first two types
|| |
|| group
||
|owner
|
What type of entry is this? d = directory, - = file, etc.


Every Unix resource: files, folders, etc has an owner, group, other
A Unix resource has one owner.
A Unix resource has one group. A group contains a list of users.


To gain access to a file, you can be the owner, in the group, or not the owner and not in the group hence you end up as other. The owner, group, or other has read, write, or execute permissions.


# l is long
# a is all to show hidden files & folders

mac $ ls -lFa
total 134736
drwxr-xr-x 41 mac staff 1496 Dec 22 17:11 .
drwxrwxrwt 8 root admin 272 Dec 24 13:55 ..
-rwxrwxrwx 1 mac staff 15364 Dec 23 12:52 .DS_Store*
drwx------ 4 mac staff 136 Jan 22 2009 .Spotlight-V100
drwxrwxrwt 5 mac staff 170 Sep 14 16:36 .TemporaryItems
d-wx-wx-wx 4 mac staff 136 Dec 31 1969 .Trashes
-rw-r--r-- 1 mac staff 64560 Mar 3 2009 A-picture-of-Youpi-key.png
drwxr-xr-x 83 mac staff 2822 Nov 7 14:52 Applescript files
drwxrwxrwx 12 mac staff 408 Dec 13 2008 Christmas Cards
drwxr-xr-x 9 mac staff 306 Dec 21 17:39 Christmas Cards 2009
... trimmed ...

# mv is move or rename
mv -i the-name the-new-name




# You can just rename the file back to what it was with mv command.
mv -i old-name new-name


Here is what these commands mean:
cd is change directory
pwd is a print working directory
ls is list
sudo is Super user do
mv is move or rename


For cryptic comments, you can always uses the manual command which is man. For example:
man mv


Type the letter q to quit the man command.



Do you know about tabbing? Type in a few letters of a name then press the tab key. The computer will type out the rest of the name if it is unique.


Press the up arrow key to see the previous command(s).


To edit a command, use the left arrow key to more left and the right arrow key to move right. Use the delete key to delete the key to the left. Type a letter to insert.


history to see many previous commands.


mac $ history

1 pwd

2 man ls

3 history

You may copy then paste from this list.


----------------------


http://discussions.apple.com/thread.jspa?threadID=2692161&tstart=0


Robert

10 replies
Sort By: 
Question marked as ⚠️ Top-ranking reply

Oct 8, 2017 9:48 AM in response to krude1

ditto -X -rsrc /SSD/users/rastefatah/Desktop/Outlook Festival 2017 RAW files/* /Volumes/thumb

You will note that the path contains spaces. You need to escape all spaces.You need to put quotes around all file names with a space in them. I'm not so sure about the asterisk [ * ]. I think you need to do:

ditto -X -rsrc "/SSD/users/rastefatah/Desktop/Outlook Festival 2017 RAW files" /Volumes/thumb

the ditto command copies over a directory / folder at a time.

------------------------------------------

A basic explanation of Unix terminal commands is here: https://discussions.apple.com/docs/DOC-11071


Here is an overview of the terminal commands.


In case you have spaces in your filenames or directories, you need to escape them. See examples:

Use quotes around the name

mac $ ls -l ~/"see it"
-rw-r--r-- 1 mac staff 3171 Oct 26 23:38 /Users/mac/see it
mac $

Use the backslash character to escape the next character
mac $ cd /Users/mac/Desktop/ttt\ html\ copy/




Lets assume that your account has a short user name of mac.

Macintosh-HD -> Applications -> Utilities -> Terminal

What is my short user name? Type the whoami command.

mac $ whoami
mac
mac $

How to list all of your disks.
The ls command is for list

mac $ ls /Volumes/
Audio CD Macintosh-HD Spotless Tiger-ext
mac $

Let's say your flash drive is named Spotless


# cd is change directory

mac $ cd /Volumes/Spotless
# pwd is Print Working Directory. A directory is the Unix name for a folder. You are always in a directory.
mac $ pwd
/Volumes/Spotless
mac $

# The ls command is for list
# l is long
# F is type of file where / is directory. For directories, the slash is pasted to the end of the name.

mac $ ls -lF
total 134704
-rw-r--r-- 1 mac staff 64560 Mar 3 2009 A-picture-of-Youpi-key.png
drwxr-xr-x 83 mac staff 2822 Nov 7 14:52 Applescript files/
drwxrwxrwx 12 mac staff 408 Dec 13 2008 Christmas Cards/
drwxr-xr-x 9 mac staff 306 Dec 21 17:39 Christmas Cards 2009/
... trimmed ...

What does all this mean?

drwxrwxrwx

d = directory
r = read
w = write
x = executeable program

drwxrwxrwx
|| | |
|| | all other users not in first two types
|| |
|| group
||
|owner
|
What type of entry is this? d = directory, - = file, etc.


Every Unix resource: files, folders, etc has an owner, group, other
A Unix resource has one owner.
A Unix resource has one group. A group contains a list of users.


To gain access to a file, you can be the owner, in the group, or not the owner and not in the group hence you end up as other. The owner, group, or other has read, write, or execute permissions.


# l is long
# a is all to show hidden files & folders

mac $ ls -lFa
total 134736
drwxr-xr-x 41 mac staff 1496 Dec 22 17:11 .
drwxrwxrwt 8 root admin 272 Dec 24 13:55 ..
-rwxrwxrwx 1 mac staff 15364 Dec 23 12:52 .DS_Store*
drwx------ 4 mac staff 136 Jan 22 2009 .Spotlight-V100
drwxrwxrwt 5 mac staff 170 Sep 14 16:36 .TemporaryItems
d-wx-wx-wx 4 mac staff 136 Dec 31 1969 .Trashes
-rw-r--r-- 1 mac staff 64560 Mar 3 2009 A-picture-of-Youpi-key.png
drwxr-xr-x 83 mac staff 2822 Nov 7 14:52 Applescript files
drwxrwxrwx 12 mac staff 408 Dec 13 2008 Christmas Cards
drwxr-xr-x 9 mac staff 306 Dec 21 17:39 Christmas Cards 2009
... trimmed ...

# mv is move or rename
mv -i the-name the-new-name




# You can just rename the file back to what it was with mv command.
mv -i old-name new-name


Here is what these commands mean:
cd is change directory
pwd is a print working directory
ls is list
sudo is Super user do
mv is move or rename


For cryptic comments, you can always uses the manual command which is man. For example:
man mv


Type the letter q to quit the man command.



Do you know about tabbing? Type in a few letters of a name then press the tab key. The computer will type out the rest of the name if it is unique.


Press the up arrow key to see the previous command(s).


To edit a command, use the left arrow key to more left and the right arrow key to move right. Use the delete key to delete the key to the left. Type a letter to insert.


history to see many previous commands.


mac $ history

1 pwd

2 man ls

3 history

You may copy then paste from this list.


----------------------


http://discussions.apple.com/thread.jspa?threadID=2692161&tstart=0


Robert

Reply

Oct 8, 2017 9:25 AM in response to krude1

See: How to access a USB drive while in Mac single-user mode | alvinalexander.com

and: How do I copy files from various locations to a USB flash drive in Single User Mode?

The copy command is cp -- copy files

You can also use ditto -- copy directory hierarchies, create and extract archives

Reply

Oct 8, 2017 9:26 AM in response to krude1

Here are my notes. They come from my 10.4 days 😎. In 10.4, the flash drive came up read/write when you placed the flash drive in a usb port before you booted the machine.


You could try getting into the Unix command line interface and copy some files or directories. You can copy files on the Unix command line interface if you placed the flash drive the USB port before powering on your machine.


0) you best have the flash drive formatted for the Mac. See disk utility. It's on the pull down.
1) You can copy files on the Unix command line interface if you placed the flash drive in a USB port before powering on your machine.
2) Boot in recovery mode

3) ...
4) After you specify the language you will come to the installation panel.
5) Do not install.
6) Go to the top of the screen and click on the tools menu item.
7) Click on Terminal to use the command line interface.
You should verify that the files have been copied correctly by trying them in another Mac before it the deleting the original.
Here is an overview of the commands. Lets assume that the problem account has a short user name of mac.
#Copy directory "/Applications/Applescript files" to
# directory "/Volumes/Spotless/Applescript files".
# "Spotless" is my flash drive.
ditto -X -rsrc /Applications/Applescript\ files /Volumes/Spotless/Applescript\ files
#cd is change directory
cd /Volumes/COPYIT/answers/
# pwd is print working directory
pwd
#the ls command is for list
# l is long
# a to show hidden files. not shown in this example.
# F is type of file where / is directory
sh-2.05b# # Please note ls is the list command. l is a lower case L
sh-2.05b# ls -lF
Here is what these commands mean:
cd is change directory
pwd is a print working directory
ls is list
sudo is Super user do
# The sudo command will ask for your administration password. No characters will appear when typing your password. Press return when done typing.
cp is copy
copy a file example:
sh-2.05b#
sh-2.05b# cd /Volumes/Macintosh-HD/Users/mac/desktop
sh-2.05b# pwd
/Volumes/Macintosh-HD/Users/mac/desktop
sh-2.05b# cp -i answers.txt /Volumes/SpotMore
Will copy the file answers.txt in the directory SpotMore.

  1. Some files have a space in the name. You need to escape. see example:
    mac $ ls -l ~/"see it"
    -rw-r--r-- 1 mac staff 3171 Oct 26 23:38 /Users/mac/see it
    mac $
    mac $ cd /Users/mac/Desktop/ttt\ html\ copy/
  2. Do you know about tabing? Type in a few letters of a name then press the tab key. The computer will type out the rest of the name if it is unique.
  3. The up arrow key will retrive the previous command. You the left arror and right arror keys to move around. Use the delete key to delete a character to the left.



*More examples and moving around*

sh-2.05b# pwd
/
sh-2.05b# ls /Volumes
.Trashes Classic Macintosh-HD
._.Trashes Mac OS X Install DVD SpotMore
sh-2.05b#
sh-2.05b# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/disk4s3 2.6G 2.5G 89M 97% /
devfs 121K 121K 0B 100% /dev
fdesc 1.0K 1.0K 0B 100% /dev
<volfs> 512K 512K 0B 100% /.vol
/dev/disk5 467K 9.0K 435K 2% /Volumes
/dev/disk6 95K 64K 27K 70% /private/var/tmp
/dev/disk7 95K 14K 77K 15% /private/var/run
/dev/disk3s1 3.7G 1.3G 2.5G 34% /Volumes/SpotMore
/dev/disk0s10 1.1G 1.1G 3.4M 100% /Volumes/Classic
/dev/disk0s12 70G 45G 25G 65% /Volumes/Macintosh-HD
sh-2.05b#
sh-2.05b# cd /Volumes/SpotMore/
sh-2.05b# pwd
/Volumes/SpotMore
sh-2.05b# # Please note ls is the list command. l is a lower case L
sh-2.05b# ls -l
total 880
-rw-r--r-- 1 unknown unknown 6148 Sep 10 2010 .DS_Store
drw------- 4 unknown unknown 136 Aug 25 2010 .Spotlight-V100
drwxrwxrwt 3 unknown unknown 102 Sep 3 2010 .TemporaryItems
d-wx-wx-wt 3 unknown unknown 102 Sep 10 2010 .Trashes
drwx------ 3 unknown unknown 102 Sep 3 2010 Desktop
-rw-r--r-- 1 unknown unknown 18944 Aug 27 2010 Desktop DB
-rw-r--r-- 1 unknown unknown 2 Jul 29 2010 Desktop DF
-rwxrwxrwx 1 unknown unknown 26281 Oct 27 2009 Warranty Information.PDF
drwxr-xr-x 13 unknown unknown 442 Aug 4 2010 backup
drwxr-xr-x 13 unknown unknown 442 Aug 4 2010 backupPrior
drwxr-xr-x 7 unknown unknown 238 Aug 27 2010 cons
drwxr-xr-x 65 unknown unknown 2210 Sep 4 2010 iMac-back
... clipped ...
sh-2.05b#
sh-2.05b# cd /Volumes/Macintosh-HD/Users/mac/desktop
sh-2.05b# pwd
/Volumes/Macintosh-HD/Users/mac/desktop
sh-2.05b# # Please note ls is the list command. l is a lower case L
sh-2.05b# ls
Z2300 iMac
.DS_Store move
.FBCIndex new Belward
.FBCLockFolder primary-comments-new copy.doc
Consolidate-rc primary-comments-new.doc
Downloads psc 1200
... clipped ...

sh-2.05b# ditto -X -rsrc iMac /Volumes/SpotMore/iMac-back
sh-2.05b#
sh-2.05b# # Please note ls is the list command. l is a lower case L
sh-2.05b# ls -h /Volumes/SpotMore/iMac-back/
total 2800
-rw-r--r-- 1 unknown unknown 24K Sep 12 2010 .DS_Store
-rw-r--r-- 1 unknown unknown 2K Apr 18 2010 Differentiate Between Models .html
... clipped ...

sh-2.05b# pwd
/Volumes/Macintosh-HD/Users/mac/desktop
sh-2.05b# ls
Z2300 iMac
.DS_Store move
.FBCIndex new Belward
.FBCLockFolder primary-comments-new copy.doc
... clipped ...

sh-2.05b#

Reply

Oct 5, 2017 9:25 AM in response to Tony T1

Hi TonyT1


Thank you for your swift response. I have given it a try. The Mac definitely recognises the USB drive as it is listed as disk2s1. When I type mkdir /Volumes/thumb

(I presume I'm supposed to replace where it says usb with the name of the volume, in this case thumb) it states "Read-only file system", how do I make it writable so I can then transfer the folder to it?


If I ignore the "Read-only file system" message and type the next command (

mount_hfs /dev/disk1s1 /Volumes/thumb) it states "No such file or directory". Would that indicate a problem?


Thank you again for your help.

Reply

Oct 5, 2017 9:53 AM in response to krude1

This does seem to be somewhat a catch 22 situation. You need a mounted read/write partition to mount a second partition as read/write.


Here is how to get your startup drive as read/write. These instructions should appear in the single user mode boot instrucitons:

# Type the follow two instructions to access the startup disk in read/write.


# check out the filesystem.

# ( in case of partial success repeat this command until errors go away. )

/sbin/fsck -fy


# Gain read / write access to your startup drive

/sbin/mount -uw /


Now, you need to create some directory on your startup drive.

You can use any directory.


cd /Volumes

pwd

ls

mkdir extflash


# mount external flash drive on extflash. I don't know the correct command syntax.


R

Reply

Oct 8, 2017 8:50 AM in response to rccharles

Hi rccharles,


Thank you very much for your assistance and taking the time to respond. Admittedly some of it does go over my head as I am completely new to commands but I have no choice but to learn in my predicament.


The destination USB thumb drive (it's called thumb) is already formatted as Mac Extended (Journaled) and there's just one partition on it. So I need ensure the USB thumb drive is plugged in before I turn on the computer and then open Terminal via internet recovery. From there, I just type:


ditto -X -rsrc /SSD/users/rastefatah/Desktop/Outlook Festival 2017 RAW files/* /Volumes/thumb


Will typing the above straight into terminal copy everything in the source folder (/SSD/users/rastefatah/Desktop/Outlook Festival 2017 RAW files) into my USB stick which is called 'thumb'? I don't understand what the bit means but I presume it's needed.


Is there anything else I need to type into terminal before the above command? Do I need to type in the what the Mac itself recognises the thumb drive (disk2s1) and internal SSD (disk0) as? Are the slashes the right way (back slash or forward slash)?


Thank you again for your help.


Raste

Reply

Oct 8, 2017 9:31 AM in response to krude1

If I go to Disk Utility via Internet Recovery and click open new image from folder it allows me to browse the files but won't allow me to do anything with them. Can I create a .dmg image file out of that folder and access the files later that way?


The folder is definitely located at /SSD/users/rastefatah/Desktop/Outlook Festival 2017 RAW files and the source is definitely called thumb. SSD is the main internal drive which most people have as Macintosh HD by default.


Raste.

Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Need urgent help copying folder from desktop to USB drive in Single User Mode

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