LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to copy directory tree to cd rom using command line? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-copy-directory-tree-to-cd-rom-using-command-line-4175453929/)

keithostertag 03-13-2013 12:09 PM

How to copy directory tree to cd rom using command line?
 
I want to copy an entire directory tree (text files an pdf's) from my laptop harddrive to a cdrom. I want to be able to use the resulting disc on either Linux or Windows machines.

I don't want to use tar, or any backup software which creates a single image of all the files.

Do I need to first use something like mkisofs, then cdrecord? Or can I just use wodim?

I tried using wodim without success, I guess I'm confused about the details...

My cdrom is located at /dev/sg1

I'm using Debian.

Thanks,
Keith

business_kid 03-13-2013 12:25 PM

If it fits on a cd, use growisofs. The man page has examples.

To check if it fits, use
Quote:

du -sh /path/to/files

ali.abry 03-13-2013 12:48 PM

you can use mkisofs and then use cdrecord to write a cd you can also use growisofs in this form :
by using grow isofs you dont need to make iso befor writing to cd.
Code:

# growisofs -speed=4 -z /dev/cdrom -J -r -v "cdname" ./

keithostertag 03-13-2013 01:11 PM

Thanks guys. The growisofs man page is pretty terse.

I tried:

growisofs -speed=4 -Z /dev/sg1 -R -J -v -dry-run ./*

and that seemed to be OK, but when I ran it without the -dry-run it gives me this error:

Code:

:-( write failed: Illegal seek
The trailing * doesn't affect it either way, and I also tried it with sudo with no change.

Ideas?

wodim reports:
Code:

$ wodim --devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/sg1'        rwrw-- : 'Optiarc' 'DVD RW AD-7710H'
-------------------------------------------------------------------------

Thanks,
keith

keithostertag 03-13-2013 02:45 PM

BTW- when I tried to apt-get mkisofs I get this message:

Code:

Package mkisofs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  genisoimage:i386 genisoimage

genisoimage is part of the wodim package. I'm running Debian.

I guess I need a basic _recent_ tutorial on how to do this. All the web pages I have read confuse me with discussion of iso files, images, DVD's, past versions of software, etc.

Keith

jpollard 03-13-2013 04:00 PM

Growisofs isn't exactly to be used against a CD-ROM. It might work if the CD format is not "finished" (an end marker record is written). You can't overwrite a CD that way very well.

Usually I've seen it used against an ISO file on disk (thus modifiable), but not on a CD. Once the ISO file is updated, a CD might be written (or overwritten if CD-R+).

Part of the problem with unfinished CD recordings is that some systems will claim an I/O error, and not process the CD at all. The problem with finished CDs is that they are marked complete, and can't be extended...

Nbiser 03-13-2013 05:05 PM

Are you tring to use the tree command and then send the output to your CD drive? If so, do this:

Code:

tree > nano
this will send the output of tree to nano, where it will be saved as a text file, from there you can send it to your cd.

chrism01 03-13-2013 11:36 PM

If you've got a GUI on there, I've used k3b to burn stuff successfully.
Might be in your repos (it is in Centos) or see http://www.k3b.org/

keithostertag 03-14-2013 09:02 AM

Thanks for all your responses guys.

I didn't want to load a gui, I do this so seldom. I only had 155M of data I wanted to copy to cd. There are lots of examples to copy to DVD, but not to cdrom.

For me, who doesn't do this very often, the documentation is confusing. I looked through the man pages for burn, wodim, mkisofs, genisoimage, etc. Most of the docs discuss audio and creating iso images, and mostly in reference to DVD's. The terminology is confusing to someone who doesn't do this a lot or in depth.

I wound up doing this:

Code:

sudo genisoimage -R /home/keith/datadirectory/ | wodim -v fs=6m speed=2 dev=/dev/sg1 -
taken from the wodim man page.

I may actually have tried something similar before, but aborted when I saw the process saying
Code:

Starting new track at sector: 0
Track 01:    3 MB written (fifo 100%) [buf 100%]  8.5x.  6.45% done, estimate finish Thu Mar 14 09:45:37 2013
Track 01:  13 MB written (fifo 100%) [buf 100%]  8.4x. 12.87% done, estimate finish Thu Mar 14 09:44:43 2013
Track 01:  23 MB written <snip>

because I thought it was attempting to write audio! Of course, I was wrong.

It's actually much more straight-forward writing audio cd's! At least the docs and examples for that are thorough and detailed!

Keith Ostertag

business_kid 03-14-2013 10:44 AM

wodim = cdrecord? This process works for me

mkisofs -o filename.iso /some/files
cdrecord -scanbus

Note the device numbers. They mean crazy things to a strange man but you don't have to worry about that. Let's say, for example, your cd is on 1,0,0

cdrecord dev=1,0,0 speed=4 -eject filename.iso

I always limit speed to limit errors as faster writing causes more errors. Take it from someone who has run BLER (Block Error) tests on real cds and cdrs. The eject spits it out when you're finished. If you want a dry run, there's an option for that also.

keithostertag 03-14-2013 11:35 AM

Thanks. Even though I didn't use your choice of apps, I learned something from your post :-)

Here's part of what was tripping me up. I had thought that if I created an iso or raw file out of a bunch of files in a directory, that it creates one big file (it does). And that I'd wind up with one iso file on the cdrom, not a directory tree of files where I could, say, read or copy just one of them (later from the created cdrom).

Now that I've tried it I see I was mistaken.

Here's what I did (after changing to the directory I wanted to copy):

Code:

$ genisoimage -R -o cdimage.raw ./
followed by:

Code:

$ wodim -v speed=2 dev=1,0,0 cdimage.raw

It didn't actually like using dev=1,0,0 and gave a warning, but worked. I now guess I should just use 1,0 or /dev/sg1.

Finished, then mounted the cdrom, I feared I would see one big file on the cdrom- cdimage.raw. But instead I get the directory tree of files that I wanted to copy. I didn't realized it worked that way. Shazzam!

So again, thanks!

Keith

business_kid 03-14-2013 02:21 PM

The original guy who wrote that uses Solaris and [B]hates[B] glibc. Everybody who comes along after returns to convention "This is dvdrtools, not dvdlibc." "Returned the source to standard build procedure." are typical comments in READMEs.

It references /dev/pg* and /dev/sg* but often they're not made :-/.


All times are GMT -5. The time now is 12:07 AM.