Simple howto burn and rip cd's

Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated.

Simple howto burn and rip cd's

Postby graudeejs » 29 Dec 2008, 19:27

To create iso
Code: Select all
$ mkisofs -o /path/to/output.iso -R -J /path/to/files/you/want/on/cd


to burn cd-r/cd-rw
Code: Select all
$ burncd data /path/to/output.iso fixate


To burn files/directory, to cd without making iso file (thanks to Vermaden @ daemonforums.org)
Code: Select all
$ mkisofs -J -R /path/to/some/file/or/dir | burncd data - fixate


to burn compressed cd:
Code: Select all
$ gunzip -c file.iso.gz | burncd data - fixate


to blank cd-rw
Code: Select all
$ burncd blank


to get cd/dvd image (to get iso from disk)
Code: Select all
$ dd if=/dev/acd0 of=/path/to/disk.iso bs=2048


to burn dvd iso to disk with burncd
Code: Select all
$ burncd dvdrw /paht/to/image.iso


to burn dvd iso to disk with growisofs
Code: Select all
$ growisofs -dvd-compat -Z /dev/cd0=/path/to/image.iso


to burn files to dvd without creating iso
Code: Select all
$ growisofs -Z /dev/cd0 -R -J /some/files


above 2 commands will overwrite content on dvd+-rw disk
no need to blank (so it seams. i tested on my pc)


to append to dvd (must use same options as when creating this dvd)
Code: Select all
$ growisofs -M /dev/cd0 -R -J /some/more/files


