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