CD/DVD 刻录 - Debian Wiki 合集
十二月 12, 2024 [Linux 与系统] #obsidian #发行版 #合集 #音视频ManipulatingISOs - Debian Wiki
Mounting an ISO and extracting files from it. Command line techniques with a Debian ISO remaster example.
目录
Copy an optical disk to a file
Copy a CD to a .iso file:
dd if=/dev/cdrom of=image.iso
Mount an ISO file
Terminal
Mount the contents of a .iso file to a directory:
mount -o loop -t iso9660 image.iso /the/directory
Disks
Mount the contents of a .iso file to a Disks pseudo-directory:
- Using GNOME, open "Gnome-Disk-Utility" (Disks)
- Using Disks, navigate to "Disks" menu ---> "Attach disk image" option
- Using the "Select an image to attach" window, navigate the image file you need to mount. For exemple an .iso file. Click on "Attach" button.
- The image is now mounted. Using any file manager to your liking, such as Nautilus, find the mounted .iso under "Others" group.
Convert any disk image to ISO format
The iat package can be used to convert many disk image formats (BIN, MDF, PDI, CDI, NRG, and B5I) to ISO9660.
Loopmount an ISO Without Administrative Privileges
Users seeking to view the contents of an ISO file or copy a file from it are frequently advised to mount the ISO with
mount -o loop example.iso /mnt
There are two aspects of this advice to consider:
- The command requires root privileges, which the user might not have.
- Why invoke a root privilege (if available) when it is unnecessary?
The following programs allow loopmounting without administrative privileges.
udisksctl
Install udisks2:
apt install udisks2
If a desktop environment has been installed from the installer or after the installation, udisks2 will already be on the system.
The package contains the udisksctl program. The command
udisksctl loop-setup -r -f example.iso
attaches the ISO to a loop device in /dev. Logging out and back in again might be necessary to have success with this command as a user.
Afterwards
ls -l /dev/loop*
might show
brw-rw---- 1 root disk 7, 0 Nov 16 15:14 /dev/loop0
brw-rw---- 1 root disk 259, 2 Nov 16 15:14 /dev/loop0p1
brw-rw---- 1 root disk 259, 3 Nov 16 15:14 /dev/loop0p2
brw-rw---- 1 root disk 7, 1 Nov 16 15:19 /dev/loop1
brw-rw---- 1 root disk 7, 2 Nov 16 15:14 /dev/loop2
brw-rw---- 1 root disk 7, 3 Nov 16 15:14 /dev/loop3
brw-rw---- 1 root disk 7, 4 Nov 16 15:14 /dev/loop4
brw-rw---- 1 root disk 7, 5 Nov 16 15:14 /dev/loop5
brw-rw---- 1 root disk 7, 6 Nov 16 15:14 /dev/loop6
brw-rw---- 1 root disk 7, 7 Nov 16 15:14 /dev/loop7
crw-rw---- 1 root disk 10, 237 Nov 16 15:14 /dev/loop-control
The ISO's main partition can be mounted and unmounted with the commands
udisksctl mount -b /dev/loop0p1
udisksctl unmount -b /dev/loop0p1
The mount point is at /media/$USER.
Unmounting still leaves example.iso associated with /dev/loop0. To unattach the device do
udisksctl loop-delete -b /dev/loop0
udisks2 appeared in Debian 8 (jessie).
udevil
Intended as a udisks2 replacement but udevil can co-exist with it and will work to mount an ISO with or without its recommended packages.
udevil mount example.iso
and
udevil unmount example.iso
work out of the box. The mount point is in /media.
udevil appeared in Debian 8 (jessie) but has been backported to Debian 7 (wheezy).
pmount
Mounting an ISO with pmount requires (at present) the experimental version. Alter the loop_allow directive in /etc/pmount.conf to yes and uncomment loop_devices before mounting the ISO in /media with
pmount example.iso
Unmount with
pumount example.iso
archivemount
archivemount is a FUSE based file system which supports reading from (but not writing to) ISO 9660 images. Create the directory isomount in $HOME and mount with
archivemount example.iso isomount/
Unmount with
fusermount -u isomount/
fuseiso9660
fuseiso9660 is a module for the FUSE kernel service.
Create the directory isomount in the home directory ($HOME) and mount the iso with
fuseiso9660 example.iso isomount/
Unmount with
fusermount -u isomount/
fuseiso9660 deals only with the basic ISO9660 format (see the manual) so filenames are limited to uppercase and 11 characters in an 8.3 format.
Viewing the Contents of an ISO
Mounting the ISO and following up with
ls -l <mount_point>
is one method of seeing what the structure of the ISO is and what it contains. However, there are a number of programs which will allow examination of the contents of an ISO archive without having to mount it and without administration rights.
A Debian 9 (stretch) netinst ISO will be used as an example image in what follows.
bsdtar
bsdtar is a tar implementation which can view the contents of various archive files, including ISO 9660 images. It can also extract files from the image. For a basic view of the contents of an ISO image do
bsdtar -tf debian-9.3.0-i386-netinst.iso
A detailed view would be obtained with
bsdtar -tvf debian-9.3.0-i386-netinst.iso
To look at a particular directory in the archive there is
bsdtar -tf debian-9.3.0-i386-netinst.iso pool/main/a
xorriso
xorriso is a versatile program which manipulates ISO 9660 filesystem images. It can also extract files from the image.
Commands which correspond to the ones for bsdtar are
xorriso -indev debian-9.3.0-i386-netinst.iso -ls
xorriso -indev debian-9.3.0-i386-netinst.iso -lsl
xorriso -indev debian-9.3.0-i386-netinst.iso -ls pool/main/b
isoinfo
isoinfo is included in the genisoimage package and is able to list and extract files in an ISO 9660 image. The listing is of all files in the image.
For basic listing:
isoinfo -J -l -i debian-9.3.0-i386-netinst.iso
For long listing:
isoinfo -J -f -i debian-9.3.0-i386-netinst.iso
7z
The 7z utility comes in the p7zip-full package. It packs and unpacks 7z archives and has ISO 9660 as a supported format for unpacking.
7z l debian-9.3.0-i386-netinst.iso
gives a file listing of the archive.
If debian-9.3.0-i386-netinst.iso has been mounted and it is desired to have all the deb and udeb files copied to other media it should be sufficient to do
cp -a /media/<mount_point>/pool/main DESTINATION
Without explicit mounting, all the programs mentioned above are capable of extracting the same files. The relevant commands are:
bsdtar -C DESTINATION -xf debian-9.3.0-i386-netinst.iso pool/main
xorriso -osirrox on -indev debian-9.3.0-i386-netinst.iso -extract pool/main DESTINATION
isoinfo -J -x /pool/main/a/adduser/adduser_3.113+nmu3_all.deb -i debian-9.3.0-i386-netinst.iso > DESTINATION/adduser_3.113+nmu3_all.deb
7z x -oDESTINATION -i\!pool/main debian-9.3.0-i386-netinst.iso
- isoinfo only extracts single files and will display a file on stdout (possibly the screen) if it is not redirected somewhere.
- 7z doesn't like spaces between an option and its argument. Also, the bash shell sees ! as having a special meaning to it. This meaning can be removed by preceding ! with a backslash.
Remaster an Installation Image
Netinst and DVD-1 images are popular choices when it comes to installing Debian. Much of the time it is sufficient simply to boot the image to have everything installed to a user's satisfaction. However, it is also possible to pass boot parameters to the installer to achieve a particular end, either during the installation or on the installed system. Objectives could be to produce a fully automatic installation or to configure part of the system using preseeding.
Appending parameters to the kernel command line to setup, for example, a network connection, can be done relatively easily, but is a repetitive task when installing frequently. On the other hand, the installation image can be altered to contain the needed parameters before burning to CD or DVD or writing to a USB stick.
Manipulating an ISO image in this way is known as remastering. The basic idea will be illustrated using a Debian 9.3.0 i386 netinst image which is planned to be booted from the non-graphical install option with a preseed configuration file, preseed.cfg.
First make a place to put the extracted files:
mktemp -d
The name of the directory is displayed. Something like this should be seen:
/tmp/tmp.8t03ifDFAx
Extract all files from the ISO with (for example)
cat firmware-9.3.0-i386-netinst.iso | bsdtar -C "/tmp/tmp.8t03ifDFAx" -xf -
or
xorriso -osirrox on -indev firmware-9.3.0-i386-netinst.iso -extract / /tmp/tmp.8t03ifDFAx
and make the files in /tmp/tmp.8t03ifDFAx writable:
chmod -R +w /tmp/tmp.8t03ifDFAx
A preseed configuration file can now be put in /tmp/tmp.8t03ifDFAx:
cp preseed.cfg /tmp/tmp.8t03ifDFAx
Appending Boot Parameters to the ISO
Edit /tmp/tmp.8t03ifDFAx/isolinux/txt.cfg to add the required parameters to the end of the append line. What follows is a personal choice but
priority=high locale=en_GB.UTF-8 keymap=gb file=/cdrom/preseed.cfg
shows the intent. The language and keymap questions will not be asked and the rest of the installation will proceed under the guidance of preseed.cfg. preseed.cfg is found by the installer because the image is mounted on /cdrom.
Putting the ISO Back Together
For instructions how to re-use the full boot equipment of installation ISOs for "i386", "amd64", "arm64", and other architectures, see RepackBootableISO. The instructions in the following text suffice for "i386" and "amd64" in legacy BIOS mode.
Install genisoimage and do
genisoimage -r -J -b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-o preseed-firmware-9.3.0-i386-netinst.iso /tmp/tmp.8t03ifDFAx
(Leave out \ when using the command. It is only here to indicate a line-break ).
The original ISO was capable of being put on a USB stick at /dev/sdX (X depends on what lsblk gives when the stick is plugged in) with
cat firmware-9.3.0-i386-netinst.iso > /dev/sdX
and would have been bootable. The ISO can be restored to a bootable state with
isohybrid preseed-firmware-9.3.0-i386-netinst.iso
isohybrid is found in the syslinux-utils package.
Alternatively, the genisoimage and isohybrid commands can be replaced by the single command:
xorriso -as mkisofs -o preseed-firmware-9.3.0-i386-netinst.iso \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot \
-boot-load-size 4 -boot-info-table /tmp/tmp.8t03ifDFAx/
after installing isolinux.
Finally, remove /tmp/tmp.8t03ifDFAx:
rm -r /tmp/tmp.8t03ifDFAx
BurnCd - Debian Wiki
Translation(s): English - Français - Italiano
Burn Optical Media
There are several graphical programs available in Debian to burn CDs or DVDs. Install the relevant package:
This page describes usage of optical media writers/burners with CommandLineInterface programs.
目录
Make an ISO 9660 image file
Two packages are available in Debian for producing ISO 9660 filesystems: genisoimage and xorriso. These programs support the same options as the legacy mkisofs and cdrecord programs.
After installing xorriso or genisoimage, you may put the file tree /path/of/directory into an ISO 9660 filesystem image file called my.iso by one of:
genisoimage -v -J -r -V MY_DISK_LABEL -o my.iso /path/of/directory
xorriso -as mkisofs -v -J -r -V MY_DISK_LABEL -o my.iso /path/of/directory
See also ManipulatingISOs
Burn the image file to CD, DVD, or BD
After installing wodim, cdrskin, or xorriso, you may burn the image file my.iso to a CD by one of:
wodim -v dev=/dev/sr0 -dao my.iso
cdrskin -v dev=/dev/sr0 -dao my.iso
xorriso -as cdrecord -v dev=/dev/sr0 -dao my.iso
cdrskin and xorriso commands will also work on BluRay discs (wodim should not be used with DVD or BD media, see here). For BluRay burning, you can also install the growisofs package:
growisofs -dvd-compat -speed=8 -Z /dev/sr0=my.iso -quiet
As usual with the command line, burning will start right away with no confirmation questions.
Test it
For comparing MD5 sums one must restrict reading from the CD, DVD, or BD to exactly the same number of data blocks that was written by the burn program. For this, inquire the size of the ISO image file.
blocks=$(expr $(ls -l my.iso | awk '{print $5}') / 2048)
dd if=/dev/sr0 bs=2048 count=$blocks | md5sum
md5sum my.iso
This should yield identical MD5 checksum strings. E.g.
8213+0 records in
8213+0 records out
16820224 bytes (17 MB) copied, 12.189631 s, 1.4 MB/s
492bd13e477b3efb507149152a4e7736 -
492bd13e477b3efb507149152a4e7736 my.iso
One may also mount the medium and compare data files with their originals on hard disk by doing:
sudo mount /dev/sr0 /mnt/cdrom
diff /mnt/cdrom/my/file /path/of/directory
sudo umount /dev/cdrom
It might be that you first have to create directory /mnt/cdrom before you can mount it. If you eject the medium and insert it again, it may well be mounted automatically underneath /media/. In this case, you do not have to run the sudo commands.
Audio CD
Music CD players expect the CD-DA format, which is not a filesystem, but a simple list of file-like entities called Tracks. Each track is normally one piece of music. E.g. a complete song.
The content of the tracks has to be presented as data files with uncompressed samples of 44100 Hz sampling rate, 16 bits per sample, 2 channels, little-endian byte order, WAV header. This is also known as .wav file.
After installing the cdrskin or wodim package:
cdrskin -v dev=/dev/sr0 -sao -audio track1.wav track2.wav ... trackN.wav
wodim -v dev=/dev/sr0 -sao -audio track1.wav track2.wav ... trackN.wav
The resulting media cannot be read by dd or other data readers. Reading audio tracks from CD may be done by cdrskin with the extract_audio_to= option, or readom from the wodim package.
Drive Addressing
Above examples use the device file address of your first optical drive, /dev/sr0. To get a list of all your optical drive devices do one of:
cdrskin --devices
xorriso -devices
which will report something like
0 -dev '/dev/sr0' rwrw-- : 'HL-DT-ST' 'BDDVDRW GGC-H20L'
1 -dev '/dev/sr1' rwrw-- : 'HL-DT-ST' 'DVDRAM GH24NSC0'
2 -dev '/dev/sr2' rwrw-- : 'Optiarc ' 'BD RW BD-5300S'
wodim will perform this run only if the obsoleted device files /dev/scd* exist.
The sequence of drive numbers may change with each reboot. If you need persistent device names, consider to use the lengthy ones in directory /dev/disk/by-id/. You will recognise them by bearing the same manufacturer and model names as in above --devices runs. E.g.
/dev/disk/by-id/usb-Optiarc_BD_RW_BD-5300S_306663601043-0:0
ISO 9660 Burning On The Fly
One may avoid the need to store an ISO 9660 filesystem image file by piping the output of the ISO producer into the standard input of the burn program. Just omit option -o with the producer and use "-" as data file name with the burn program. Use option -tao instead of -dao or -sao, because the latter need to know the data amount in advance:
genisoimage -v -J -r -V MY_DISK_LABEL /path/of/directory \
| wodim -v dev=/dev/sr0 -tao -
With growisofs:
genisoimage ... \
| growisofs -Z /dev/sr0=/dev/fd/0
Program xorriso with its native command set performs this under control of a single process
xorriso \
-md5 on \
-outdev /dev/sr0 \
-blank as_needed \
-joliet on \
-volid MY_DISK_LABEL \
-map /home/user/the_directory / \
-find / -exec mkisofs_r --
ISO 9660 Multi-Session
Although ISO 9660 filesystems are read-only, it is possible to append new data files and a new directory tree which can refer to old files and new files alike.
Initial session (if necessary overwriting a re-usable medium like BD-RE from scratch):
xorriso \
-for_backup \
-outdev /dev/sr0 \
-blank as_needed \
-volid MY_BACKUP_"$(date '+%Y_%m_%d_%H%M%S')" \
-update_r /home/user/documents /documents
Further update sessions will add new files, overwrite changed files, and remove deleted files:
xorriso \
-for_backup \
-assert_volid 'MY_BACKUP_*' fatal \
-dev /dev/sr0 \
-volid MY_BACKUP_"$(date '+%Y_%m_%d_%H%M%S')" \
-update_r /home/user/documents /documents
At some update attempt, the program will go on strike because the medium is full. Then you need to write an initial session onto another blank or re-usable medium.
Verification of the most recent session data:
xorriso -for_backup -indev /dev/sr0 -check_md5 FAILURE --
Verification of all recorded sessions
xorriso -for_backup -indev /dev/sr0 -check_media --
In case of mismatch, the exit value will be non-zero
if test $? = 0 ; then echo "OK" ; else echo "MISMATCH !" ; fi
Legacy
Before Linux 2.4, using the ide-scsi driver for burners could improve performance ("hdc=ide-scsi" in lilo/GRUB bootloader options). The detection of the burner as a SCSI device could be verified with cdrecord -scanbus. On Linux 2.6 ,ide-cd replaced ide-scsi for CD burners.
On some systems you might need to add your user account to the cdrom group (or have some kind of write access to the burner device file in /dev/)
See also:
- CDDVD
- CDDVDTools
- man genisoimage
- man xorrisofs
- man wodim
- man cdrskin
- man xorrecord
- man growisofs
- man xorriso
CDDVD - Debian Wiki
Translation(s): English - Français - Italiano - Português (Brasil)
目录
- Devices
- Optical Media Formats
- Detecting and Mounting
- Watching Video DVDs
- Ripping
- FAQ
- See also
- External links
Devices
CDs, DVDs, and BDs are common types of removable media. Unlike other types of removable media (such as flash drives or external hard drives), they are normally used read-only and many of them require special burn programs. I.e. they are not mounted for writing like "normal" filesystems. CD, DVD, and BD are optical discs, so we can use that term to refer to them collectively.
Your PC will offer device files to access your optical disc(s). Such devices are typically called drives, players, or readers, and are generally detected as /dev/sr*, where * is a number starting at 0. (Thus your first drive will be /dev/sr0, second /dev/sr1, etc.) Symlinks such as /dev/cdrom, /dev/cdrw, /dev/dvd, or /dev/dvdrw (pointing to /dev/sr0) may also be created depending on your OS version and the detected capabilities of your device.
The sequence of device file numbers may change with each reboot. The directory /dev/disk/by-id contains symbolic links with names which show persistent name parts. Like:
/dev/disk/by-id/ata-HL-DT-ST_DVDRAM_GH24NSC0_K8AF33A3528
/dev/disk/by-id/usb-Optiarc_BD_RW_BD-5300S_306663601043-0:0
The name parts "HL-DT-ST_DVDRAM_GH24NSC0_K8AF33A3528" and "Optiarc_BD_RW_BD-5300S_306663601043" are supposed to persist even if you change the way the drives are attached to your computer.
Optical Media Formats
You will normally encounter two types of readable optical media and one type that is writable:
CD-DA
CD-DA contains audio tracks in a low level format that can only be read by music CD players or by specialized software like icedax or readom from wodim. Writing is done by burn programs in audio mode.
CD-ROM
CD-ROM contains data which are readble by normal means as from normal data files or block devices. This format is only one of several CD sector formats. DVD and BD media always appear as CD-ROM. Their video or audio content is wrapped in read-only filesystems. Writing is done by burn programs in data mode.
Read-Write Media
DVD+RW, DVD-RAM, and BD-RE media may also be written as normal block devices. Formatted CD-RW and formatted DVD-RW may be used that way by help of device files /dev/pktcdvd* and program pktsetup out of udftools. Their performance with random access writing is quite poor, though. For larger amounts of data, you are better off with burn programs, which are needed for CD-R, DVD-R, DVD+R, and BD-R, anyway.
Read-write media may be used like CD-ROM media as long as only reading is desired.
Detecting and Mounting
To detect the device files of your CD/DVD/BD drives, use one of these commands
cdrskin --devices
xorriso -devices
from the Debian packages with the same names.
To check which special file /dev/cdrom is a symlink to (i.e. /dev/sr0, /dev/hdc or /dev/scd0), type:
ls -al /dev/cdrom*
Mounting is often done automatically to a directory underneath /media/ when a readable medium gets inserted into a drive. You should wait with accessing it, until the drive LED stops blinking.
If no automounting is enabled, then you may mount a data CD, DVD, or BD by
sudo mount /dev/sr0 /mnt/iso
Possibly you have to create directories /mnt and/or /mnt/iso before you see success with this command.
Watching Video DVDs
For unprotected DVDs, watching them is often as simple as installing VLC which has the function built-in and depends on the necessary libraries to watch and interact with DVDs. The same goes for others such as MPlayer, mpv, and kaffeine
However, many DVDs use the CSS (Content Scrambling System) as a form of DRM to encrypt the content of Video DVDs. To play such discs, a special library is required to decode them, libdvdcss.
Due to the legal limbo of libdvdcss in some particular jurisdictions, some distributions including Debian do not distribute libdvdcss directly.
On Debian 9/Stretch and newer versions, you can install the libdvd-pkg package which automates the process of downloading and setting up the necessary library. This only requires you to have the "contrib" component enabled in your SourcesList file.
Setting the region
Some DVD players require the region to be set before they are able to play encrypted DVDs. This has to be done manually with regionset. The man-pages provide help in choosing the proper country-code.
Ripping
To almost quote Wikipedia, ripping is the process of copying input audio or video content (typically from an optical disc) and outputting to a "normal" storage filesystems. Ripping is typically more difficult than simple file copying (as when copying files from a flash drive or external hard drive) in that
- the source content (i.e., the audio or video (or both) on the optical disc) typically is not formatted like data in a "normal" filesystem.
- the source content is often encrypted (e.g., with CSS)
- writing output audio and video files may require particular codecs.
- the user may want to include metadata (aka tags, e.g., artist name, work title, release date) in the output. This metadata will typically require some format, e.g., ID3.
This involves at least 3 separate problems (discussed in more detail here):
- reading the optical disc (which this page is largely about)
- writing to the desired output format
- gathering or authoring metadata
FAQ
4GB per File limitation in ISO 9660
Optical media are often filled with an ISO 9660 aka ECMA-119 filesystem. Data files of size 4 GiB or larger are allowed by the specification of ECMA-119 Level of Interchange 3 (mkisofs option -iso-level 3).
Nevertheless, Solaris and the BSDs are unable to properly represent such files when the filesystem is mounted. On such systems one may extract large files from ISO 9660 filesystems by help of program osirrox out of the source tarball of GNU xorriso.
Converting DVD
- http://lucasmanual.com/mywiki/DVD9toDVD5 Dual layer (9G) Video DVD into single layer DVD (4.7G)
- http://lucasmanual.com/mywiki/DVD9toAVI Convert DVD Video into AVI file.
See also
- BurnCd - working with CD/DVD/BD burners
- CD/DVD Tools
- ManipulatingISOs
External links
- https://wiki.archlinux.org/index.php/Optical_disc_drive - Optical Disc Drive on Arch Linux wiki
- http://www.yolinux.com/TUTORIALS/LinuxTutorialSysAdmin.html#MOUNTCD
- http://www.justlinux.com/nhf/Hardware/Adding_an_IDE_CD-Writer_to_Linux.html
- http://www.tldp.org/HOWTO/CDROM-HOWTO/ The Linux CD-ROM HowTo
- http://www.tldp.org/HOWTO/Hardware-HOWTO/cdrom.html Compatibility HowTo
- http://www.tldp.org/HOWTO/Filesystems-HOWTO-8.html 9660 FileSystem.
- http://www.tldp.org/HOWTO/Bootdisk-HOWTO/cd-roms.html Bootable CD-ROM HowTo
ToDo: refactor, merge other CD/DVD related pages
How to Burn a CD or DVD ISO in the Linux Terminal | Baeldung on Linux
1. Overview
An ISO file comprises data, a file system, and a directory structure organized in sectors. Usually, ISO files are a copy of a CD, DVD, or Blu-ray disk for operating systems and other software. An ISO file is also known as an ISO image.
In this tutorial, we’ll learn how to burn an ISO file to a CD or DVD in the Linux terminal using two commands:
We’ll install them, explore how they work, and burn an optical disk with each.
2. Optical Disk Drive and Burn Support
The first step in burning ISO files to a CD or DVD is to locate the optical disk drive’s path. Also, we might need to make sure the system supports CD or DVD burning.
2.1. /proc
First, using the /proc directory and the cat command, let’s check if our system supports CD or DVD burning:
$ cat /proc/sys/dev/cdrom/info
CD-ROM information, Id: cdrom.c 3.20 2003/12/17
drive name: sr0
drive speed: 24
...
Can play audio: 1
Can write CD-R: 1
Can write CD-RW: 1
Can read DVD: 1
Can write DVD-R: 1
Can write DVD-RAM: 1
Can read MRW: 1
Can write MRW: 1
Can write RAM: 1
Specifically, our attention falls onCan write DVD-Rin the command’s output. The system supports DVD writing if the value is 1. Thus, the system ought to contain at least one piece of hardware that can write DVDs.
Notably, the drive name supporting the DVD write issr0 , hence, the full path to the DVD writer is /dev/sr0.
2.2. lsblk
Alternatively, we can check where our DVD writer is located using the lsblk command:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
...
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 513M 0 part /boot/efi
└─sda3 8:3 0 465.3G 0 part /
sr0 11:0 1 0B 0 rom
Here, the output highlights the presence of our target, sr0with 0B showing that the DVD is blank. Also, we use this step to examine if we have more than one DVD device on our system.
2.3. lsscsi
However, we can also opt for the lsscsi command, which uses information in the Linux kernel to list SCSI and NVMe devices attached to a system:
$ lsscsi
[0:0:0:0] disk ATA WDC WD5000AAKX-6 1H16 /dev/sda
[1:0:0:0] cd/dvd TSSTcorp DVD+-RW SN-208BB D300 /dev/sr0
From the output, we can identify the type of disk drive we have. Specifically, DVD+-RW indicates a readable and writable DVD disk.
3. Using the wodim Command
***wodimis the main tool provided by thecdrkit***project for writing data to optical media like CDs and DVDs. wodim replaced cdrecord in many Linux distributions as the default command-line tool for burning optical discs.
Initially, cdrecord was part of the cdrtools package and was widely used for burning discs. However, due to licensing concerns surrounding cdrtools, the cdrecord tool was replaced by wodim. Thus, we’ll use thewodimcommand to burn a DVD ISO from the Linux terminal.
3.1. Installing wodim
Of course, to burn an ISO file using the wodim tool, we must first have the command on the system . Specifically,we can installwodimin Ubuntu using***apt*** :
$ sudo apt install wodim
Further, we can check the read and write capabilities of our disk drive withwodimusing the -prcapflag:
$ wodim -prcap
Device was not specified. Trying to find an appropriate drive...
Detected CD-R drive: /dev/sr0
Using /dev/cdrom of unknown capabilities
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'TSSTcorp'
Identification : 'DVD+-RW SN-208BB'
Revision : 'D300'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Drive capabilities, per MMC-3 page 2A:
Does read CD-R media
Does write CD-R media
Does read CD-RW media
Does write CD-RW media
Does read DVD-ROM media
Does read DVD-R media
Does write DVD-R media
Does read DVD-RAM media
Does write DVD-RAM media
Does support test writing
...
Here, the -prcap flag prints the disk drive’s capabilities for SCSI-3 MMC-compliant drives. SCSI-3 MMC stands for SCSI-3 Multimedia Commands, a set of command standards that specifically focuses on controlling and managing multimedia devices, such as CD and DVD drives, within a computing environment.
Since we didn’t specify any device for the command, it searches through the system for a CD or DVD drive. Then, once it finds any device, the command prints its properties and capabilities.
Alternatively, this serves as another way to check where our DVD writer is located.
3.2. Burning an ISO Image
Having confirmed the readiness of our system and the DVD drive, let’s burn the ISO to DVD using thewodimcommand:
$ wodim -eject -tao speed=2 dev=/dev/sr0 -v -data myiso.iso
TOC Type: 1 = CD-ROM
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
...
Track 01: Total bytes read/written: 3826831360/3826831360 (1868570 sectors).
Writing time: 857.908s
Average write speed 3.3x.
Min drive buffer fill was 99%
Fixating...
Fixating time: 26.991s
wodim: fifo had 60277 puts and 60277 gets.
wodim: fifo was 0 times empty and 41284 times full, min fill was 94%.
Let’s break down this command:
- -ejectensures that once the burning process is complete, the DVD will be ejected automatically
- -taoallows us to track the process in a Track-At-Once writing mode
- dev=/dev/sr0 specifies the device file for the DVD drive
- speed=2sets the burning speed to 2
- -v (verbose) enables us to track the recording progress
- -dataindicates that we’re writing data to the DVD
However, if the DVD writing fails, we can try a slower speed to see whether that fixes the problem. In fact, we can choose the slowest burn speed that is practically feasible for the lowest chance of an error.
Further, to see if the burning process was successful, we can check the DVD using the lsblk command:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
...
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 513M 0 part /boot/efi
└─sda3 8:3 0 465.3G 0 part /
sr0 11:0 1 3.6G 0 rom /media/user/Ubuntu 22.04.1 LTS amd64
The result, sr0 11:0 1 3.6G 0 rom /media/user/Ubuntu 22.04.1 LTS amd64, indicates that the DVD now contains 3.6G of data and now has the name of the ISO image burned on it.
Next, let’s look at how to use the growisofs command to achieve the same.
4. Using growisofs
Thegrowisofscommand is a frontend command-line tool for***genisoimage***that also serves as an optical disk recording program. Thus, we can use it to burn an ISO to a DVD.
Similar to wodim, we can install growisofs using apt:
$ sudo apt install growisofs
Now, we can explore how to burn an ISO image to DVD using growisofs:
$ growisofs -Z /dev/sr0=/path/to/iso_file
Let’s break down the command:
- -Z indicates that we want to write the ISO to the disk
- /dev/sr0is the DVD drive’s device name
- /path/to/iso_file is the path to the ISO file
For example, let’s burn theUbuntu.isoimage located in a user’sDownloaddirectory:
$ growisofs -Z /dev/sr0=/home/user_1/Downloads/Ubuntu.iso
Executing 'builtin_dd if=/home/user/ubuntu.iso of=/dev/sr0 obs=32k seek=0'
/dev/sr0: "Current Write Speed" is 8.2x1352KBps.
0/3826831360 ( 0.0%) @0x, remaining ??:?? RBU 100.0% UBU 0.0%
20971520/3826831360 ( 0.5%) @3.5x, remaining 69:33 RBU 100.0% UBU 99.7%
...
277544960/3826831360 ( 99.7%) @3.9x, remaining 0:03 RBU 13.4% UBU 32.4%
294879232/3826831360 ( 99.9%) @3.8x, remaining 0:01 RBU 7.2% UBU 40.1%
builtin_dd: 1379040*2KB out @ average 1.6x1352KBps
/dev/sr0: flushing cache
/dev/sr0: closing track
/dev/sr0: closing disc
/dev/sr0: reloading tray
On pressing the Return key, the burning process will start displaying its progress in the terminal. Notably, when the process is done, the DVD ejects automatically.
5. Conclusion
In this article, we saw how to burn an ISO file to a CD or DVD in the Linux terminal using two commands.
First, we burned an ISO image to a DVD using the wodim command. After that, we did the same using the growisofs command .
Linux Find Out Name Of DVD CD-ROM Blu-ray Writer Device
https://www.cyberciti.biz/faq/
nixCraft→Howto→Linux→How to find the name of DVD / CD-ROM / Blu-ray on Linux
Linux Find Out Name Of DVD / CD-ROM / Blu-ray Writer Device
Author: Vivek Gite Last updated: July 31, 2024 8 comments
https://www.cyberciti.biz/faq/category/linux/
H ow do I find out what the name of my CD-ROM or DVD device or Blu-ray device is under Linux operating system without using GUI options? You can type the following command to see current information about installed and detected CDROM or DVD-writers under Linux operating systems:
- The dmesg command can be used to check if given hardware or device was identified correctly by the Linux kernel.
- /proc/sys/dev/cdrom/info file name.
- lsblk command.
- blkid command.
- cd-drive command.
| Tutorial details | |
|---|---|
| Difficulty level | Easy |
| Root privileges | Yes |
| Requirements | Linux terminal |
| Category | System Management |
| OS compatibility | AlmaLinux • Alpine • Arch • CentOS • Debian • Fedora • Linux •Mint• openSUSE •Pop!_OS• RHEL •Rocky• Stream • SUSE • Ubuntu |
| Est. reading time | 2 minutes |
Using dmesg command to find out name of DVD / CD-ROM / Blu-ray writer device
The dmesg command is used to examine the Linux kernel ring buffer i.e. display bootup messages on screen. To find out if cdrom was detected or not, run:
$ dmesg | grep -E -i --color 'cdrom|dvd|cd/rw|writer'
Sample outputs:
[ 5.437164] sr0: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray
[ 5.437307] cdrom: Uniform CD-ROM driver Revision: 3.20
In this output sr0 is my cdrom / dvd reader and writer. You can see more detailed information by typing the following less command or more command$ less /proc/sys/dev/cdrom/info
OR
$ more /proc/sys/dev/cdrom/info
Sample outputs:
CD-ROM information, Id: cdrom.c 3.20 2003/12/17
drive name: sr0
drive speed: 24
drive # of slots: 1
Can close tray: 1
Can open tray: 1
Can lock tray: 1
Can change speed: 1
Can select disk: 0
Can read multisession: 1
Can read MCN: 1
Reports media changed: 1
Can play audio: 1
Can write CD-R: 1
Can write CD-RW: 1
Can read DVD: 1
Can write DVD-R: 1
Can write DVD-RAM: 1
Can read MRW: 1
Can write MRW: 1
Can write RAM: 1
Using cd-drive command to find name of your DVD / CD-ROM / Blu-ray device on Linux
Prerequisite
By default,
cd-drive command may not be installed on your system. Hence, use the apk command on Alpine Linux, dnf command/yum command on RHEL & co, apt command/apt-get command on Debian, Ubuntu & co, zypper command on SUSE/OpenSUSE, pacman command on Arch Linux to install the cd-drive.First, install the cd-drive as follows using the apt command or apt-get command on your Debian or Ubuntu Linux machine:
$ sudo apt install libcdio-utils #<--Debian/Ubuntu
Next, to see CD-ROM drive characteristics information, enter:
$ cd-drive
Here is what I see on my Linux desktop:
cd-drive version 0.81 x86_64-pc-linux-gnu
Copyright (c) 2003, 2004, 2005, 2007, 2008 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
The driver selected is GNU/Linux
The default device for this driver is /dev/cdrom
Drivers available...
GNU/Linux ioctl and MMC driver
cdrdao (TOC) disk image driver
bin/cuesheet disk image driver
Nero NRG disk image driver
CD-ROM drive supports some nonstandard or degenerate set of MMC
Drive: /dev/cdrom
Vendor : MATSHITA
Model : BD-RE UJ232A
Revision : 1.10
Profile List Feature
Unknown Profile 41
Unknown Profile 42
Unknown Profile 43
Unknown Profile 40
Re-writable DVD
DVD+R - DVD Recordable
DVD+RW - DVD ReWritable
Re-recordable DVD using Restricted Overwrite
Re-recordable DVD using Sequential recording
Re-recordable DVD using Sequential recording
Read only DVD
CD-RW Re-writable Compact Disc capable
Write once Compact Disc capable
Read only Compact Disc capable
Core Feature
Morphing Feature
Operational Change Request/Notification supported
Synchronous GET EVENT/STATUS NOTIFICATION supported
Removable Medium Feature
Tray type loading mechanism
can eject the medium or magazine via the normal START/STOP command
can be locked into the Logical Unit
Write Protect Feature
Random Readable Feature
Multi-Read Feature
CD Read Feature
C2 Error pointers are supported
CD-Text is supported
DVD Read Feature
Random Writable Feature
Incremental Streaming Writable Feature
Formattable Feature
Management Ability of the Logical Unit/media system to provide an apparently defect-free space. Feature
Restricted Overwrite Feature
DVD+RW Feature
DVD+R Feature
Rigid Restricted Overwrite Feature
CD Track at Once Feature
CD Mastering (Session at Once) Feature
DVD-R/RW Write Feature
Unknown code 34 Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Profile List Feature
Hardware : CD-ROM or DVD
Can eject : Yes
Can close tray : Yes
Can disable manual eject : Yes
Can select juke-box disc : No
Can set drive speed : No
Can read multiple sessions (e.g. PhotoCD) : Yes
Can hard reset device : Yes
Reading....
Can read Mode 2 Form 1 : Yes
Can read Mode 2 Form 2 : Yes
Can read (S)VCD (i.e. Mode 2 Form 1/2) : Yes
Can read C2 Errors : Yes
Can read IRSC : Yes
Can read Media Channel Number (or UPC) : Yes
Can play audio : Yes
Can read CD-DA : Yes
Can read CD-R : Yes
Can read CD-RW : Yes
Can read DVD-ROM : Yes
Writing....
Can write CD-RW : Yes
Can write DVD-R : Yes
Can write DVD-RAM : Yes
Can write DVD-RW : No
Can write DVD+RW : No
CD-ROM drive supports some nonstandard or degenerate set of MMC
Drive: /dev/sr0
Vendor : MATSHITA
Model : BD-RE UJ232A
Revision : 1.10
Profile List Feature
Unknown Profile 41
Unknown Profile 42
Unknown Profile 43
Unknown Profile 40
Re-writable DVD
DVD+R - DVD Recordable
DVD+RW - DVD ReWritable
Re-recordable DVD using Restricted Overwrite
Re-recordable DVD using Sequential recording
Re-recordable DVD using Sequential recording
Read only DVD
CD-RW Re-writable Compact Disc capable
Write once Compact Disc capable
Read only Compact Disc capable
Core Feature
Morphing Feature
Operational Change Request/Notification supported
Synchronous GET EVENT/STATUS NOTIFICATION supported
Removable Medium Feature
Tray type loading mechanism
can eject the medium or magazine via the normal START/STOP command
can be locked into the Logical Unit
Write Protect Feature
Random Readable Feature
Multi-Read Feature
CD Read Feature
C2 Error pointers are supported
CD-Text is supported
DVD Read Feature
Random Writable Feature
Incremental Streaming Writable Feature
Formattable Feature
Management Ability of the Logical Unit/media system to provide an apparently defect-free space. Feature
Restricted Overwrite Feature
DVD+RW Feature
DVD+R Feature
Rigid Restricted Overwrite Feature
CD Track at Once Feature
CD Mastering (Session at Once) Feature
DVD-R/RW Write Feature
Unknown code 34 Feature
Vendor-specific code f048 Feature
Vendor-specific code 473e Feature
Vendor-specific code eaff Feature
Vendor-specific code a4ab Feature
Vendor-specific code eaff Feature
Hardware : CD-ROM or DVD
Can eject : Yes
Can close tray : Yes
Can disable manual eject : Yes
Can select juke-box disc : No
Can set drive speed : No
Can read multiple sessions (e.g. PhotoCD) : Yes
Can hard reset device : Yes
Reading....
Can read Mode 2 Form 1 : Yes
Can read Mode 2 Form 2 : Yes
Can read (S)VCD (i.e. Mode 2 Form 1/2) : Yes
Can read C2 Errors : Yes
Can read IRSC : Yes
Can read Media Channel Number (or UPC) : Yes
Can play audio : Yes
Can read CD-DA : Yes
Can read CD-R : Yes
Can read CD-RW : Yes
Can read DVD-ROM : Yes
Writing....
Can write CD-RW : Yes
Can write DVD-R : Yes
Can write DVD-RAM : Yes
Can write DVD-RW : No
Can write DVD+RW : No
Using Linux lsblk command to list DVD / CD-ROM / Blu-ray writer device
To list all block devices type the lsblk command:
# lsblk
Sample outputs:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 558G 0 disk
├─sda1 8:1 1 307M 0 part /boot
├─sda2 8:2 1 250G 0 part /datasql
├─sda3 8:3 1 6G 0 part [SWAP]
├─sda4 8:4 1 1K 0 part
└─sda5 8:5 1 301.7G 0 part /
sr0 11:0 1 1024M 0 rom
Using the blkid command to find the name of DVD / CD-ROM / Blu-ray on Linux
- Insert the DVD / CD-ROM / Blu-ray into your Linux computer.
- Type the following command at the CLI to fetch a list all the available block devices on your machine. For example:
$ blkid - Look for DVD/Blu-ray/CD-ROM device name such as /dev/cdrom or /dev/sr0 and so on.
- Once you have the name of the Linux DVD / CD-ROM / Blu-ray drive, you can use it to mount the disc to access its contents. For example, to mount an ISO image from a DVD, you can use the following command:
$ sudo mkdir /mnt/dvd-rom $ sudo mount /dev/sr0 /mnt/dvd-rom $ ls /mnt/dvd-rom
Summing up
And that is how you list or find out your DVD/CD-ROM or Blu-ray device names under Linux. Read the following manual pages using the man command or info command/help command for more info:
$ man dmesg $ man lsblk $ man blkid $ man mount
中的资源管理器就能进行烧录,不会象使用ISO映像文件进行烧录时,每次完毕后都要进行关闭区段(Close Session)的操作,减少了烧录失败的机率。目前使用UDF技术的软件也都支持对CD-RW盘片的烧录,但在一些细节上有所不同,如删除的文件真的是被删除而不再是欺骗操作系统了
。不过,在增加便利性的同时UDF也减少了有效存储空间,而且还要事先将CD-R与CD-RW盘片进行格式化,其中CD-RW盘片格式化后的容量要减少近100MB,所以大家要视情使用。另外,它还有一种派生的格式,即UDF/ISO,用UDF的技术制作ISO标准
的光盘。
两者的区别:
ISO 不支持单个大于2G的文件
UDF 支持2G大小以上文件
ISO 兼容性好
UDF DOS和Win98系统不支持此格式,2000和XP以上系统和MAC系统支持
扩展ISO9660----Joliet和Romeo文件系统
在ISO9660中有一些限制,如字符设置限制,文件名长度限制和目录树深度限制.这些规定阻碍了用户复制数据到可被不同计算机平台读取的CD-ROM.因此,一些操作系统出售商已经以几种方式扩展ISO9660.
Joliet文件系统是扩展文件系统之一,由Microsoft提出和实现.它以ISO9660(1988)标准为基础。如果一CD是用Joliet文件系统创建,它只能在window 9x和window NT4.0 或更新版下读取,但是不能在任何其它平台上读取。在Joliet文件系统下,长文件名允许字符数最多为64,长目录允许数目最多为64。但是,文件名加它的完全路径总字符数不能超过120。
Romeo只定义为window9x长文件名,最多128字符。
转自:udf iso9660 java_ISO和UDF光盘格式、扩展ISO9660----Joliet和Romeo文件系统_焦虑中的博客-CSDN博客