83.1 Mass Storage Devices
The standard Mass Storage Device protocol is used for USB devices such as hard disk drives, flash memory drives, memory card readers, and digital cameras. Such devices often have a standard VFAT (MS/Windows) file system but can be formatted as ext3.
The USB mass storage device is treated as a SCSI device so simply mount the SCSI device:
# mount -t auto /dev/sda1 /mnt
You should now be able to see and use the device as any other disk.
If you already have a SCSI device then the USB device might be
/dev/sdc1, etc. Check the
dmesg command to find out (probably mentioned in the last
few lines after you plug the USB device in).
The kernel module usb-storage drives USB mass storage devices and should be automatically loaded by hotplug. The kernel module vfat is also required, and if it does not autoload then you will need to:
# modprobe vfat
A sample setup of four USB devices includes a USB mouse, HP
Printer/Scanner/Copier with a card reader, a digital camera, and a
flash memory drive (3System USB flash disk). The
/dev/sda1 /media/hpcard auto rw,user,noauto 0 0 /dev/sdb1 /media/camera auto rw,user,noauto 0 0 /dev/sdc1 /media/flash auto defaults,user,noauto 0 0
Then any user can mount, for example,
/media/hpcard, when a
memory card has been inserted into the card reader. A problem is that
unless the camera is connected before the flash drive after a reboot,
the mappings end up being reversed! A solution is to use
udev as described in Chapter ??.
The devices look like any other hard drive device so you can run fdisk on it and reorganise partitions:
# fdisk /dev/sdc
You can also format the partition(s) on the device with a DOS/FAT filesystem:
$ mkfs -t vfat /dev/sdc1
To format the partition(s) on the device with a standard GNU/Linux ext3 filesystem:
$ mkfs -t ext3 /dev/sdc1
83.1.1 WD My Book 1TB External Hard Drive
A 1 TB external hard drive was added to Belinos . The drive is a Western Digital, My Book, Essential Edition, External Hard Drive (WD10000H1U-0) purchased for AUD $200. The disk was originally formatted as vfat.
After connecting the drive via USB the dmesg command indicated the disk was identified as /dev/sdd1:
[79220.444200] usb 5-7: new high speed USB device using ehci_hcd and address 7 [79220.577219] usb 5-7: configuration #1 chosen from 1 choice [79220.586295] scsi4 : SCSI emulation for USB Mass Storage devices [79220.632108] usb 5-7: New USB device found, idVendor=1058, idProduct=1100 [79220.632116] usb 5-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [79220.632120] usb 5-7: Product: My Book [79220.632122] usb 5-7: Manufacturer: Western Digital [79220.632125] usb 5-7: SerialNumber: XXXX [79220.632921] usb-storage: device found at 7 [79220.632926] usb-storage: waiting for device to settle before scanning [79225.632271] usb-storage: device scan complete [79225.633026] scsi 4:0:0:0: Direct-Access WD 10EACS External 1.65 PQ: 0 ANSI: 4 [79225.740651] sd 4:0:0:0: [sdd] 1953525168 512-byte hardware sectors (1000205 MB) [79225.741863] sd 4:0:0:0: [sdd] Write Protect is off [79225.741871] sd 4:0:0:0: [sdd] Mode Sense: 21 00 00 00 [79225.741874] sd 4:0:0:0: [sdd] Assuming drive cache: write through [79225.743668] sd 4:0:0:0: [sdd] 1953525168 512-byte hardware sectors (1000205 MB) [79225.744771] sd 4:0:0:0: [sdd] Write Protect is off [79225.744777] sd 4:0:0:0: [sdd] Mode Sense: 21 00 00 00 [79225.744780] sd 4:0:0:0: [sdd] Assuming drive cache: write through [79225.744784] sdd: sdd1 [79225.759399] sd 4:0:0:0: [sdd] Attached SCSI disk
A mount made the disk available:
$ sudo mount /dev/sdd1 /mnt $ df -h . Filesystem Size Used Avail Use% Mounted on /dev/sdd1 932G 385M 931G 1% /mnt
The current contents (simple documentation and some trial applicaitons) were copied off of the drive to clear the way to reformat it for Linux.
The disk was unmounted, repartitioned, and a ext3 file system was written:
$ sudo umount /mnt $ sudo mkfs -t ext3 /dev/sdd1 $ sudo mount /dev/sdd1 /mnt $ df -h . Filesystem Size Used Avail Use% Mounted on /dev/sdd1 917G 200M 871G 1% /mnt
83.1.2 HP Photosmart 320
This camera has a USB connector and can be configured to be recognised as a mass storage device, as an alternative to using the Picture Transfer Protocol standard). Using it as a mass storage device is simple and after setting up the USB packages it all worked flawlessly. Create a mount point for the camera:
# mkdir /media/camera
The camera acts just like a mass storage device! Photos can be copied or cut from the appropriate folder and saved to your hard disk.
83.1.3 DVD Writer
Connect a Sony DRX-500ULX, DVD+/-RW+/-R to Debin GNU/Linux using USB. Plugging it in results in a coule of beeps as usbmgr recognises it. You can also run usbview or lsusb to check that it is properly recognised. The device will be treated as a SCSI CD so you should be able to mount it as:
# mount -t iso9660 /dev/scd1 /mnt
Create a specific mount point for it, such as
# mkdir /media/dvdrw
Add an appropriate line to your
/dev/scd1 /media/dvdrw auto defaults,user,noauto 0 0
With cdrdao and cdrecord the CD write functionality works just fine:
# cdrdao disk-info --device 4,0,0 --driver generic-mmc
For a DVD first create an image to burn on to the DVD.
# mkisofs -R -o cdimage.raw dvd/
Now install dvdrecord to write to a DVD-RW with:
# dvdrecord -v speed=2 dev=4,0,0 cdimage.raw
Note that dvdrecord does not appear to be actively maintained. Also, this dvdrecord command will fail for a DVD+RW (it only works for DVD-RW presently), so use the dvd+rw-tools instead. This package is actively maintained and also supports DVD-R(W). Format the DVD+RW with:
# dvd+rw-format /dev/scd1
Now growisofs is meant to work but failed with this particular drive with a message indicating that the drive does not support TAO (Track At Once) mode.
# growisofs /dev/scd1 -R -J dvd/
So instead use the pre-mastered CD image to burn the DVD+RW:
# growisofs -Z /dev/scd1=cdimage.raw
So, to recap, to burn a DVD+RW:
# mkisofs -R -o cdimage.raw dvd/ # dvd+rw-format /dev/scd1 # growisofs -Z /dev/scd1=cdimage.raw
Check out the -dvd-compat option as well
Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.