LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-13-2013, 12:09 PM   #1
keithostertag
Member
 
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 92

Rep: Reputation: Disabled
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
 
Old 03-13-2013, 12:25 PM   #2
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,167

Rep: Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526
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
 
Old 03-13-2013, 12:48 PM   #3
ali.abry
Member
 
Registered: Feb 2013
Posts: 61

Rep: Reputation: Disabled
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" ./
 
Old 03-13-2013, 01:11 PM   #4
keithostertag
Member
 
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 92

Original Poster
Rep: Reputation: Disabled
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
 
Old 03-13-2013, 02:45 PM   #5
keithostertag
Member
 
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 92

Original Poster
Rep: Reputation: Disabled
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

Last edited by keithostertag; 03-13-2013 at 02:56 PM.
 
Old 03-13-2013, 04:00 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,007

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
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...
 
Old 03-13-2013, 05:05 PM   #7
Nbiser
Member
 
Registered: Oct 2012
Location: Maryland
Distribution: Fedora, Slackware, Debian, Ubuntu, Knoppix, Helix,
Posts: 279
Blog Entries: 7

Rep: Reputation: 41
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.

Last edited by Nbiser; 03-13-2013 at 05:11 PM.
 
Old 03-13-2013, 11:36 PM   #8
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,226

Rep: Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022
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/
 
Old 03-14-2013, 09:02 AM   #9
keithostertag
Member
 
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 92

Original Poster
Rep: Reputation: Disabled
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
 
Old 03-14-2013, 10:44 AM   #10
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,167

Rep: Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526
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.
 
Old 03-14-2013, 11:35 AM   #11
keithostertag
Member
 
Registered: Jul 2011
Location: Harrisburg, PA
Posts: 92

Original Poster
Rep: Reputation: Disabled
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
 
Old 03-14-2013, 02:21 PM   #12
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,167

Rep: Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526Reputation: 526
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 :-/.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
command tofind files by extension through a directory tree, and copy them all to the budword Linux - Newbie 2 06-27-2009 12:48 PM
How to copy files from an entire directory tree using terminal commands??? lusius188 Linux - General 3 04-10-2006 11:23 AM
locate and copy files - without directory tree rodda Linux - General 1 01-16-2005 02:10 AM
how do I copy a whoel folder form one directory to another form the command line? zwyrbla Linux - Newbie 8 08-24-2004 06:40 PM
How to copy a directory tree without copying the files in it? system Linux - General 2 01-15-2002 09:36 PM


All times are GMT -5. The time now is 10:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration