So you have a Windows formatted USB drive and one of the following applies:
So is it possible?
Yes. Now, you need to get telnet access to the box. You have 2 basic choices:
Either way you need to get to a point where you have telnet access. I was in the position where I had a large and mostly full FAT32 USB drive, and a 64MB USB stick.
[WARNING: please note that FAT32 has a file size limit of 4GB, so if you plan to use your large USB drive to backup DVD iso images, or virtual machine images, the Windows client will give a confusing error, Samba will complain in the log files and no file will be created (ilg)].
If, during these procedures or examples, you come across errors or problems, refer to the excellent in-depth reference How To Mount FAT File Systems for more details and tips on how the problem might be solved.
I followed the RamHackU2 Project How-To procedures to boot from the flash stick, giving me telnet access.
1) Telnet into the NSLU2 as root:
> telnet 192.168.1.77
2) Now plug in your FAT32 drive. In my case I had to plug it into "Disk 1" since the USB drive only plugs into "Disk 2".
3) Now we need to create the mount point. Let's call it "hddvfat".
4) We now need to mount the FAT32 drive so that its files and folders are attached where we just created the mount point.
Note: use "sda1" if you have your drive attached to the "Disk 1" USB port. If the drive is attached to "Disk 2", then you may need to use "sdb1" instead.
Question: I have three VFAT partitions on the drive. Normally I would mount /dev/sda5 and /dev/sda6 just as described above, but there are no such devices on the slug. Can anyone fill in how to make the device nodes?. Thanks! -jsilence
Hello jsilence, I managed to get access to my fourth partition on my drive with the command "mknod /dev/sda4 b 8 4". In uNSLUng-3.16-beta this is no longer nessasary. But maybe it will help you! Conzi
5) OK we should now have the drive attached. Test this by typing the following:
You should get some output like the following:
drwxrwx--- 6 guest everyone 32768 Nov 20 2003 Backup drwxrwx--- 168 guest everyone 32768 Nov 20 2003 Download drwxrwx--- 37 guest everyone 32768 Nov 20 2003 Install drwxrwx--- 2 guest everyone 32768 Nov 20 2003 Movies drwxrwx--- 4 guest everyone 32768 Nov 20 2003 Music drwxrwx--- 18 guest everyone 32768 Nov 20 2003 Pictures drwxrwx--- 6 guest everyone 32768 Nov 21 2003 Recycled drwxrwx--- 3 guest everyone 32768 Jan 1 2004 System Volume Information
6) Great, so we have the drive installed, but if you attach to the SLUG from the Windows computer you will not see any share exposed. We now need to configure the SAMBA server to share out our newly mounted drive. So the first thing to do is to edit the configuration file. I did this by copying the file to the flash drive and editing it using textpad (http://www.textpad.com) in Windows which nicely preserves the CR which UNIX uses.
Now edit the configuration file and add a new section at the bottom as follows - you can replace the "FAT32HDD" with a name of your choosing for the SAMBA share:
Once this is edited, we need to save it and copy it back:
7) OK, now we have updated the configuration file, but we have to restart Samba to reload the configuration. We can do this easily by executing the start up script which will kill all the existing processes and restart the Samba processes.
That should be it! Connect to your slug again and see if the new share is visible!
Note: It will all be lost when the NSLU2 reboot, and you will have to do it all again. You may be able to write a script with a Hard-Drive plugged into "Disk 1", but I have found that the flash drive hack does not work if the NSLU2 boots with the FAT32 drive plugged into "Disk 1" - I have to plug it in after the boot has finished. Don't know why.
Note: The web interface will not register the drive as 'installed'. This should be expected. This procedure basically sidesteps the web configuration which does not deal with FAT32? drives. Therefore you will need to be careful not to format the drive etc by trying to 'install' it through the web interface. If it ain't broke - don't fix it!
Jan 22, 2005
Using Unslung v3.16 beta some of the above info is outdated.
Here is a brief outline of the process now.
1. Install Unslung firmware
2. Telnet into NSLU
3. Create mount point /share/hddvfat
4. Create /unslung directory (if does not exist)
5. Create rc.local file in /unslung directory and modify as follows
#! /bin/sh /bin/mount -t vfat /dev/sda1 /share/hddvfat > /dev/null /bin/mount -t vfat /dev/sdb1 /share/flash > /dev/null return 1
6. Create rc.samba file in /unslung directory and modify as follows
#!/bin/sh rm -f /etc/samba/smb.conf ln -s /opt/etc/smb.conf /etc/samba/smb.conf rm -f /etc/samba/smbpasswd ln -s /opt/etc/smbpasswd /etc/samba/smbpasswd return 1
7. Create /opt/etc directory (if does not exist)
8. Use smbpasswd -a to create the Samba users you need (skip if you do not want to enable security on your share)
9. Edit /etc/samba/smb.conf file as neeeded (at the very least you will need to create a share)
10. Copy /etc/samba/smbpasswd and /etc/samba/smb.conf files to /opt/etc
11. Reboot NSLU (type "reboot" without the quotes and hit enter)
March 21, 2005
The changes to smb.conf made according to the previous update will acually be lost after reboot. Apparently the file is being copied over from somewhere else. I've bypassed the problem by adding the new section to the file inline in the rc.samba:
#!/bin/sh cat <<! >>/opt/etc/smb.conf [FATDISK] valid users=@"administrators",@"everyone" comment= path=/share/hddvfat/ public=yes read only=yes write list=@"administrators",@"everyone" ! rm -f /etc/samba/smb.conf ln -s /opt/etc/smb.conf /etc/samba/smb.conf rm -f /etc/samba/smbpasswd ln -s /opt/etc/smbpasswd /etc/samba/smbpasswd return 1
Also, if your USB drive has multiple partitions the FAT32? partition may have an unexpected name, especially when it's a logical drive inside an extended partition. In my case it was sda5 (you can find out what it is by doing "fdisk -l /dev/sda"). The Unslung firmware only creates device nodes up to sda4 (or perhaps only for primary partitions), so you still may have to create sda5 node yourself (and they will be gone after reboot too). To automate this you can place the mknod command into rc.local before the mount command:
#! /bin/sh mknod /dev/sda5 b 8 5 mknod /dev/sdb5 b 8 6 /bin/mount -t vfat /dev/sda1 /share/hddvfat > /dev/null /bin/mount -t vfat /dev/sdb1 /share/flash > /dev/null return 1
I belive the partitions for the mount command should be /dev/sda5 and /dev/sdb5 in the rc.local. --Bill
A Personal Story
March 31, 2005
I wanted to have my drive be both compatible when plugged into a Windows box and fully unslinged to enable me to use several packages. To do this, I started with a new drive, so I didn't have any concerns about keeping data. I also don't care about Samba security, and this only deals with a drive plugged into Disk 1. Here are the main steps:
I will go through each of these.
First, you must do a full install of uNSLUng. This included letting the Linksys firmware format your drive, updating to the uNSLUng firmware and finally running the unsling command. This is all documented in the README that comes with the uNSLUng firmware. After you have done all of this, make sure you can still access the drives from your Windows box (over the network) and telnet into your slug.
Plug your freshly formated drive into your Windows box. No new drives will appear. Run PartitionMagic? (I used version 8.0). You should see the drive in the list. Right now it has three partitions; two Linux Ext3 and a Linux Swap. The first, and largest, is the data partition. The second is the conf, and the third just for swap. We are going to make the data partition smaller and create a new FAT32? partition. Right-click on the first partition and choose Resize/Move... When it comes up, you can make it smaller a number of ways, dragging the graph or with the text boxes. I chose to put the free space after the data partition, and it worked for me. When you are done, click OK. Right click in the newly created gray area and choose Create... Use this to make a new FAT32? (make sure it isn't another type!) partition. (Note: I used a 250GB drive and found that PartitionMagic? would only make a partition up to 196,600.1MB in size. So, I reduced the data partition down to only about 40GB and also made the conf partition slightly larger (to 1gb) so I can add more packages). When you have every thing looking good, click Apply. When done, PartitionMagic? should mount this drive in Windows. Go ahead and copy a small file to it. We will use this latter to make sure the drive is mounted on our slug.
Now that the FAT32? partition is made, we need to mount it. Get your slug up and running with telnet enabled and the drive attached (I highly recommend you use the March 29 information in ChangePasswordsFromTheCommandLine so you don't have to remove your drive and reboot every time you want to telnet). First, lets create a mount point for it:
Now, let's find out where our new partition is. Run this command:
fdisk -l /dev/sda
Here is the output I received:
Disk /dev/sda: 255 heads, 63 sectors, 30401 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/sda1 1 5200 41768968+ 83 Linux /dev/sda2 30264 30394 1052257+ 83 Linux /dev/sda3 30395 30401 56227+ 82 Linux swap /dev/sda4 5201 30263 201318547+ f Win95 Ext'd (LBA) /dev/sda5 5201 30263 201318516 b Win95 FAT32? Partition table entries are not in disk order
As you can see, I have my data (sda1), conf (sda2), swap (sda3), and the two Win95 partitions. Why are there two? Well, Windows needs a extended partition to enclose the FAT32? partition. Note they have the same Start and End blocks. We are interested in the Win95 FAT32? partition, which landed at
As there is not device node for
mknod /dev/sda5 b 8 5
(There's another experience regarding mknod below) With that done, we can now mount the drive:
mount -t vfat /dev/sda5 /share/hddvfat
This should be successful (no output from mount is good).
Now, even though it is mounted, it will be gone after a boot, and it isn't shared through samba right now, so you can't see it on your Windows box. To change this we need to add a couple of diversion scripts and update a config file.
Let's update the samba config file first. First we need to find it. cd to
In my case, the file was not editable from the windows box because only root had r/w access to it. In this case, change the file permissions (chmod) so that everybody can read and write to the file.
Add the following to the bottom of the
[FATDISK] valid users=@"administrators",@"everyone" comment= path=/share/hddvfat/ public=yes read only=yes write list=@"administrators",@"everyone"
Save that file. Now, from root, lets create a new directory
#! /bin/sh mknod /dev/sda5 b 8 5 /bin/mount -t vfat /dev/sda5 /share/hddvfat > /dev/null return 1
Now, if your device came up at a different location than
#!/bin/sh rm -f /etc/samba/smb.conf ln -s /myconf/smb.conf /etc/samba/smb.conf return 1
Reboot your slug, and you should have the new share FATDISK now visible on your Windows box!
Update: Experience with mknod
April 6, 2005
I have a 200 GB hdd and my partition is quite complex compared with the previous example. Though the principle is the same, I use the
# fdisk -l /dev/sdb Disk /dev/sdb: 255 heads, 63 sectors, 24321 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 1184 9510448+ 83 Linux /dev/sdb2 1276 24321 185116995 f Win95 Ext'd (LBA) /dev/sdb3 1210 1275 530145 82 Linux swap /dev/sdb4 1185 1209 200812+ 83 Linux /dev/sdb5 1276 8924 61440561 b Win95 FAT32? /dev/sdb6 8925 16573 61440561 b Win95 FAT32? /dev/sdb7 16574 24321 62235778+ b Win95 FAT32? # ls -l /dev/sdb* brw-rw-r-- 1 root root 8, 16 Jan 1 1970 /dev/sdb brw-rw-r-- 1 root root 8, 17 Jan 1 1970 /dev/sdb1 brw-rw-r-- 1 root root 8, 18 Jan 1 1970 /dev/sdb2 brw-rw-r-- 1 root root 8, 19 Jan 1 1970 /dev/sdb3 brw-rw-r-- 1 root root 8, 20 Jan 1 1970 /dev/sdb4
mknod /dev/sdb5 b 8 21 mknod /dev/sdb6 b 8 22 mknod /dev/sdb7 b 8 23
October, 3, 2005
(As my primary interest in Unslung was to enable FAT32? I did not yet take the plunge here, though I greatly apprecite the project and would like to migrate some day soon and take a deeper look at the free Linux on the nice little box.)
Any comments from the "powers that be" ?
December 12, 2005
I loaded the latest firmware from LinkSys?, which supports FAT32? (and NTFS). I had an existing 160 GB partition with 3 FAT32? and 1 NTFS partition. While the NSLU2 was up and running, I plugged in the drive and within a minute all the partitions were mounted. I went to \\192.168.1.77 and saw each partition available as a share
hdd_1_1_1 -> First partition on the HD
hdd_1_1_4 -> Fourth partition on the HD
yes, that's right. I also have a 160 GB drive (it has one big FAT32? partition) and with the linksys r63 firmware, I can hotplug it in and out as many times as I want -- it'll always get mounted. Today I tried the latest Unslung-6.x which is based on linksys r63 -- and FAT32? didn't work. It said "not formatted". Now I am using r63 again. [Apu]
UPDATE: I managed to resolve this issue. Turned out that it was related to Language Support. Make sure you read this. [Apu]
view · edit · print · history · Last edited by MarkHu.
Based on work by Liviu Ionescu, Apu, apu, RajuS, mschnell, rwhitby, tman, Dries, MattMcNeill, phoenich, jwhite, Bill, igor, thegman, DaveHooper, ConziAtWork, jsilence, MattMcN, ka6sox, and StE.
Originally by MattMcN.
Page last modified on September 20, 2008, at 10:55 AM