to finalize dvd (slow) (you need this after appending to dvd, to maintain maximal compatibility, it's not 100% necessary)
Code: Select all
$ growisofs -M /dev/cd0=/dev/zero


to format dvd-rw with burncd (slow!)
Code: Select all
$ burncd format dvd-rw


to format dvd+rw with burncd (slow!)
Code: Select all
$ burncd format dvd+rw


To blank dvd-rw (very slow!) (thanks to Vermaden @ daemonforums.org)
Code: Select all
$ growisofs -Z "/dev/cd0=/dev/zero"


to blank dvd+rw (slow)
Code: Select all
dvd+rw-format /dev/cd0


to burn audio cd from wav files
Code: Select all
$ burncd audio file1.wav file2.wav file3.wav fixate


here's simple script that uses mplayer and burncd to burn audio cd's from directory with music files (basically any file that mplayer can play)
Code: Select all
#!/bin/sh
for i in `ls`; do
  rm -f /tmp/cd_track.wav
  mplayer -vo null -vc dummy -af resample=44100 -ao pcm:file=/tmp/cd_track.wav $i
  burncd audio /tmp/cd_track.wav
done
rm -f /tmp/cd_track.wav
burncd audio fixate
exit 0


and here's another simple script to rip audio cd's to mp3
Code: Select all
#!/bin/sh
mkdir /tmp/cd
cd /tmp/cd
cdparanoia -B -d /dev/acd0
for i in `ls *.wav`; do
  lame -m s "$i" -o "$(echo $i | awk '{print substr($0,6,2)}' -).mp3"
  rm -f "$i"
done
echo 'files are in /tmp/cd'
exit 0


you can rip 1 audio track to wav with
Code: Select all
$ cdparanoia -B -d /dev/acd0 1

in this example it'll rip track 1 only
and convert it to mp3 with
Code: Select all
lame -m s audio.wav -o audio.mp3



to attach and mount iso image
Code: Select all
$ mdconfig -a -t vnode -u 0 -f /path/to/image.iso
$ mount -t cd9600 /dev/md0 /mnt



to umount and detach iso image
Code: Select all
$ umount /mnt
$ mdconfig -du 0



To make it all happen you need:

in kernel
Code: Select all
options    CD9660         # ISO 9660 Filesystem, because you want to read them ;)
device      atapicd      # ATAPI CDROM drives
device      atapicam
device      cd            # nessacery for dvd's
device       pass
device       scbus
options      MD_ROOT
device      md
options         UDF


and permission to write to /dev/acd0 /dev/cd0 /dev/pass1

note: The pass device number will also depend on the order that SCSI devices are enumerated by the kernel. To determine exactly which one it is, one can use camcontrol devlist as root [thanks to phoenix @ daemonforums.org]

note, you can't run growisofs using su, you need to do that as user....

here's some part of my /etc/devfs.conf
Code: Select all
own     acd0    root:users
perm    acd0    0660

own     cd0     root:users
perm    cd0     0660

own     pass1   root:users
perm    pass1   0660

own     pass0   root:users
perm    pass0   0660


Here's list of utils you can install to convert from different formats to iso files:
[port]sysutils/iat[/port] - converts BIN, MDF, PDI, CDI, NRG, and B5I to ISO
[port]sysutils/nrg2iso[/port] - Convert Nero .nrg CD-Image format to ISO
[port]sysutils/ccd2iso[/port] - A CloneCD to ISO converter
[port]sysutils/daa2iso[/port] - Convert PowerISO DAA files to ISO9660
[port]sysutils/mdf2iso[/port] - A Alcohol 120% to ISO converter
[port]sysutils/nrg2iso[/port] - Convert Nero .nrg CD-Image format to ISO
[port]sysutils/uif2iso[/port] - Convert MagicISO UIF files to ISO9660
[port]sysutils/bchunk[/port] - Converts .bin/.cue files to .iso/audio

note: if you have more than one drive, you need to specify which one to use with burncd as well
use -f flag for this
Code: Select all
burncd -f /dev/acd1 data /path/to/image.iso fixate


to use mkisofs you need to install [port]sysutils/cdrtools[/port]
to use growisofs you need to install [port]sysutils/dvd+rw-tools[/port]

to use cdparanoia you need to install [port]audio/cdparanoia[/port]
to use lame you need to install [port]audio/lame[/port]
to use mplayer you need to install [port]multimedia/mplayer[/port]



resources:
[man=8]burncd[/man]
[pman=8]mkisofs[/pman]
[pman=1]growisofs[/pman]

[pman=1]mplayer[/pman]
[pman=1]cdparanoia[/pman]

[man=8]mdconfig[/man]

lame(1) , hmm why this is not available in freebsd online manual pages?


[color="Red"][SIZE="5"]UPDATE[/SIZE][/color]
To avoid allowing rw access to all pass* devices (thanks to mart), you can do fallowing:
Code: Select all
$ dmesg | grep -i cd0.*target
cd0 at [color="Red"]ata1[/color] bus 0 target 0 lun 0
$ echo 'hint.scbus.0.at="[color="Red"]ata1[/color]"' >> /boot/device.hint

This will make sure that your burner on ata1 (in this case) will be assigned to pass0 always, as long as it's on ata1
now all you have to do is allow only
Code: Select all
own     pass0   root:users
perm    pass0   0660

in [file]/etc/devfs.conf[/file]
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby SirDice » 29 Dec 2008, 20:31

Errmm.. burncd uses the ATAPI (IDE) interface..
So stricly speaking you don't need atapicam and all for that.

atapicam is needed for cdrecord (SCSI) and similar burn programs (nautilus i.e.).
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby Pushrod » 29 Dec 2008, 20:35

You can also do:

mkisofs -o /dev/stdout -R -J /path/to/files/you/want/on/cd | burncd data /dev/stdin fixate
User avatar
Pushrod
Member
 
Posts: 277
Joined: 07 Dec 2008, 07:40

Postby graudeejs » 31 Dec 2008, 09:48

SirDice wrote:Errmm.. burncd uses the ATAPI (IDE) interface..
So stricly speaking you don't need atapicam and all for that.

atapicam is needed for cdrecord (SCSI) and similar burn programs (nautilus i.e.).


you need atapicam to use growisofs
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby mart » 31 Dec 2008, 15:46

killasmurf86 wrote:To make it all happen you need:

in kernel
Code: Select all
options    CD9660         # ISO 9660 Filesystem, because you want to read them ;)
device      atapicd      # ATAPI CDROM drives
device      atapicam
device      cd            # nessacery for dvd's
device       pass
device       scbus
options      MD_ROOT
device      md
options         UDF


and permission to write to /dev/acd0 /dev/cd0 /dev/pass1

note: The pass device number will also depend on the order that SCSI devices are enumerated by the kernel. To determine exactly which one it is, one can use camcontrol devlist as root [color="RoyalBlue"][thanks to phoenix from daemonforums.org][/color]

note, you can't run growisofs using su, you need to do that as user....

here's some part of my /etc/devfs.conf
Code: Select all
own     acd0    root:users
perm    acd0    0660

own     cd0     root:users
perm    cd0     0660

own     pass1   root:users
perm    pass1   0660

own     pass0   root:users
perm    pass0   0660



Some additions from my own experiences trying to figure this out a few days ago...

1. Recompiling kernels is not required. atapicam can be started via /boot/loader.conf as described in the handbook. It's a personal choice, but avoiding custom kernels makes security updates easier.

2. If you're using a burner connected by USB, then refer to handbook as the setup is much different to the one described here.

3. Device numbers changing. This is a PITA. The enumeration on my machine means that my DVD burner (on IDE via atapicam) is enumerated after my usb drives. This means my DVDs passthrough device (passN) will change, frequently, depending on if I have a USB key inserted or not. I can pass 'pass*' to devfs.conf (or devfs.rules), but that opens up all passthrough devices, hardly ideal. Anyone know of a consistent, secure, way to handle this (fixed to something like a UID, perhaps)?

4. DMA Errors. I can get DVD-R, DVD+RW and DVD+DL disc to burn beautifully with growisofs, but dmesg shows a ton of ata and dma related errors. The errors occur on initializing the device, and when discs are inserted. I'm not at my FreeBSD machine right now, but they appeared related to enabling ata/atapi dma as described in the handbook. I haven't found a solution to these errors yet, but I see similar reports on freebsd mailing lists going back to ~2004. It's possible the errors are unimportant, but I'm wondering if they're also interfering with automounting via hal/thunar-vol-man (which seems broken for me) and/or xfburn (which seems to have issues recognizing and registering DVD media).
mart
Junior Member
 
Posts: 48
Joined: 03 Dec 2008, 11:34

Postby graudeejs » 31 Dec 2008, 16:19

I use custom kernel and no problems updating to latest security fix...
Well i prefer recompiling everything from sources... haven't tried binary update
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby mart » 31 Dec 2008, 23:36

killasmurf86 wrote:I use custom kernel and no problems updating to latest security fix...


I didn't say there would be problems, just that it's easier and probably something best avoided unless you really need to. I'm a firefighter, and have never had a problem with burning buildings, but it doesn't mean I recommend running into them unless it's really necessary (:)).

BTW: Some more useful information, in addition to what's already included in the handbook, can be found here: /usr/ports/sysutils/k3b/pkg-message

Now, if someone could post additional info on how to do all this securely, in a consistent manner that survives device reordering, and without all the ata/dma issues, and throw in how to do automounting correctly in xfce I'd be very thankful (hint, hint)...
mart
Junior Member
 
Posts: 48
Joined: 03 Dec 2008, 11:34

Postby mart » 02 Jan 2009, 02:20

mart wrote:Device numbers changing. This is a PITA. The enumeration on my machine means that my DVD burner (on IDE via atapicam) is enumerated after my usb drives. This means my DVDs passthrough device (passN) will change, frequently, depending on if I have a USB key inserted or not. I can pass 'pass*' to devfs.conf (or devfs.rules), but that opens up all passthrough devices, hardly ideal. Anyone know of a consistent, secure, way to handle this (fixed to something like a UID, perhaps)?


Partly solved: I've figured out how to avoid device reordering, which means I can impose more restrictive devfs.conf rules (i.e. permit access to only this specific device, rather than all passthrough devices). It also means I can separate usb thumb drive and dvd burner permissions easily, and it makes scripts a whole lot simpler to write... :)

NOTE: I couldn't find much documentation, so there may be more to this than I've done so far, but the following works great for me...

Code: Select all
1. Discover where your drive is located (in my case cd0)

   [mart@bsddesktop /usr/home/mart]$ dmesg | grep -i cd0.*target
   cd0 at ata3 bus 0 target 0 lun 0

2. Add a device hint to /boot/device.hints (here's mine for reference)

   [mart@bsddesktop /usr/home/mart]$ tail -4 /boot/device.hints
   # mart:  lock dvdburner (on ata3) to scsi 0
   hint.scbus.0.at="ata3"

3. Tighten up your devfs rules i.e. ensure they're locked to the
   [I]specific[/I] passthrough device [I]only[/I], and to the [I]specific[/I] group [I]only[/I].

4. Reboot

5. Verify its now fixed to scbusN / passN (in my case N=0)

   [mart@bsddesktop /usr/home/mart]$ camcontrol devlist
   <BENQ DVD DD DW1620 B7W9>          at scbus0 target 0 lun 0 (cd0,pass0)
   <USB2.0 CardReader CF RW 0.0>>     at scbus1 target 0 lun 0 (pass1,da0)
   <USB2.0 CardReader Combo 0.0>>     at scbus1 target 0 lun 1 (pass2,da1)

Obviously, use your own info, not mine. Repeat for other devices if necessary.

I still get the

Code: Select all
    acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00

and
Code: Select all
    acd0: FAILURE - READ_BIG timed out

errors. And I still can't get !@$%^$#&* automount functioning properly with xfce... can anyone?
mart
Junior Member
 
Posts: 48
Joined: 03 Dec 2008, 11:34

Postby pablo » 03 Jan 2009, 20:11

Sorry if it's not appropriate topic for mu question, but
is there a way to burn/mount under FreeBSD CD-images produced by ALCOHOL120% (some *.mds & *.mdf files)?
pablo
Junior Member
 
Posts: 33
Joined: 18 Nov 2008, 03:52
Location: /home/pablo

Postby graudeejs » 03 Jan 2009, 20:36

install sysutils/mdf2iso from ports
convert cd/dvd image to iso and burn/mount as described in this howto.

but i don't know if there will be any header data lost [you know stuff that is necessary to run legal games], however data on disk will be accessible

you could try and report


Here's list of utils to convert different formats to iso:
[port]sysutils/nrg2iso[/port]
[port]sysutils/ccd2iso[/port]
[port]sysutils/daa2iso[/port]
[port]sysutils/mdf2iso[/port]
[port]sysutils/nrg2iso[/port]
[port]sysutils/uif2iso[/port]
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby graudeejs » 06 Jan 2009, 21:34

Pushrod wrote:You can also do:

mkisofs -o /dev/stdout -R -J /path/to/files/you/want/on/cd | burncd data /dev/stdin fixate


it doesn't work on my PC ;(

I removed this from howto for time being
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby trybeingarun » 27 Dec 2009, 14:55

Thanks killasmurf86!
I dint know this many options existed for one task.

I was struggling with k3b for a while before posting my question. Unfortunately I still don't know why k3b dint work(it failed even to start). One of the blogs suggested to create a link /dev/cd0 for /dev/acd0 even after which k3b failed to load. Anybody has any idea how to get it to work?
trybeingarun
Junior Member
 
Posts: 79
Joined: 23 Dec 2009, 04:30

Postby graudeejs » 27 Dec 2009, 15:21

you probably need to
Code: Select all
# kldload atapicam
# kldload cd
# kldload pass


and set permissions so you, as user, have rw access to [file]/dev/cdX[/file] and [file]/dev/passY[/file]

replace X and Y with correct device number
after this you should be able to burn cd/dvd with k3b untill you restart...

to make this permanent read my 1st post at end.... at end there are some tips. I don't say anything about k3b, but if you apply everything mentioned to your system, k3b will work {should}


also you should read comments
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby cpcnw » 27 Feb 2010, 23:49

If you just want a 'backup copy' of your valuable dvd originals there is a port in multimedia called lxdvdrip which is quite useful.

My own attempts at writing dvd's from CLI resulted in a few coasters so I checked out the above. Following the ripping process I noticed that the cli used for growisofs was as follows ;

Code: Select all
growisofs -speed=10 -dvd-compat -use-the-force-luke=dao -Z /dev/cd1 -V DVD_TITLE -dvd-video /tmp/DVD_TITLE
User avatar
cpcnw
Junior Member
 
Posts: 78
Joined: 17 Nov 2008, 07:33

Postby cpcnw » 04 Mar 2010, 23:15

Here's a hands free [almost] script for copying audio CD's ~ resulting CD's are correctly identified by CDDB

Code: Select all
#!/bin/sh
echo "Insert audio CD in acd0 and press enter..."
read p
for i in /dev/acd0t*
do
trackno=`echo $i | cut -d"t" -f2`
dd if=$i of=track${trackno}.cdr bs=2352
done
cdcontrol -f acd0 eject
echo "Insert blank CDR and press enter ..."
read p
burncd -f /dev/acd0 audio *cdr fixate
cdcontrol -f acd0 eject
echo "Hit enter to remove temps or Ctrl-C to keep!"
read p
rm track*.cdr
echo "All Done!"


Special thanks to Steve Parker for giving me a hand with this!
User avatar
cpcnw
Junior Member
 
Posts: 78
Joined: 17 Nov 2008, 07:33

Postby phoenix » 04 Mar 2010, 23:24

"bs=2352" Audio CDs use a different sector size than data CDs? Data CDs use 2048 B.
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
User avatar
phoenix
MFC'd
 
Posts: 3349
Joined: 17 Nov 2008, 05:43
Location: Kamloops, BC, Canada

Postby cpcnw » 05 Mar 2010, 07:56

http://www.freebsd.org/doc/handbook/creating-cds.html

Just taking advice of handbook? Maybe I should cross reference ...
User avatar
cpcnw
Junior Member
 
Posts: 78
Joined: 17 Nov 2008, 07:33

Postby ckester » 07 Jan 2011, 19:41

Most of the examples I've seen for how to use mkisofs assume that what you want to burn to the CD/DVD is everything in and under one or more directories.

But what if I only want to burn *some* of the files in those directories? For example, if I'm doing an incremental backup and only want the files that have recently changed. What techniques do people use in cases like that?

I've considered recreating the directory tree(s) under a backuproot directory, hardlinking the changed files into there, and then giving the backuproot directory as the /path/to/files argument to mkisofs. But I'm wondering if there's a simpler way?

(I tried giving mkisofs the names of the specific files to use, but this flattens the entire hierarchy and leads to naming conflicts.)

Second question: how do you deal with the case where the size of the resulting ISO is bigger than will fit on a DVD?
User avatar
ckester
Member
 
Posts: 288
Joined: 30 Nov 2008, 01:18
Location: near Seattle, WA (USA)

Postby bes » 08 Jan 2011, 14:20

For backup purposes you can also choose to burn a file directly to CD, without creating an ISO 9660 file system(see Handbook 18.6.8 Burning Raw Data CDs),and it is possible to split the big archive into pieces.
For exmaple file archive.tar.gz with size 2G:
Code: Select all
split -b 680m archive.tar.gz [PREFIX]
ls
archive.tar.gz [PREFIX]aa [PREFIX]ab [PREFIX]ac

then burn all pieces [PREFIX]*,respectively one for disk:
Code: Select all
burncd -f /dev/acd0 -s max data [PREFIX]?? fixate

Now we have backups on 3 CD's.

Recovery:
Copy all CD's from the raw device node to files on hard and concatenate them:
Code: Select all
cp /dev/acd0 path2/file
cat file1 ... file > archive.tar.gz
bes
Junior Member
 
Posts: 95
Joined: 07 Aug 2010, 16:45


Return to Howtos & FAQs (Moderated)

Who is online

Users browsing this forum: No registered users and 1 guest