NSLU2-Linux
view · edit · print · history

HowTo.CustomSizedPartitions History

Hide minor edits - Show changes to markup

October 16, 2007, at 10:39 PM by lgv --
Added lines 74-78:

This trick will also help you to have more than three partitions in your root hard disk. An extra NTFS partition may come in handy in certain situations.

lgv

January 02, 2007, at 07:23 PM by cyanescent -- checked for reproducability.. and changed
Changed lines 59-60 from:

I had a similar problem to the above with a linksys 250Gb MyBook? Drive. After repartitioning, renaming /sbin/fdisk to /sbin/fdisk.old, and clicking format on the web interface, I similarly received an error when unslinging the drive. Checking the /sbin/unsling script gives a quick understanding why:

to:

I had a similar problem to the above with a WD 250Gb MyBook? Drive. After repartitioning, renaming /sbin/fdisk to /sbin/fdisk.old, and clicking format on the web interface, I similarly received an error when unslinging the drive. Checking the /sbin/unsling script gives a quick understanding why:

Changed lines 66-71 from:

Since I was using port2, $targ here is my /dev/sda1 mounted on /share/flash/data and $targconf is /dev/sda2 mounted on /share/flash/conf. I confirmed that these files had indeed not been created or copied. So somehow you need to get these files onto a newly partioned system.

So, to make things work, I unmounted /dev/sda1 and /dev/sda2, switched the 250Gb drive to port1, and replaced port2 with a spare USB pen. I renamed the /sbin/fdisk.old back to /sbin/fdisk, and using the web interface I formatted disk2 (the usb pen). Strangely, this procedure copied the correct file structure to both drives.

Finally, I unmounted everything I could find with the df command, unplugged the pen, and switched the 250Gb drive back to port 2, remounted /dev/sda1 on /share/flash/data and /dev/sda2 on /share/flash/conf. Now unslinging worked.

to:

Since I was using port2, $targ here is my /dev/sda1 mounted on /share/flash/data and $targconf is /dev/sda2 mounted on /share/flash/conf. I confirmed that these files had indeed not been created or copied.

To make things work, plug in a spare USB pen in the other port, rename /sbin/fdisk.old back to /sbin/fdisk, and using the web interface format the usb pen. Copy the files over to the original 250Gb drive. Double check everything is there, including hidden files (ie. use "ls -la"). My slug became increasingly confused at this point, and refused to copy 'en masse' at times (moving files helped, copying individually helped too)...

December 30, 2006, at 02:46 PM by cyanescent -- addendum to the problem
Added lines 56-75:

I had a similar problem to the above with a linksys 250Gb MyBook? Drive. After repartitioning, renaming /sbin/fdisk to /sbin/fdisk.old, and clicking format on the web interface, I similarly received an error when unslinging the drive. Checking the /sbin/unsling script gives a quick understanding why:

  ...
  echo "Checking that $targ has been properly formatted..."
  if ! [ -d $targ/public ] || ! [ -f $targconf/.dongle ] || ! [ -f $targconf/passwd ] ; then
  ...

Since I was using port2, $targ here is my /dev/sda1 mounted on /share/flash/data and $targconf is /dev/sda2 mounted on /share/flash/conf. I confirmed that these files had indeed not been created or copied. So somehow you need to get these files onto a newly partioned system.

So, to make things work, I unmounted /dev/sda1 and /dev/sda2, switched the 250Gb drive to port1, and replaced port2 with a spare USB pen. I renamed the /sbin/fdisk.old back to /sbin/fdisk, and using the web interface I formatted disk2 (the usb pen). Strangely, this procedure copied the correct file structure to both drives.

Finally, I unmounted everything I could find with the df command, unplugged the pen, and switched the 250Gb drive back to port 2, remounted /dev/sda1 on /share/flash/data and /dev/sda2 on /share/flash/conf. Now unslinging worked.

HTH

- Cyanescent

April 04, 2005, at 02:50 PM by AlbertSmith --
Added lines 27-30:

Be sure to change the permissions on the new fdisk:

 chmod 755 fdisk
February 28, 2005, at 03:17 AM by MTisza --
Added lines 41-51:

I have used the above instructions several times successfuly with usb flash drives, but when it came to a 250GB hard drive it failed. Immediately following the part where you tell the web interface to format the drive, it showed up as formatted in the web screen. However a df command shows that only the data partition is mounted. Unsling would then fail.

