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).

Here you can find a discussion about usb-storage module compiled without debugging enable. Download optimizing module here (firmware >=1.03).

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/sdc1 /mnt/HD_a2/usb_disc

If you don't want the whole drive in one share, you can add symbolic links to existing shares, that will take on their users and permissions. Mount the disc to a point that exists, but outside the shares, then add a link inside the share. In this example, there is a folder on the USB drive called “Public” and an already shared folder on the first hard drive called “Public/Share”. There will be a new “folder” (the link) created and it will be visible at “Public/Share/USB_Drive”.

# mount -t ext2 /dev/sdc1 /mnt/usb1
# cd /mnt/HD_a2/Public/Share
# ln -s /mnt/usb1/Public USB_Drive

You might need to chmod 777 or 755 your usb drive.

Unmount

If you want to safely unplug your USB harddrive, you can use the umount command (not unmount). It's probably a good idea to do this if you are turning off or restarting your DNS-323.

Example:

umount /dev/sdc1

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
  # wait a few seconds for the usb drive to be detected
  sleep 15
  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

Another useful extension would be automatic backup to a usb disk which afterwards can be carried off site.

Is it technically possible to use the USB to connect DNS-323 to PC, as an external USB hard drive? The reason to do this would be to get better throughput when playing HD movies in Windows. I understand DNS-323 is using EXT2 which is supported by Windows using ext2fsd (http://ext2fsd.sourceforge.net) or ext2ifs (http://www.fs-driver.org).

⇒ I think that would require the USB port to be working in host mode which I don't believe is electrically possible in this case.

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. You can get a working version from this post in the forum: ”ffp's fdisk dies with segfault

  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.


Navigation

Personal Tools