This is an old revision of the document!
HOWTO Mount an External USB Disc
The DNS-323 does not support external discs, but a small hack allows you to use them on the unit anyway. Before you even try this, you need to have telnet access to your device.
Note: If you're a linux newbie and the steps below are too difficult for you, there is more background information and a set of “steps for dummies” to connect external USB drives to the DNS-323 at Attaching USB Storage to the DNS-323 for Linux Newbies & Dummies.
WARNING
I just want to issue a small warning here as we currently don't know what happens when the unit is powered down. There is a risk that connected USB discs are not unmounted properly at shutdown or reboot.
Load USB Storage Module
The first thing you need to do is to add an extra module to your system. Paul has been so kind that he has produced such a module for you to download for v1.03 (working for 1.04 too).
Store that file somewhere on your disc, e.g. in the ../lnx_bin/.. directory of your unit. Next step is to telnet to the device and load the module to the kernel:
# cd /mnt/HD_a2/lnx_bin # insmod usb-storage.ko
Then plug your USB disc into the USB slot and watch your system log, i.e. issue command dmesg
. It'll look something like this:
Initializing USB Mass Storage driver... scsi4 : SCSI emulation for USB Mass Storage devices Vendor: LEXAR Model: GEYSER JUMPDRIVE Rev: 1.00 Type: Direct-Access ANSI SCSI revision: 02 SCSI device sdc: 1001952 512-byte hdwr sectors (513 MB) sdc: assuming Write Enabled sdc: assuming drive cache: write through sdc: sdc1 Attached scsi removable disk sdc at scsi4, channel 0, id 0, lun 0 Attached scsi generic sg2 at scsi4, channel 0, id 0, lun 0, type 0 USB Mass Storage device found at 2 usbcore: registered new driver usb-storage USB Mass Storage support registered.
Please note the 'sdc' above as it might differ when you insert your disc. Use your device.
Explicit Export
Next step is to create a mount point for the disc and to mount it:
mkdir /mnt/ext mount -t vfat /dev/sdc1 /mnt/ext
Please note the -t vfat
here as it is a FAT volume in this example.
Example of mount for external drive with one ext2 partition:
mkdir /mnt/usb1 mount -t ext2 /dev/sdc1 /mnt/usb1
If you also want to share this disc to your other computers you'll have to make it visible through samba. Edit the /etc/samba/smb.conf
file and add the following:
[EXT_1] comment = External VFAT Disc path = /mnt/ext valid users = read only = no guest ok = yes
After this, restart the samba deamon using the command:
# smb restart
.
Implicit Export
If you don't want to go all the trouble editing samba files and restarting samba server you can instead create the mount point on an already exported disc:
# mkdir /mnt/HD_a2/usb_disc # mount -t vfat /dev/sdc /mnt/HD_a2/usb_disc
Fun_plugging
And; you can of course do all this in your fun_plug. The following is the contents of of a fun_plug which resides on a machine which has two external USB discs and a printer connected through a USB hub:
# # fun_plug for sharing two external USB Discs # DIR=/mnt/HD_a2 if [ ! -d lnx_bin ] then exit 0 fi if [ -f $DIR/lnx_bin/usb-storage.ko ] then insmod $DIR/lnx_bin/usb-storage.ko dmesg > $DIR/lnx_bin/logs/dmesg.out mkdir $DIR/usb_120 mkdir $DIR/usb_240 mount /dev/sdc1 $DIR/usb_120 mount /dev/sdd1 $DIR/usb_240 fi
Proposed Functionality
An obvious (and very useful) extension to the work you guys have put into USB functionality would be a plugin which automatically copies the entire contents of a USB stick to a directory on the drive. It would be pretty simple to code, I imagine
Partitioning and formating of external hard disk drives
The external drives need to be partitioned and the partition which should be mounted needs to be formated with one of the possible file systems, i.e. EXT2, FAT16, FAT32 or NTFS. If your drive isn't already partitioned or formated as needed there are the following possibilities to achieve this need:
1. Connect the drive to a linux pc and partition and format it there, using i.e tools like GParted.
2. Partitioning and formating can even be done with the DNS323 itself in a telnet session using the command line tool fdisk. Please be very careful with this tool, because if used wrongly you could lose all your data. You need an up to date version of the fdisk tool; otherwise, you may get a segmentation fault.
fdisk /dev/sdX # with X standing for "b" or "c" (one or two internal disks)
Take a look at your internal disks /dev/sda or /dev/sdb as a reference and exit with “q”. You may want to create a linux partition (partition type 83) similar to the internal drives. If you want to format a partition with EXT2 filesystem, use
mke2fs /dev/sdXn # with X standing for "b" or "c" and n being a number 1,2,...
After partitioning and formating you can check you partition with e2fsck /dev/sdXn
Finally, try to mount the newly created partition.