I was able to get custom partitions by backing up the files on a linksys formatted drive. Then using a SUSE linux box I partitioned and formatted the drive. I put all the linksys files back and everyone's happy now.

Note: The hidden files must also be copied. Specifically .dongle and .htpasswd in the conf partition.

-MTisza?

January 04, 2005, at 07:09 PM by tman --
Changed lines 7-8 from:

I wanted to use sda2 for storing my programs, configs etc. but I thought that 100 megabytes isn't quite much, as I probably want to try a lot of stuff, and I could also raise size of the swap partition to 64 megabytes at the same time. So I started my little project first with trying to unmount mounted partitions, then using swapoff /dev/sda3 and then trying to fdisk it. Well, the Linksys fdisk is modified and refuses to work properly, it complains that there are already 3 partitions on the disk and then exits. Tried to kill most of running processes as I thought that the disk device was still busy, but it didn't help me.

to:

I wanted to use sda2 for storing my programs, configs etc. but I thought that 100 megabytes wouldn't be sufficient as I wanted to try a lot of stuff. I also wanted to raise the size of the swap partition to 64 megabytes at the same time. So I started my little project first with trying to unmount mounted partitions, then using swapoff /dev/sda3 and then trying to fdisk it. SerComm/Linksys however has modified fdisk and it refuses to work properly, it complains that there are already 3 partitions on the disk and then exits. I tried to kill most of running processes as I thought that the disk device was still busy, but it didn't help.

January 04, 2005, at 07:05 PM by tman --
Changed line 1 from:

When formatting a harddisk with web interface, it creates 3 partitions to sda/sdb (a for usb port 1 or b for usb port 2).

to:

When formatting a hard disk with the Linksys web interface, it creates 3 partitions to sda/sdb (a for USB port 1 or b for USB port 2).

Changed line 8 from:

isn't quite much, as I propably want to try a lots of stuff, and I could also raise size of swap partition to 64megabytes at same time. So I started my little project first with trying to unmount mounted partitions, then using swapoff /dev/sda3 and then trying to fdisk it. Well, linksys fdisk is modified and refuses to work properly, complains that there has already been added 3 partitions to disk and then exits. Try'ed to kill most of running processes as I thought that disk device was still busy, but it didn't help me.

to:

isn't quite much, as I probably want to try a lot of stuff, and I could also raise size of the swap partition to 64 megabytes at the same time. So I started my little project first with trying to unmount mounted partitions, then using swapoff /dev/sda3 and then trying to fdisk it. Well, the Linksys fdisk is modified and refuses to work properly, it complains that there are already 3 partitions on the disk and then exits. Tried to kill most of running processes as I thought that the disk device was still busy, but it didn't help me.

Changed line 10 from:

Next thing was to back up all files on /dev/sda1 and /dev/sda2 and connecting this disk to my linux workstation and fdisk+format it there. I also copied my backed up files back to partitions. Then I connected it to my nslu but it didn't help me out, web interface told me that disk isn't formatted. I checked from shell that it is formatted and can be mounted also, but linksys firmware must have a checking procedure for that this disk is formatted by itself.

to:

Next thing was to back up all files on /dev/sda1 and /dev/sda2 and connect this disk to my Linux workstation and fdisk+format it there. I also copied my backed up files back to the partitions. Then I connected it to my nslu but it didn't help me out, the web interface told me that disk wasn't formatted. I checked from the shell that it was formatted and can also be mounted, but the Linksys firmware must check that it formatted it itself.

Changed line 12 from:

I then formatted disk, I was hoping that it wouldn't resize it back if it already contained 2 linux ext3 partitions + 1 linux swap. But it did resize them.

to:

I then formatted again disk via the web interface, I was hoping that it wouldn't resize it if it already contained 2 Linux ext3 partitions + 1 Linux swap. But it did resize them.

Changed line 14 from:

I connected my harddisk back to my Linux workstation, used fdisk to erase previous partition table and re-created my custom partition table, I didn't format disk. Just set /dev/sda1 and /dev/sda2 to Linux filesystem format and /dev/sda3 to Linux Swap format.

to:

I connected my hard disk back to my Linux workstation, used fdisk to erase the previous partition table and re-created my custom partition table, I didn't format the disk. Just set /dev/sda1 and /dev/sda2 to Linux filesystem format and /dev/sda3 to Linux Swap format.

