2015年7月21日 星期二

在 GNU/Linux 系統上使用指令來燒錄光碟的一些心得

首先是 dvd+rw-mediainfo 這個指令可以用來檢查光碟機裡面到底是放著哪一種光碟片。

$ sudo dvd+rw-mediainfo /dev/sr0
INQUIRY:                [HL-DT-ST][DVD+-RW GP60N   ][A300]
GET [CURRENT] CONFIGURATION:
 Mounted Media:         1Ah, DVD+RW
 Media ID:              RITEK/004
 Current Write Speed:   4.0x1385=5540KB/s
 Write Speed #0:        4.0x1385=5540KB/s
 Write Speed #1:        2.4x1385=3324KB/s
 Speed Descriptor#0:    00/2295103 R@8.0x1385=11080KB/s W@4.0x1385=5540KB/s
 Speed Descriptor#1:    00/2295103 R@8.0x1385=11080KB/s W@2.4x1385=3324KB/s
READ DVD STRUCTURE[#0h]:
 Media Book Type:       00h, DVD-ROM book [revision 0]
 Legacy lead-out at:    2295104*2KB=4700372992
READ DISC INFORMATION:
 Disc status:           blank
 Number of Sessions:    1
 State of Last Session: empty
 "Next" Track:          1
 Number of Tracks:      1
READ FORMAT CAPACITIES:
 unformatted:  2295104*2048=4700372992
 26h(0):  2295104*2048=4700372992
READ TRACK INFORMATION[#1]:
 Track State:           invisible incremental
 Track Start Address:   0*2KB
 Free Blocks:           2295104*2KB
 Track Size:            2295104*2KB
READ CAPACITY:          0*2048=0

看到 Mounted Media 這行寫著 DVD+RW 就是光碟片的規格了,另外是 Disc status 這行可以看到目前光碟片的內容是空白的。

另外使用 wodim 也可以看到光碟片的規格,不過更重要的是 wodim 可以看到光碟機的規格

$ sudo wodim dev=/dev/sr0 driveropts=help -checkdrive -v
TOC Type: 1 = CD-ROM
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
Driveropts: 'help'
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   : 
Vendor_info    : 'HL-DT-ST'
Identification : 'DVD+-RW GP60N   '
Revision       : 'A300'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x001A (DVD+RW)
Profile: 0x0012 (DVD-RAM) 
Profile: 0x002B (DVD+R/DL) 
Profile: 0x001B (DVD+R) 
Profile: 0x001A (DVD+RW) (current)
Profile: 0x0016 (DVD-R/DL layer jump recording) 
Profile: 0x0015 (DVD-R/DL sequential recording) 
Profile: 0x0014 (DVD-RW sequential recording) 
Profile: 0x0013 (DVD-RW restricted overwrite) 
Profile: 0x0011 (DVD-R sequential recording) 
Profile: 0x0010 (DVD-ROM) 
Profile: 0x000A (CD-RW) 
Profile: 0x0009 (CD-R) 
Profile: 0x0008 (CD-ROM) 
Profile: 0x0002 (Removable disk) 
Driver options:
burnfree Prepare writer to use BURN-Free technology
noburnfree Disable using BURN-Free technology

像是我目前使用的燒錄機有支援 burnfree 的功能,wodim 如果加上 -prcap 來使用,可以看到更詳細的細節。

$ sudo wodim -prcap dev=/dev/sr0 driveropts=help -checkdrive -v
TOC Type: 1 = CD-ROM
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
Driveropts: 'help'
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   : 
Vendor_info    : 'HL-DT-ST'
Identification : 'DVD+-RW GP60N   '
Revision       : 'A300'
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

  Does read Mode 2 Form 1 blocks
  Does read Mode 2 Form 2 blocks
  Does read digital audio blocks
  Does restart non-streamed digital audio reads accurately
  Does support Buffer-Underrun-Free recording
  Does read multi-session CDs
  Does read fixed-packet CD media using Method 2
  Does not read CD bar code
  Does not read R-W subcode information
  Does read raw P-W subcode data from lead in
  Does return CD media catalog number
  Does return CD ISRC information
  Does support C2 error pointers
  Does not deliver composite A/V data

  Does play audio CDs
  Number of volume control levels: 255
  Does support individual volume control setting for each channel
  Does support independent mute setting for each channel
  Does not support digital output on port 1
  Does not support digital output on port 2

  Loading mechanism type: tray
  Does support ejection of CD via START/STOP command
  Does not lock media on power up via prevent jumper
  Does allow media to be locked in the drive via PREVENT/ALLOW command
  Is currently in a media-locked state
  Does not support changing side of disk
  Does not have load-empty-slot-in-changer feature
  Does not support Individual Disk Present feature

  Maximum read  speed: 11080 kB/s (CD  62x, DVD  8x)
  Current read  speed: 11080 kB/s (CD  62x, DVD  8x)
  Maximum write speed:  5540 kB/s (CD  31x, DVD  4x)
  Current write speed:  5540 kB/s (CD  31x, DVD  4x)
  Rotational control selected: CLV/PCAV
  Buffer size in KB: 768
  Copy management revision supported: 1
  Number of supported write speeds: 2
  Write speed # 0:  5540 kB/s CLV/PCAV (CD  31x, DVD  4x)
  Write speed # 1:  3324 kB/s CLV/PCAV (CD  18x, DVD  2x)

Supported CD-RW media types according to MMC-4 feature 0x37:
  Does write multi speed       CD-RW media
  Does write high  speed       CD-RW media
  Does write ultra high speed  CD-RW media
  Does not write ultra high speed+ CD-RW media

如果是從來都沒有使用過的 DVD+RW 片,可能會需要先格式化一次。

$ sudo wodim dev=/dev/sr0 -format
...
$ sudo dvd+rw-mediainfo /dev/sr0
INQUIRY:                [HL-DT-ST][DVD+-RW GP60N   ][A300]
GET [CURRENT] CONFIGURATION:
 Mounted Media:         1Ah, DVD+RW
 Media ID:              RITEK/004
 Current Write Speed:   4.0x1385=5540KB/s
 Write Speed #0:        4.0x1385=5540KB/s
 Write Speed #1:        2.4x1385=3324KB/s
 Speed Descriptor#0:    00/2295103 R@8.0x1385=11080KB/s W@4.0x1385=5540KB/s
 Speed Descriptor#1:    00/2295103 R@8.0x1385=11080KB/s W@2.4x1385=3324KB/s
READ DVD STRUCTURE[#0h]:
 Media Book Type:       00h, DVD-ROM book [revision 0]
 Legacy lead-out at:    2295104*2KB=4700372992
READ DISC INFORMATION:
 Disc status:           complete
 Number of Sessions:    1
 State of Last Session: complete
 Number of Tracks:      1
 BG Format Status:      in progress, 78.1% complete
READ FORMAT CAPACITIES:
 formatted:  2295104*2048=4700372992
 26h(0):  2295104*2048=4700372992
READ TRACK INFORMATION[#1]:
 Track State:           complete incremental
 Track Start Address:   0*2KB
 Free Blocks:           0*2KB
 Track Size:            2295104*2KB
FABRICATED TOC:
 Track#1  :             14@0
 Track#AA :             14@2295104
 Multi-session Info:    #1@0
READ CAPACITY:          2295104*2048=4700372992

DVD+RW 格式化完後 Disc status 會變成 complete。

如果使用的是已經有寫入資料的 DVD-RW 片,可能會需要先快速抹除光碟內容。

$ sudo wodim -v dev=/dev/sr0 blank=fast

如果快速抹除光碟片執行失敗,也許可以試試看強迫完整抹除光碟內容。

$ sudo wodim -v dev=/dev/sr0 blank=all -force

DVD-RW 抹除後會長像下面這樣。

$ sudo dvd+rw-mediainfo /dev/sr0
INQUIRY:                [HL-DT-ST][DVD+-RW GP60N   ][A300]
GET [CURRENT] CONFIGURATION:
 Mounted Media:         14h, DVD-RW Sequential
 Media ID:              RITEKW04    
 Current Write Speed:   4.0x1385=5540KB/s
 Write Speed #0:        4.0x1385=5540KB/s
 Write Speed #1:        2.0x1385=2770KB/s
 Speed Descriptor#0:    00/2298495 R@8.0x1385=11080KB/s W@4.0x1385=5540KB/s
 Speed Descriptor#1:    00/2298495 R@8.0x1385=11080KB/s W@2.0x1385=2770KB/s
READ DVD STRUCTURE[#10h]:
 Media Book Type:       00h, DVD-ROM book [revision 0]
 Legacy lead-out at:    2298496*2KB=4707319808
READ DVD STRUCTURE[#0h]:
 Media Book Type:       33h, DVD-RW book [revision 3]
 Last border-out at:    8390653*2KB=17184057344
READ DISC INFORMATION:
 Disc status:           blank
 Number of Sessions:    1
 State of Last Session: empty
 "Next" Track:          1
 Number of Tracks:      1
READ FORMAT CAPACITIES:
 unformatted:  2297888*2048=4706074624
 00h(800):  2297888*2048=4706074624
 10h(10):  2297888*2048=4706074624
 15h(10):  2297888*2048=4706074624
READ TRACK INFORMATION[#1]:
 Track State:           blank
 Track Start Address:   0*2KB
 Next Writable Address: 0*2KB
 Free Blocks:           2297888*2KB
 Track Size:            2297888*2KB
READ CAPACITY:          0*2048=0

有時候可能會想要指定最低倍速來燒錄光碟片,因為光碟機或光碟片的品質問題,會導致全速燒錄時的失敗,最低倍速的燒錄會相對保險一些。

$ sudo wodim -v -eject dev=/dev/sr0 speed=2 driveropts=burnfree Windows10_InsiderPreview_x64_ZH-TW_10162.iso

加上 -eject 是希望燒錄完成後將光碟片拖盤退出(如果光碟機真的有拖盤的話),加上 driveropts=burnfree 是因為光碟機有這個功能。

使用 DVD+RW 跟 DVD-RW 的不同點在於 DVD+RW 只要格式化一次,之後就可以重覆地直接將 ISO 寫進去,不需要像 DVD-RW 那樣,每次都要先抹除內容,然後才可以將 ISO 寫進去。

2015年7月10日 星期五

關於 Debian/Ubuntu 裡面的 foreign-architectures 這件事

Debian 跟 Ubuntu 都在某個版本後開始支援了 Multiarch 這樣的架構,主要的中心思想是要改善檔案系統的結構,讓它能夠共存多種不同 CPU 架構的應用程式跟檔案;然後如果使用者安裝的系統是 amd64 的話,Debian 跟 Ubuntu 都會自動加入 i386 來使用。

只不過也許有些人像筆者一樣有潔癖,不喜歡系統裡面存在著其它根本完全不會去使用的東西,於是在 Ubuntu 14.04 裡面就可以用下面的指令將 i386 給移除掉。

$ sudo dpkg --remove-architecture i386

如果哪天反悔了,也可以再加回來。

$ sudo dpkg --add-architecture i386

或者想要看看目前使用了哪些額外的架構。

$ dpkg --print-foreign-architectures
i386

或是想要看看目前主要使用的架構是什麼。

$ dpkg --print-architecture
amd64

或許想要試試看 i386 跟 amd64 以外的架構(P.S. Ubuntu 只有提供少部份的幾種,Debian 也不是每個 Mirror Site 都會包含所有部份)

$ dpkg-architecture -L
...
armhf
armel
mipsn32
mipsn32el
mips64
mips64el
powerpcspe
x32
lpia
i386
ia64
alpha
amd64
armeb
arm
arm64
avr32
hppa
m32r
m68k
mips
mipsel
powerpc
ppc64
ppc64el
s390
s390x
sh3
sh3eb
sh4
sh4eb
sparc
sparc64
...

最後是在 amd64 系統裡面將 i386 移除掉,也可以順便省下一些在 apt-get update 或是 apt update 的時間,搭配以前寫過的「在 Ubuntu 上面減少 apt-get update 的時間」使用效果最好。