Score:0

How do I copy the contents of a CD sequentially vs disconnected reads?

pa flag

I have a series of DVDs of about 5GB each which are being copied onto a Ubuntu machine using a Dell DW316 reader to then be virus scanned with clamAV-daemon. Currently, this is very slow, running at only about 500KB / second, and I've been tasked to speed this process up.

My first thought was to copy to a ramdisk instead, using sudo mount -t tmpfs -o size=10G ramdisk /mnt/ramdisk as once a DVD is finished scanning I can eject it, delete everything from /mnt/ramdisk, and insert another, with copying to RAM being much faster. This seems to work for most of the DVD, reading at 10MB/s, but once the cp command gets a folder of .rpm files, reading appears to slow down extremely to short bursts of 200KB / second.

This is known because cp starts to throw error cp: error reading 'path/to/file': Input/Output error on these larger .rpm files, and IOtop shows a considerable slowdown.

I was told by a more senior engineer that this might be due to the cp command reading files disconnected as they're copied instead of sequentially, and the slowdown may be due to the movement of the laser reader seeking data on larger files.

Is there any way to modify the cp command or similar to read sequentially, since the entire disk is being copied?

Also, the ramdisk method seems to work as once the disk is finally copied clamAV-daemon can scan from ram in seconds versus 1+ hours directly from mounting the DVD. I'm just struggling with copying to ram.

I've tried mounting via ramdisk using the command sudo mount -t tmpfs -o size=10G ramdisk /mnt/ramdisk and copying using sudo cp /media/scanPC/disk/ /mnt/ramdisk/ Transfer speeds seem great working with small folders and files, but there's a folder containing .rpm files that it seems to slow down considerably on.

UPDATE: I've copied the file using dd and mounted it on a loop:

$: sudo dd if=/dev/sr0 of=/mnt/ramdisk/diskimage
$: losetup --partscan --find --show /mnt/ramdisk/diskimage
$: mount /dev/loop0 /mnt/image

And while this did provide a considerable performance increase, now clamAV is having difficulties scanning any of the .rpm files giving: /path/to/.rpm: Can't read file ERROR

guiverc avatar
cn flag
No OS or product is actually mentioned; however Ubuntu does not use RPM files so why ask here? Please refer https://askubuntu.com/help/on-topic, Ubuntu and *official* flavors of Ubuntu (https://ubuntu.com/download/flavours) are on-topic on this site. The on-topic link provides alternate SE sites for non-Ubuntu OSes.
Zane E. avatar
pa flag
The machine is running Ubuntu 22.04, and the disks I'm attempting to read from contain .rpm files as well as many other files
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.