Changed lines 16-17 from:

Next I connected my harddisk once again to NSLU and entered shell. I found fdisk command from /sbin and I renamed it:

to:

Next I connected my harddisk once again to the NSLU and entered the shell. I found fdisk command in /sbin and I renamed it:

Changed line 20 from:

and created a new fdisk, actually just a batch job, but it did the job and solved something to me that still was little unclear. Here's my new fdisk:

to:

and created a new fdisk, actually just a shell script, but it did the job and solved something for me that was still a little unclear. Here's my new fdisk:

Changed line 23 from:
 echo $1 $2 $3 $4 $5 >>/tmp/fdiskparams
to:
 echo $1 $2 $3 $4 $5 >> /tmp/fdiskparams
Changed lines 25-26 from:

It's a simple script which outputs commandline parameters 1-5 to file /tmp/fdiskparams. For e.g. fdisk hello world would append text "hello world" to our /tmp/fdiskparams.

to:

It's a simple script which outputs command line parameters 1-5 to file /tmp/fdiskparams. e.g. fdisk hello world would append text "hello world" to our /tmp/fdiskparams.

Then I went back to the web interface and tried to format again. I waited to see if it would complain about failed fdisk or that it would have an internal partition table modifier, but using

Deleted line 29:

Then I gone back to web interface and started format. I waited that it would complain about failed fdisk or that it would have internal partition table modifier, but using

Changed lines 31-33 from:

show'd me this:

to:

showed me this:

Changed line 37 from:

First line means that it used fdisk to clear partition table of parameters and then it started to edit partitions on second line. Output isn't shown because my script doesn't support catching stdin and redirecting it to file too. I thought that I could then use fdisk to partition my disk so I wouldn't need to connect disk to another workstation, but I was wrong. I tested this and fdisk won't let you use interface even with empty partition table.

to:

First line means that it used fdisk to clear the partition table and then it started to edit partitions on the second line. Output isn't shown because my script doesn't support catching stdin and redirecting it to a file. I thought that I could then use fdisk to partition my disk so I wouldn't need to connect the disk to a workstation, but I was wrong. I tested this and fdisk won't let you use the interface even with an empty partition table.

Changed line 39 from:

But now my NSLU was formatting disk and it had tryied to use fdisk. After formatting I was still worried about status of disk, if it after all checks sizes of sda2 and sda3, but it reported that disk is state is Formatted. I rebooted to make sure and yes, status still was formatted.

to:

But now my NSLU was formatting the disk and it had tried to use fdisk. After formatting I was still worried about status of disk, if it after all still checks sizes of sda2 and sda3 then it wouldn't work, but it reported that disk state was Formatted. I rebooted to make sure and yes, the status still was formatted.

Changed line 41 from:

If you proceeed with my instructions, remember to change fdisk.old back to fdisk in case it might be needed for something later.

to:

If you proceeed with my instructions, remember to change fdisk.old back to fdisk in case it is needed for something later.

January 04, 2005, at 06:42 PM by jake --
Changed line 23 from:
 !/bin/sh
to:
 #!/bin/sh
December 21, 2004, at 06:10 PM by jake --
Deleted lines 39-50:

Later on I was installing some packages to my NSLU and it hanged for unknown reason. I decided to re-install flash and after that it was saying that disk is not formatted. It was mounted properly and accessible from telnet without manual mounting, but interface detected some how that installation had been altered. Therefore, I won't recommend this for anyone who mainly uses NSLU to share files and using web interface for management. I have now again formatted my harddrive to NSLU standards. Hopefully someone will continue developing using of custom size partitions, since idea was quite good, to have everything under conf (including native developing environment) with some spare space and a few megabytes bigger swap.

December 21, 2004, at 03:50 AM by jake --
Changed lines 39-51 from:

If you proceeed with my instructions, remember to change fdisk.old back to fdisk in case it might be needed for something later.

to:

If you proceeed with my instructions, remember to change fdisk.old back to fdisk in case it might be needed for something later.


