schonmann.eu

Zálohování DVD na Linuxu

Vyvstala potřeba zazálohovat nějaké DVD. V dnešní době kdy se všechno řeší na USB klíčenkách, Microsd nebo cloudech je to oříšek. A zrovna takovouhle úlohu jsem naposledy musel řešit na Windows. Pojdďme se podívat jak se to dělá na Linuxu – Konkrétně zde budu mít Linux Mint 20.3

V domácnosti již DVD mechaniku skoro nenajdeme, proto jsem si půjčil v práci Samsung SE S224Q externí DVD vypalovačku. Vypalovací funkce necháme stranou, jsme rádi že DVD aspoň přečteme 😀

Tak aspoň nějaké info pro internetové archeology z lsusb

Bus 001 Device 003: ID 13fd:2040 Initio Corporation Samsung Writemaster external DVD writer
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x13fd Initio Corporation
idProduct 0x2040 Samsung Writemaster external DVD writer
bcdDevice 6.06
iManufacturer 1 TSSTcorp
iProduct 2 USB Mass Storage Device
iSerial 3 SATAHH00000000<5 hex digits redacted>
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0020
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 2mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 5 SFF-8070i
bInterfaceProtocol 80
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered

V systému se mechanika identifikuje jako /dev/sr0.
cat /proc/sys/dev/cdrom/info

CD-ROM information, Id: cdrom.c 3.20 2003/12/17
drive name: sr0
drive speed: 48
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: 0
Can write MRW: 0
Can write RAM: 1

dvd+rw-mediainfo /dev/sr0

