I am trying to preform this command to tar /opt and move it to my usb with directory:


However I am getting an error

here is the command I am preforming:

tar czf /opt/opt.tar.gz /media/usb-sdb1-1-7-1/

here is the error

tar: Removing leading `/' from member names tar: /opt/opt.tar.gz:

Cannot open: Read-only file system tar: Error is not recoverable:

exiting now

I even tried with sudo but I got this error

sh: sudo: command not found
  • Are you trying to extract to archive? – UTF-8 Oct 7 '15 at 14:24

If you want to archive the /opt directory recursively and save that tar archive to your external USB-harddrive mounted on /media/usb-sdb1-1-7-1, use this:

tar -czvf /media/usb-sdb1-1-7-1/opt.tar.gz /opt/

Use tar -xzvf file.tar.gz "/media/usb-sdb1-1-7-1/" to extract the archive.

  • Whatever the OP wants, now he has both answers... =) – chaos Oct 7 '15 at 14:27
  • @chaos Oops, I think yours is what he wants. He writes about it in the first line but it get unclearer in the remainder of his question. – UTF-8 Oct 7 '15 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.