Later on I was installing some packages to my NSLU and it hanged for unknown reason. I decided to re-install flash and after that it was saying that disk is not formatted. It was mounted properly and accessible from telnet without manual mounting, but interface detected some how that installation had been altered. Therefore, I won't recommend this for anyone who mainly uses NSLU to share files and using web interface for management. I have now again formatted my harddrive to NSLU standards. Hopefully someone will continue developing using of custom size partitions, since idea was quite good, to have everything under conf (including native developing environment) with some spare space and a few megabytes bigger swap.

December 20, 2004, at 04:50 PM by jake --
Deleted line 0:
Changed lines 3-5 from:

/dev/sda1 fileshare partition, maximum diskspace that is left after sda2 & sda3 /dev/sda2 configuration partition/system file partition, approx. 100 megabytes. /dev/sda3 swap partition, 55 megabytes.

to:
 /dev/sda1 fileshare partition, maximum diskspace that is left after sda2 & sda3
 /dev/sda2 configuration partition/system file partition, approx. 100 megabytes.
 /dev/sda3 swap partition, 55 megabytes.
December 20, 2004, at 04:50 PM by jake --
Changed lines 1-40 from:

Describe CustomSizedPartitions here.

to:

When formatting a harddisk with web interface, it creates 3 partitions to sda/sdb (a for usb port 1 or b for usb port 2).

/dev/sda1 fileshare partition, maximum diskspace that is left after sda2 & sda3 /dev/sda2 configuration partition/system file partition, approx. 100 megabytes. /dev/sda3 swap partition, 55 megabytes.

I wanted to use sda2 for storing my programs, configs etc. but I thought that 100 megabytes isn't quite much, as I propably want to try a lots of stuff, and I could also raise size of swap partition to 64megabytes at same time. So I started my little project first with trying to unmount mounted partitions, then using swapoff /dev/sda3 and then trying to fdisk it. Well, linksys fdisk is modified and refuses to work properly, complains that there has already been added 3 partitions to disk and then exits. Try'ed to kill most of running processes as I thought that disk device was still busy, but it didn't help me.

Next thing was to back up all files on /dev/sda1 and /dev/sda2 and connecting this disk to my linux workstation and fdisk+format it there. I also copied my backed up files back to partitions. Then I connected it to my nslu but it didn't help me out, web interface told me that disk isn't formatted. I checked from shell that it is formatted and can be mounted also, but linksys firmware must have a checking procedure for that this disk is formatted by itself.

I then formatted disk, I was hoping that it wouldn't resize it back if it already contained 2 linux ext3 partitions + 1 linux swap. But it did resize them.

I connected my harddisk back to my Linux workstation, used fdisk to erase previous partition table and re-created my custom partition table, I didn't format disk. Just set /dev/sda1 and /dev/sda2 to Linux filesystem format and /dev/sda3 to Linux Swap format.

Next I connected my harddisk once again to NSLU and entered shell. I found fdisk command from /sbin and I renamed it:

 mv /sbin/fdisk /sbin/fdisk.old

and created a new fdisk, actually just a batch job, but it did the job and solved something to me that still was little unclear. Here's my new fdisk:

 !/bin/sh
 echo $1 $2 $3 $4 $5 >>/tmp/fdiskparams

It's a simple script which outputs commandline parameters 1-5 to file /tmp/fdiskparams. For e.g. fdisk hello world would append text "hello world" to our /tmp/fdiskparams.

Then I gone back to web interface and started format. I waited that it would complain about failed fdisk or that it would have internal partition table modifier, but using

 cat /tmp/fdiskparams

show'd me this:

 -d /dev/sda
 /dev/sda

First line means that it used fdisk to clear partition table of parameters and then it started to edit partitions on second line. Output isn't shown because my script doesn't support catching stdin and redirecting it to file too. I thought that I could then use fdisk to partition my disk so I wouldn't need to connect disk to another workstation, but I was wrong. I tested this and fdisk won't let you use interface even with empty partition table.

But now my NSLU was formatting disk and it had tryied to use fdisk. After formatting I was still worried about status of disk, if it after all checks sizes of sda2 and sda3, but it reported that disk is state is Formatted. I rebooted to make sure and yes, status still was formatted.

If you proceeed with my instructions, remember to change fdisk.old back to fdisk in case it might be needed for something later.

view · edit · print · history · Last edited by lgv.
Based on work by cyanescent, AlbertSmith, MTisza, tman, and jake.
Originally by jake.
Page last modified on October 16, 2007, at 10:39 PM