NSLU2-Linux
view · edit · print · history

[WORK IN PROGRESS!]

I was pretty impressed with my slug, especially with the Unslung firmware installed :)

One thing I wasn't happy about though is that data copied onto the shares is stored in a linux-formatted data (ext3) partition.

I wanted to include to have a big data partition that was NTFS-formatted, basically so that if I ever want to I can plug the drive straight into the usb port of a windows PC and access the data.

(It should be noted that installing a kernel-mode ext2 driver for Windows will negate the need for this procedure. Check out http://www.fs-driver.org)

I found UpgradeUnslungHardDriveEntirelyInXP slightly useful but I wasn't wanting to use a PC or PartitionMagic?.

Instead I used fdisk on the slug to create the partition table I wanted. (Note that I wasn't bothered about anything on my hard drive so I wan't trying to preserve anything. Obviously you may want to back stuff up to another USB hard drive or flash disk or copy it off using a network share. Note also that these instructions are written as if your hard disk is connected to usb port 2 of the slug and so is identified as disk2 and sda, since that is the normal set up for the cuurent (6.8beta) version of unslung - and it's how I had mine set up..)

STEP 1: FDISK

A slight complication is that the fdisk that is provided by default didn't seem to be fully functional. So I used the method mentioned in UseAMemoryStickAsMainDrive (installing busybox 1.0 to get the proper version of fdisk).

This means an 'ipkg update' and 'ipkg install busybox' (actually I just did 'ipkg install busybox-base', see BusyBox).

NOTE: This may not work if you are running from internal flash. I actually did this having already unslung to a my hard drive previously.

Anyway, having got busybox set up, I then used the command:

/opt/bin/busybox fdisk /dev/sda

to fire up fdisk and get the fdisk command prompt. Entering 'p' confirmed the existing partition table was set up in the standard way done by the format button on the Linksys web interface. This was:

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1 1 36453 292808691 83 Linux
/dev/sda2 36454 36468 120487+ 83 Linux
/dev/sda3 36469 36483 120487+ 82 Linux swap

So most of the space was being used for sda1, the linux-formatted data partition. I wanted to make this partition 5gb (allowing plenty of space for unslung stuff), and make sda2 (the conf partition) 2gb. I chose to make my swap partition (sda3) 128 megs. This left me most of the disk for my new NTFS partition.

The partition structure I went for was similar to the one shown in UpgradeUnslungHardDriveEntirelyInXP:

[5gb linux, sda1] [292gb extended, sda4 (containing 292gb NTFS, sda5)] [2gb linux, sda2] [128mb swap, sda3]

So I set about making this - (the 'd' command to delete each of the 3 existing partitions, then n to create the new partitions and 't' to set their types.)

My completed table was as follows (note the block numbers indicating that the physical arrangement of these is sda1, sda4(sda5), sda2, sda3 - as mentioned above.

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1 1 654 5253223+ 83 Linux // DATA 5GB
/dev/sda2 36204 36465 2104515 83 Linux // CONF 2GB
/dev/sda3 36466 36483 144585 82 Linux swap // SWAP 128MB
/dev/sda4 655 36203 285547342+ 5 Extended // Container for NTFS (REST)
/dev/sda5 655 36203 285547311 7 HPFS/NTFS // NTFS

I then wrote this new table('w').

The next job was to unsling again, but first the new data and conf (sda1 and sda2) partitions needed to be formatted (as did the swap partition).

STEP 2: FORMATTING

I tried just doing a mkfs.ext3 on /dev/sda1 and /dev/sda2 and mkswap on /dev/sda3 BUT this didn't work. For the unslinging to work, the partitions need to have been formatted using the format button on the Linksys web interface.

However the problem is that if you use that handy format button, it just erases the partition table and recreates the three partitions we started out with. I found a really useful workaround to that here CustomSizedPartitions.

The method is: 1. Reboot the slug. Either start it up without the hard disk connected or just leave it connected. In either case the slug should start up in 'running from internal flash' mode since you no longer have it unslung since the repartitioning. 2. Now rename the file /sbin/fdisk to something else:

 mv /sbin/fdisk /sbin/fdisk.old

3. Now create a shell script called fdisk in the /sbin/ directory (just create a text file called fdisk with vi containing the single line #!/bin/sh) 4. Make the shell script executable: chmod 755 fdisk

So having done this I used the Linksys web interface to do the formatting safe in the knowledge that it would just format the existing sda1,2 and 3 partitions rather than repartitioning and starting from scratch.

Now you can delete the shell script (rm /sbin/fdisk) and restore the orginal fdisk (mv /sbin/fdisk.old /sbin/fdisk).

STEP 3: UNSLING!!

Now that the hard disk has been partitioned and properly formatted, you can unsling to it (/sbin/unsling disk2).

When that's done you can reboot and the slug should start up in unslung mode.

STEP 4: FORMAT THE NTFS PARTITION

I just connected the hard disk to my windows PC to format the NTFS partition.

STEP 5: Ensure the NTFS Partition is mounted and shared

[This is where I am up to now. It seems at present that NTFS is only supported on USB Port 1 so the NTFS partition is not mounting. The obvious answer is to start this procedure again from Step2, with my disk connected to Port1. This isn't ideal though, as it wastes the more flexible Port1 on my main disk, meaning I can never use a USB hub. I may end up just doing this though as I have no need to connect more than one additional device at present.]

view · edit · print · history · Last edited by devilbush.
Originally by Jon.
Page last modified on November 10, 2006, at 06:30 PM