dd if=/dev/cdrom of=~/cdrom_image.iso

or

mkisofs -o /tmp/cd.iso /tmp/directory