1

Whenever I try to copy all the content of a usb to my Mac partition it says Permission Denied

The command I am using is

cp -R /dev/disk1 /dev/disk0s3

My error message is:

/dev/disk0s3: permission denied.

I have tried to set myself to super and still didn't work, as well I have all write/read permissions on the hard drive.

Is there a way I can buffer the copy by coping all the files to a folder then partition. I need all the contents of the usb to be copied and I believe there are hidden files and partitions on the usb that need to be copied. (is it a recovery usb I want to put on the recovery partition i created and no i cannot just create one, this recovery contents important files of mine)

3
  • Why are you using the raw device names - cp works off the mounted disc system
    – mmmmmm
    Commented Jun 6, 2014 at 22:54
  • @Mark because I would like to copy everything off of the usb stick and not just the files show in finder
    – Rguarascia
    Commented Jun 6, 2014 at 22:58
  • cp will copy all files if used on the filesystem
    – mmmmmm
    Commented Jun 7, 2014 at 8:13

2 Answers 2

3

You can't use filesystem commands (cp, mv, ls, etc.) on devices (/dev/*).

If you want to copy everything, bit-for-bit, from volume to volume, you'll need an app like Super Duper or Carbon Copy Cloner.

1

If you want to copy all files including hidden files that will not show up in the Finder use

cp -r /Volumes/foo bar

Of course you can replace bar with /Volumes/bar to copy from one disk to another. You may run into problems fixier destination filesystem is not capable of everything used in the source. (For example when copying from HFSX to (j)HFS+ or from HFS+ to FAT32.)

In case you really need to image the full device use

dd if=/dev/disk1 of=destination.img

Replace the /dev/disk1 with the actual device you want to copy from. Replace destination.img with a filename and path of choice or with another real device. You likely will need to do this as root so double check if your source and especially destination are correct to prevent overwriting the wrong disk.

Other commands that may come in handy for this include rsync(1) and ditto(1).

1
  • I get permission denied using cp -r /Volumes/foo bar (Of course with my actual folders names).
    – Royi
    Commented May 1, 2019 at 16:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .