NSLU2-Linux
view · edit · print · history

Initializing Disks

Before proceeding with package installation you must connect a hard disk where the root file system will be stored.

A very good idea is also to add some swap space.

Creating partitions

Connect your hard disk to your USB port 1. Please make note that the following commands will wipe out your disk.

  1. Run the fdisk command with the following syntax: fdisk /dev/sda. We're assuming that the disk is recognized as sda in this case. Note the device name has no number. We're referring to the entire disk, not specific partitions.
  2. Execute the command p. This will show the available partitions. You can keep them, or delete them with the d command.

If deletion of partitions is not in your plans stop here and decide what to do. The following instructions is for starting a whole new disk.

  1. Create a new primary partition number 1. Fdisk will ask for the start cylinder (1) and the end cylinder (depending on the disk size). I've chosen 3000M. This will create a 3GB sda1 partition.
  2. Create a new primary partition number 2. Fdisk will give the available first cylinder, just accept it, and choose a size of 768M. This will be our swap partition (Very, very large).
  3. Create a new primary partition number 3. Use the remaining disk space.

Now we need to change the partition two to be a swap partition. Execute the t command. Chose partition number 2 and enter hex code 82 (LINUX Swap).

With the command p verify your work. You should have something like this:
Disk /dev/sda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 366 2939863+ 83 Linux
/dev/sda2 367 460 755055 82 Linux swap / Solaris
/dev/sda3 461 3648 25607610 83 Linux

Write the partition table with the w command and REBOOT

Initializing disks

After rebooting execute the following commands:

  1. You may have to unmount /dev/sda1 first: umount /dev/sda1
  2. Create root file system: mkfs.ext3 /dev/sda1
  3. Create swap space: mkswap /dev/sda2
  4. If necessary, use this swap space now: swapon /dev/sda2 (see Note below)
  5. Create the home file system: mkfs.ext3 /dev/sda3 [This will take longest.]
Note! If you have very large partitions the mkfx.ext3 command may result in the following error
Memory allocation failed while setting up superblock
To fix this, wait to run the command until you have a running swap partition to handle the command.

Reboot again.

Moving root file system

Now you can move the root file system from flash to disk. Execute the command turnup disk -i /dev/sda1 -t ext3 Further details on using turnup are on the OpenSlug.OpenSlugTurnUp page.

Reboot again

Finishing up

Now all you need is to activate the swap partition and mounting automaticaly the /home file system.

  1. Execute the command: swapon /dev/sda2

Note: It seems here is a bug in the 3.10 release that prevents the swapon command to successfully complete. All is fine in release 2.7. Note: There is no bug in 3.10. The slug is already swapping the directory. Execute the command: swapon -s to verify.

  1. Edit the /etc/fstab file
  2. Add the following line at the end: /dev/sda3 /home ext3 defaults 1 1
  3. Add the following line at the end: /dev/sda2 swap swap defaults 0 0

One final reboot to see if everything is ok, and the mount command should report all the partitions created.

Thats it. Now you can proceed installing packages do anything you want.

view · edit · print · history · Last edited by whyme.
Based on work by cnczane, Giovambattista Matera, Dan Händevik, tim, JNC, rwhitby, sunburnt, admiraljkb, and thx1011.
Originally by thx1011.
Page last modified on October 19, 2008, at 12:47 PM