INQUIRY: [TSSTcorp][CDDVDW SE-S224Q ][TS02]
GET [CURRENT] CONFIGURATION:
Mounted Media: 10h, DVD-ROM
GET [CURRENT] PERFORMANCE:
Write Performance: 22.0x1385=30470KB/s@[0 -> 4090760]
Speed Descriptor#0: 08/2298496 R@16.0x1385=22160KB/s W@22.0x1385=30470KB/s
READ DVD STRUCTURE[#0h]:
Media Book Type: 00h, DVD-ROM book [revision 0]
Legacy lead-out at: 2062816*2KB=4224647168
DVD-ROM media detected, exiting...

První co mě napadlo bylo použít dd. Prostě jednoduché kopírování
dd if=/dev/sr0 of=~/Videa/DVD_01.iso
Ale ouha, dd se nám zastaví když narazí na chybu v kopírování a přeruší se. No nic. Zkusíme lepší dd
Nainstalujeme ddrescue

apt install gddrescue

Spustíme….

ddrescue -b 2048 -n -v /dev/sr0 dvd.iso rescue.log
# -b 2048 velikost sektoru ( lze zjistit fdisk -l /dev/sr0 ) výchozí pro DVD je ve většině případů 2048
# -n přeskočí scraping - https://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html#Algorithm
# -v je víc ukecaný
# /dev/sr0 - zdroj DVD
# dvd.iso kam chceme ulozit image - zde do adresáře - muze se pouzit absolutni cesta
# rescue.log log který vypisuje co se děje, ale je důležitý pro další zpracování - používá info které sektory nejde přečíst

Pokud to nepomůže a dostáváte stále errory, zkusíme přímý přístup na disk

ddrescue -b 2048 -d -r 3 -v /dev/sr0 dvd.iso rescue.log
# -d Přímý přístup čtení - obchází kernel
# -r 3 - opakuje 3x

A ještě můžeme zkusit číst médium pozpátku

ddrescue -b 2048 -d -R -r 3 -v /dev/sr0 dvd.iso rescue.log
# -R čte disk pozpátku

I přesto se mi však objevovaly chyby čtení a recovery nebyla 100%. Nakonec jsem našel a skončil u toolu dvdbackup který se normálně nainstaluje z repozitáře přes apt.

Prográmek mi nekončil na žádné chybě, vyextrahované soubory jdou přehrát. Vše OK.
Příklad výstupu grabu jednoho disku

dvdbackup -p -v -M -i /dev/sr0



File sizes for Title set 0 VIDEO_TS.XXX
IFO = 28672, MENU_VOB = 49686528
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 1 i.e. VTS_01_X.XXX
IFO: 34816, MENU: 15230976
VOB 1 is 769605632
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 2 i.e. VTS_02_X.XXX
IFO: 71680, MENU: 35481600
VOB 1 is 1073586176
VOB 2 is 1073623040
VOB 3 is 1035204608
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 3 i.e. VTS_03_X.XXX
IFO: 18432, MENU: 92160
VOB 1 is 171137024
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 4 i.e. VTS_04_X.XXX
IFO: 69632, MENU: 1067008
VOB 1 is 98828288
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 5 i.e. VTS_05_X.XXX
IFO: 30720, MENU: 83968
VOB 1 is 754819072
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 6 i.e. VTS_06_X.XXX
IFO: 36864, MENU: 41359360
VOB 1 is 962336768
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 7 i.e. VTS_07_X.XXX
IFO: 24576, MENU: 256000
VOB 1 is 329132032
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 8 i.e. VTS_08_X.XXX
IFO: 49152, MENU: 38268928
VOB 1 is 1073340416
VOB 2 is 708675584
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 9 i.e. VTS_09_X.XXX
IFO: 18432, MENU: 90112
VOB 1 is 75954176
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 10 i.e. VTS_10_X.XXX
IFO: 20480, MENU: 6707200
VOB 1 is 51980288
Bottom of loop
At top of loop
After opening files
After Menu VOB check
After Menu Title VOB check



File sizes for Title set 11 i.e. VTS_11_X.XXX
IFO: 14336, MENU: 0
VOB 1 is 9801728
Bottom of loop

libdvdread: Attempting to retrieve all CSS keys
libdvdread: This can take a _long_ time, please be patient

libdvdread: Get key for /VIDEO_TS/VIDEO_TS.VOB at 0x00000150
libdvdread: Elapsed time 1
libdvdread: Get key for /VIDEO_TS/VTS_01_0.VOB at 0x00006044
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_01_1.VOB at 0x00007d51
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_02_0.VOB at 0x0006396d
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_02_1.VOB at 0x00067d1a
libdvdread: Elapsed time 144
libdvdread: Get key for /VIDEO_TS/VTS_03_0.VOB at 0x001e333f
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_03_1.VOB at 0x001e336c
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_04_0.VOB at 0x001f7a02
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_04_1.VOB at 0x001f7c0b
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_05_0.VOB at 0x002038bc
libdvdread: Elapsed time 1
libdvdread: Get key for /VIDEO_TS/VTS_05_1.VOB at 0x002038e5
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_06_0.VOB at 0x0025d8ba
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_06_1.VOB at 0x0026279d
libdvdread: Elapsed time 1
libdvdread: Get key for /VIDEO_TS/VTS_07_0.VOB at 0x002d533e
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_07_1.VOB at 0x002d53bb
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_08_0.VOB at 0x002fc7a4
libdvdread: Elapsed time 1
libdvdread: Get key for /VIDEO_TS/VTS_08_1.VOB at 0x003010a2
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_09_0.VOB at 0x003d57b0
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_09_1.VOB at 0x003d57dc
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_10_0.VOB at 0x003de8ce
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_10_1.VOB at 0x003df599
libdvdread: Elapsed time 13
libdvdread: Get key for /VIDEO_TS/VTS_11_1.VOB at 0x003e58cf
libdvdread: Elapsed time 0
libdvdread: Found 11 VTS's
libdvdread: Elapsed time 161
Copying menu: 100% done (47/47 MiB)
Copying menu: 100% done (15/15 MiB)
Copying Title, part 1/1: 100% done (734/734 MiB)
Copying menu: 100% done (34/34 MiB)
Copying Title, part 1/3: 100% done (1024/1024 MiB)
Copying Title, part 2/3: 100% done (1024/1024 MiB)
Copying Title, part 3/3: 100% done (987/987 MiB)
Copying menu: 100% done (0/0 MiB)
Copying Title, part 1/1: 100% done (163/163 MiB)
Copying menu: 100% done (1/1 MiB)
Copying Title, part 1/1: 100% done (94/94 MiB)
Copying menu: 100% done (0/0 MiB)
Copying Title, part 1/1: 100% done (720/720 MiB)
Copying menu: 100% done (39/39 MiB)
Copying Title, part 1/1: 100% done (918/918 MiB)
Copying menu: 100% done (0/0 MiB)
Copying Title, part 1/1: 100% done (314/314 MiB)
Copying menu: 100% done (36/36 MiB)
Copying Title, part 1/2: 100% done (1024/1024 MiB)
Copying Title, part 2/2: 100% done (676/676 MiB)
Copying menu: 100% done (0/0 MiB)
Copying Title, part 1/1: 100% done (72/72 MiB)
Copying menu: 100% done (6/6 MiB)
Copying Title, part 1/1: 100% done (50/50 MiB)
Copying Title, part 1/1: 100% done (9/9 MiB)
Exit mobile version