2437f Simple howto burn and rip cd's - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Miscellaneous > Howtos & FAQs (Moderated)

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

Reply
 
Thread Tools Display Modes
  #1  
Old December 29th, 2008, 20:27
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Post Simple howto burn and rip cd's

To create iso
Code:
$ mkisofs -o /path/to/output.iso -R -J /path/to/files/you/want/on/cd
to burn cd-r/cd-rw
Code:
$ burncd data /path/to/output.iso fixate
To burn files/directory, to cd without making iso file (thanks to Vermaden @ daemonforums.org)
Code:
$ mkisofs -J -R /path/to/some/file/or/dir | burncd data - fixate
to burn compressed cd:
Code:
$ gunzip -c file.iso.gz | burncd data - fixate
to blank cd-rw
Code:
$ burncd blank
to get cd/dvd image (to get iso from disk)
Code:
$ dd if=/dev/acd0 of=/path/to/disk.iso bs=2048
to burn dvd iso to disk with burncd
Code:
$ burncd dvdrw /paht/to/image.iso
to burn dvd iso to disk with growisofs
Code:
$ growisofs -dvd-compat -Z /dev/cd0=/path/to/image.iso
to burn files to dvd without creating iso
Code:
$ 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:
$ 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:
$ growisofs -M /dev/cd0=/dev/zero
to format dvd-rw with burncd (slow!)
Code:
$ burncd format dvd-rw
to format dvd+rw with burncd (slow!)
Code:
$ burncd format dvd+rw
To blank dvd-rw (very slow!) (thanks to Vermaden @ daemonforums.org)
Code:
$ growisofs -Z "/dev/cd0=/dev/zero"
to blank dvd+rw (slow)
Code:
dvd+rw-format /dev/cd0
to burn audio cd from wav files
Code:
$ 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:
#!/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:
#!/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:
$ cdparanoia -B -d /dev/acd0 1
in this example it'll rip track 1 only
and convert it to mp3 with
Code:
lame -m s audio.wav -o audio.mp3

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

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

To make it all happen you need:

in kernel
Code:
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:
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:
sysutils/iat - converts BIN, MDF, PDI, CDI, NRG, and B5I to ISO
sysutils/nrg2iso - Convert Nero .nrg CD-Image format to ISO
sysutils/ccd2iso - A CloneCD to ISO converter
sysutils/daa2iso - Convert PowerISO DAA files to ISO9660
sysutils/mdf2iso - A Alcohol 120% to ISO converter
sysutils/nrg2iso - Convert Nero .nrg CD-Image format to ISO
sysutils/uif2iso - Convert MagicISO UIF files to ISO9660
sysutils/bchunk - 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:
burncd -f /dev/acd1 data /path/to/image.iso fixate
to use mkisofs you need to install sysutils/cdrtools
to use growisofs you need to install sysutils/dvd+rw-tools

to use cdparanoia you need to install audio/cdparanoia
to use lame you need to install audio/lame
to use mplayer you need to install multimedia/mplayer



resources:
burncd(8)
mkisofs(8)
growisofs(1)

mplayer(1)
cdparanoia(1)

mdconfig(8)

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


UPDATE
To avoid allowing rw access to all pass* devices (thanks to mart), you can do fallowing:
Code:
$ dmesg | grep -i cd0.*target
cd0 at ata1 bus 0 target 0 lun 0
$ echo 'hint.scbus.0.at="ata1"' >> /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:
own     pass0   root:users
perm    pass0   0660
in /etc/devfs.conf

Last edited by graudeejs; December 27th, 2009 at 16:01. Reason: update
Reply With Quote
The Following 20 Users Say Thank You to graudeejs For This Useful Post:
AlexN (December 27th, 2011), bebuxe (January 26th, 2011), biniar (April 27th, 2011), ctg (December 30th, 2008), ericturgeon (November 15th, 2009), fender0107401 (April 5th, 2009), fredg (January 1st, 2009), gx (December 30th, 2008), hedgehog (December 28th, 2009), mfaridi (December 30th, 2008), nakal (January 7th, 2009), nemysis (February 23rd, 2012), noz (October 26th, 2010), rbauer_snow (November 18th, 2011), Sinister (January 19th, 2009), sk8harddiefast (July 15th, 2010), teckk (January 21st, 2011), trybeingarun (December 27th, 2009), xserg86 (January 7th, 2009), YZMSQ (February 25th, 2011)
  #2  
Old December 29th, 2008, 21:31
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,702
Thanks: 47
Thanked 2,022 Times in 1,861 Posts
Default

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.).
Reply With Quote
  #3  
Old December 29th, 2008, 21:35
Pushrod's Avatar
Pushrod Pushrod is offline
Member
 
Join Date: Dec 2008
Posts: 257
Thanks: 5
Thanked 19 Times in 16 Posts
Default

You can also do:

mkisofs -o /dev/stdout -R -J /path/to/files/you/want/on/cd | burncd data /dev/stdin fixate
Reply With Quote
  #4  
Old December 31st, 2008, 10:48
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

Quote:
Originally Posted by SirDice View Post
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
Reply With Quote
  #5  
Old December 31st, 2008, 16:46
mart mart is offline
Junior Member
 
