[Linux/Ubuntu Backup] 매체로 백업하기 (mkisofs, cdrecord). cd 굽기(cd burn)
mkisofs와 cdrecord와 같은 도구를 이용하면 cd 혹은 dvd로 백업할 수 있다. 이러한 명령이외 GUI를 통해서도 백업할 수 있는 도구들도 따로 지원된다.
(앞선
[Research/Ubuntu] - [Linux/Ubuntu Backup] network, internet, tcp/ip로 백업하기 (ssh, tar, rsync)의 poem 예제가 사용된다)
mkisofs로 백업 image 생성하기
windows나 linux에서 대부분의 cd나 dvd는 읽을 수 있는데, 이는 ISO9660 표준을 따르고 있기 때문이다. mkisofs 명령으로 ISO9660 image를 생성할 수 있다. 그리고 다음의 확장 기능을 지원한다.
- SUSP (System Use Sharing Protocol)
; SUSP는 소유권, 긴이름, 그리고 symbolic link와 같은 특수한 파일과 같은 unix 풍의 속성을 기록하게 해준다. - Joliet
; Windows에서 사용할 수 있는 긴 파일이름을 사용할 수 있도록 해준다. - Hierachical File System (HFS)
; HFS 파일 시스템과 유사하게 표시되도록 해준다. 이는 Mac과 관련 있다.
아래는 iso image를 생성하는 예이다.
~$ cd /tmp
/tmp$ mkisofs -o poem.iso ~/poem
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
178 extents written (0 MB)
/tmp$ mkisofs -o poem_j.iso -J -R ~/poem
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 533
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
185 extents written (0 MB)
/tmp$ mkisofs -o poem_jh.iso -J -R -hfs ~/poem
genisoimage: Warning: no Apple/Unix files will be decoded/mapped
Total extents actually written (inc HFS) = 441
(Size of ISO volume = 400, HFS extra = 41)
Total translation table size: 747520
Total rockridge attributes bytes: 533
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 21000
591 extents written (1 MB)
/tmp$
- -O
; 기본적인 ISO9660 image 생성 - -J -R
; Joliet Rock Ridge 확장 사용 - -hfs
; HFS 사용
/tmp$ mkisofs -o backup.iso -J -R -hfs ~/poem /usr/share/eog
genisoimage: Warning: no Apple/Unix files will be decoded/mapped
Total extents actually written (inc HFS) = 441
(Size of ISO volume = 400, HFS extra = 41)
Total translation table size: 499712
Total rockridge attributes bytes: 5719
Total directory bytes: 30720
Path table size(bytes): 238
Max brk space used 23000
591 extents written (1 MB)
/tmp$ sudo mkdir /mnt/iso_test
/tmp$ sudo mount -t iso9660 -o loop backup.iso /mnt/iso_test
/tmp$ ls /mnt/iso_test
AcrossTheUniverse.txt eog-toolbar.xml
AnnabelLee.txt eog-ui.xml
BlowingInTheWind.txt gtkrc
eog-image-properties-dialog.ui icons
eog-multiple-save-as-dialog.ui pixmaps
eog-preferences-dialog.ui StillFallsTheRain.txt
/tmp$
위 예는 여러개의 경로를 함께 지정하는 예를 보여준다. 그리고, 해당 iso를 loop back으로 mount하여, iso 내부에 있는 파일을 보여주고 있다. 즉, poem 경로와 eog 경로를 iso에 추가하였는데, poem과 eog 하부의 파일들이 함께 포함되어 있음이 확인된다.
/tmp$ mkisofs -o backup.iso -J -R -graft-points 001/=/home/greenfish/poem 002/=/usr/share/eog 001/=/var/log/auth.log
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 6217
Total directory bytes: 34816
Path table size(bytes): 262
Max brk space used 21000
315 extents written (0 MB)
/tmp$ sudo mount -t iso9660 -o loop backup.iso /mnt/iso_test
/tmp$ ls /mnt/iso_test
001 002
/tmp$ ls /mnt/iso_test/001
AcrossTheUniverse.txt auth.log StillFallsTheRain.txt
AnnabelLee.txt BlowingInTheWind.txt
/tmp$ ls /mnt/iso_test/002
eog-image-properties-dialog.ui eog-preferences-dialog.ui eog-ui.xml icons
eog-multiple-save-as-dialog.ui eog-toolbar.xml gtkrc pixmaps
/tmp$
위 예는 graft-points를 이용하여, 경로를 분리시킨 예를 보여준다. 001과 002 경로로 분리되어 파일이 들어감이 확인된다.
/tmp$ mkisofs -o backup.iso -J -R -p greenfishblog.tistory.com -publisher "greenfish" -V "poem" -A "mkisofs" -volset "my favorite poem" /home/greenfish/poem
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 533
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
185 extents written (0 MB)
/tmp$
위와 같이 iso 파일의 header 정보를 넣을 수 있다.
- -p
; preparer ID. 전화번호, 메일, 웹 주소, ... - -publisher
; preparer 정보 (128글자) - -V
; volume ID. CD 삽입시 해당 문구로 mount됨. 위 예는 /media/poem으로 mount됨 - -A
; iso image 생성 도구
/tmp$ isoinfo -d -i backup.iso
CD-ROM is in ISO 9660 format
System id: LINUX
Volume id: poem
Volume set id: my favorite poem
Publisher id: greenfish
Data preparer id: greenfishblog.tistory.com
Application id: mkisofs
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 185
Joliet with UCS level 3 found
Rock Ridge signatures version 1 found
/tmp$
이렇게 생성된 iso는 위와 같이 그 정보를 확인할 수 있다.
cdrecord로 image 굽기
아래는 가능한 장치를 보여준다. (vmware에서 테스트하였다. cd가 준비되지 )
~$ cdrecord --scanbus
scsibus1:
1,0,0 100) 'NECVMWar' 'VMware IDE CDR10' '1.00' Removable CD-ROM
1,1,0 101) *
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *
~$
아래는 굽기 테스트를 보여준다.
/tmp$ cdrecord -dummy backup.iso
wodim: No write mode specified.
wodim: Assuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
Device was not specified. Trying to find an appropriate drive...
Looking for a CD-R drive to store 0.36 MiB...
Detected CD-R drive: /dev/cdrw
Using /dev/cdrom of unknown capabilities
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'NECVMWar'
Identification : 'VMware IDE CDR10'
Revision : '1.00'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Errno: 5 (Input/output error), test unit ready scsi sendcmd: no error
CDB: 00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: F0 00 02 00 00 00 00 0A 00 00 00 00 3A 01 00 00
Sense Key: 0x2 Not Ready, Segment 0
Sense Code: 0x3A Qual 0x01 (medium not present - tray closed) Fru 0x0
Sense flags: Blk 0 (valid)
cmd finished after 0.002s timeout 40s
wodim: No disk / Wrong disk!
/tmp$
아래는 실제로 굽기를 실행하는 것으로, -v를 사용하여 자세한 정보를 보여준다.
/tmp$ cdrecord -v backup.iso
wodim: No write mode specified.
wodim: Assuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
Device was not specified. Trying to find an appropriate drive...
Looking for a CD-R drive to store 0.36 MiB...
Detected CD-R drive: /dev/cdrw
Using /dev/cdrom of unknown capabilities
scsidev: '/dev/cdrom'
devname: '/dev/cdrom'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
Driveropts: 'burnfree'
SCSI buffer size: 64512
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'NECVMWar'
Identification : 'VMware IDE CDR10'
Revision : '1.00'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x0000 (Reserved/Unknown)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0016 (DVD-R/DL layer jump recording)
Profile: 0x0018 (Reserved/Unknown)
Profile: 0x002B (DVD+R/DL)
Profile: 0x001B (DVD+R)
Profile: 0x001A (DVD+RW)
Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x0012 (DVD-RAM)
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)
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
FIFO size : 12582912 = 12288 KB
Track 01: data 0 MB padsize: 230 KB
Total size: 0 MB (00:04.02) = 302 sectors
Lout start: 1 MB (00:06/02) = 302 sectors
Errno: 5 (Input/output error), test unit ready scsi sendcmd: no error
CDB: 00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: F0 00 02 00 00 00 00 0A 00 00 00 00 3A 01 00 00
Sense Key: 0x2 Not Ready, Segment 0
Sense Code: 0x3A Qual 0x01 (medium not present - tray closed) Fru 0x0
Sense flags: Blk 0 (valid)
cmd finished after 0.004s timeout 40s
wodim: No disk / Wrong disk!
/tmp$
아래는 굽기 속도를 지정한 것이다.
/tmp$ cdrecord speed=24 backup.iso
wodim: No write mode specified.
wodim: Assuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
Device was not specified. Trying to find an appropriate drive...
Looking for a CD-R drive to store 0.36 MiB...
Detected CD-R drive: /dev/cdrw
Using /dev/cdrom of unknown capabilities
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'NECVMWar'
Identification : 'VMware IDE CDR10'
Revision : '1.00'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Errno: 5 (Input/output error), test unit ready scsi sendcmd: no error
CDB: 00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: F0 00 02 00 00 00 00 0A 00 00 00 00 3A 01 00 00
Sense Key: 0x2 Not Ready, Segment 0
Sense Code: 0x3A Qual 0x01 (medium not present - tray closed) Fru 0x0
Sense flags: Blk 0 (valid)
cmd finished after 0.003s timeout 40s
wodim: No disk / Wrong disk!
/tmp$
다음과 같은 추가 옵션이 가능하다.
- -pad
; track당 15개의 0로 채워진 sector를 만든다. - -eject
; 작업후 cd가 eject된다. - dev=0,2,0
; SCSI 이름을 지정할 수 있다. - -multi
; 여러번 구울수 있는 cd로 굽기를 시자한다. - -msinfo
; 다음에 구을 위치를 확인시켜 준다. - cdrecord filename.iso
; CD를 iso로 만든다.
참고로, dvd 굽기는 growisofs를 이용한다.