Join Date: Dec 2008
Posts: 48
Thanks: 6
Thanked 17 Times in 4 Posts
Default

Quote:
Originally Posted by killasmurf86 View Post
To make it all happen you need:

in kernel
Code:
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 from 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:
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).
Reply With Quote
  #6  
Old December 31st, 2008, 17:19
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

I use custom kernel and no problems updating to latest security fix...
Well i prefer recompiling everything from sources... haven't tried binary update
Reply With Quote
  #7  
Old January 1st, 2009, 00:36
mart mart is offline
Junior Member
 
Join Date: Dec 2008
Posts: 48
Thanks: 6
Thanked 17 Times in 4 Posts
Default

Quote:
Originally Posted by killasmurf86 View Post
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)...
Reply With Quote
  #8  
Old January 2nd, 2009, 03:20
mart mart is offline
Junior Member
 
Join Date: Dec 2008
Posts: 48
Thanks: 6
Thanked 17 Times in 4 Posts
Default

Quote:
Originally Posted by mart
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:
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
   specific passthrough device only, and to the specific group only.

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:
    acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
and
Code:
    acd0: FAILURE - READ_BIG timed out
errors. And I still can't get !@$%^$#&* automount functioning properly with xfce... can anyone?
Reply With Quote
The Following User Says Thank You to mart For This Useful Post:
graudeejs (January 2nd, 2009)
  #9  
Old January 3rd, 2009, 21:11
pablo pablo is offline
Junior Member
 
Join Date: Nov 2008
Location: /home/pablo
Posts: 33
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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)?
Reply With Quote
  #10  
Old January 3rd, 2009, 21:36
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

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:
sysutils/nrg2iso
sysutils/ccd2iso
sysutils/daa2iso
sysutils/mdf2iso
sysutils/nrg2iso
sysutils/uif2iso

Last edited by graudeejs; August 12th, 2009 at 11:22.
Reply With Quote
  #11  
Old January 6th, 2009, 22:34
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

Quote:
Originally Posted by Pushrod View Post
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

Last edited by graudeejs; January 6th, 2009 at 22:42.
Reply With Quote
  #12  
Old December 27th, 2009, 15:55
trybeingarun trybeingarun is offline
Junior Member
 
Join Date: Dec 2009
Posts: 79
Thanks: 6
Thanked 0 Times in 0 Posts
Default

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?
Reply With Quote
  #13  
Old December 27th, 2009, 16:21
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

you probably need to
Code:
# kldload atapicam
# kldload cd
# kldload pass
and set permissions so you, as user, have rw access to /dev/cdX and /dev/passY

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
Reply With Quote
  #14  
Old February 28th, 2010, 00:49
cpcnw's Avatar
cpcnw cpcnw is offline
Junior Member
 
Join Date: Nov 2008
Posts: 78
Thanks: 4
Thanked 5 Times in 4 Posts
Default

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:
growisofs -speed=10 -dvd-compat -use-the-force-luke=dao -Z /dev/cd1 -V DVD_TITLE -dvd-video /tmp/DVD_TITLE

Last edited by DutchDaemon; February 28th, 2010 at 01:58. Reason: added [code] tags
Reply With Quote
  #15  
Old March 5th, 2010, 00:15
cpcnw's Avatar
cpcnw cpcnw is offline
Junior Member
 
Join Date: Nov 2008
Posts: 78
Thanks: 4
Thanked 5 Times in 4 Posts
Default

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

Code:
#!/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!
Reply With Quote
  #16  
Old March 5th, 2010, 00:24
phoenix's Avatar
phoenix phoenix is offline
Moderator
 
Join Date: Nov 2008
Location: Kamloops, BC, Canada
Posts: 3,141
Thanks: 43
Thanked 702 Times in 579 Posts
Default

"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.
Reply With Quote
  #17  
Old March 5th, 2010, 08:56
cpcnw's Avatar
cpcnw cpcnw is offline
Junior Member
 
Join Date: Nov 2008
Posts: 78
Thanks: 4
Thanked 5 Times in 4 Posts
Default

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

Just taking advice of handbook? Maybe I should cross reference ...
Reply With Quote
  #18  
Old January 7th, 2011, 20:41
ckester's Avatar
ckester ckester is offline
Member
 
Join Date: Nov 2008
Location: near Seattle, WA (USA)
Posts: 288
Thanks: 28
Thanked 36 Times in 31 Posts
Default

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?
Reply With Quote
  #19  
Old January 8th, 2011, 15:20
bes bes is offline
Junior Member
 
Join Date: Aug 2010
Posts: 95
Thanks: 5
Thanked 32 Times in 28 Posts
Default

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:
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:
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:
cp /dev/acd0 path2/file
cat file1 ... file > archive.tar.gz

Last edited by bes; January 8th, 2011 at 15:35.
Reply With Quote
Reply

Tags
blu-ray, burn, dvd, iso, kiss

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to burn jpg's to cd ?? xman73 General 6 January 2nd, 2009 03:00
[Solved] FreeBSD CD's + GELI graudeejs General 2 December 3rd, 2008 18:19
Creating CD's dpalme Installing & Upgrading 5 November 24th, 2008 05:47
Simple? PF question. Just learning neurosis Firewalls 11 November 20th, 2008 12:38


All times are GMT +1. The time now is 00:25.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0