Custom Partitions on the LS Pro

How to get into EM Mode
Note that in the stock 1.03 firmware, you can enable telnet without going into EM mode. See How to enable telnet in EM Mode, below for details.

!WARNING! - THESE INSTRUCTIONS MAY NOT BE ACCURATE. SEE:[Repartitioning LS-PRO]
The LS pro has a mechanism built in to revert back to EM Mode if the box wasn`t able to boot three times in a row. Now we want to use this to force the box into EM Mode

Do this 3 times
1) Turn on your LS pro and hear the first sound. 2a) Stock initrd You will hear no second sound. Just go to 3 after 20 - 23 seconds 2b) lb_worm`s enhanced initrd (bundled with freelink/custom firmwares) The second sound is played after about 20 - 23 seconds. 3) Press the power button as long as it takes so the LS pro turns off. See also EM Mode how to exit EM Mode.

How to enable telnet w/ ACP Commander (both hddrootfs in EM Mode)
possibly if you use a newer ramdisk then telnet might run by default...then there is no need for using acp_commander. java -jar acp_commander.jar -t  -o
 * 1) download ACP Commander
 * 2) Stop the firewall
 * 3) change to the commandline (regardless if linux or windows) and execute the jar file with

you should see something like this:

java -jar acp_commander.jar -t 192.168.1.11 -o ACP_commander out of the nas-central.org project. Used to send ACP-commands to Buffalo linkstation(R) LS-PRO.

Using random connID value = FB6A7FCF57E6 Using target:  192.168.1.11/192.168.1.11 **no message** **no message** Password changed.

Now telnet is running and the root password is cleared in EM Mode. this change is non-persistent. if you reboot your box now, telnet wouldn`t run. you would have to use acp_commander again.

How to login in EM Mode with telnet
if you use dhcp then your box might even use dhcp in EM Mode...mine does. if you do not use dhcp you might have to change your static IP to one from the 192.168.11.x range. the LS Pro should respond to 192.168.11.150 1) execute  telnet  2) and login with "root" no password should be asked.

Partition Table before modification
1) use fdisk to partition /dev/sda, start with that and then look at the partitiontable by hitting "p" + enter fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start         End      Blocks   Id  System /dev/sda1              1          25      200781   83  Linux /dev/sda2             26          87      498015   83  Linux /dev/sda4             88       30401   243497205    f  W95 Ext'd (LBA) /dev/sda5             88         104      136521   82  Linux swap /dev/sda6            105       30401   243360621   83  Linux

Note: At least the V2 Linkstation Live (possibly all V2 devices) has a larger /boot partition (/dev/sda1):

Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start         End      Blocks   Id  System /dev/sda1              1          37      297171   83  Linux /dev/sda2             38          99      498015   83  Linux /dev/sda4            100       60801   487588815   5   Extended /dev/sda5            100         116      136521   82  Linux swap /dev/sda6            117       60784   487315678+  83  Linux

2) if you hit "m" you see a help.

so basically we want to have a bigger /dev/sda2 (/dev/sda4 + /dev/sda6 need to be smaller). this means we first have to delete all partitions except for /dev/sda1.

HowTo setup the internal HDD
Before you are going on and just do it the way it is posted here you should read
 * What are these partitions for?
 * Even more partitions, to ease your life (this is quite important)

Delete all partitions except /dev/sda1
warning if you delete all the partitions the box won't reboot anymore, you can destroy all the partitions except /dev/sda1

sh-2.05b# fdisk /dev/sda

The number of cylinders for this disk is set to 30401. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OS (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d Partition number (1-6): 2

Command (m for help): d Partition number (1-6): 4

Command (m for help): p

Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start         End      Blocks   Id  System /dev/sda1              1          25      200781   83  Linux

Create the custom partitions
Command (m for help): n Command action e  extended p  primary partition (1-4) p Partition number (1-4): 2 First cylinder (26-30401, default 26):   Using default value 26 Last cylinder or +size or +sizeM or +sizeK (26-30401, default 30401): +3000M

Command (m for help): n Command action e  extended p  primary partition (1-4) e Partition number (1-4): 4 First cylinder (392-30401, default 392):   Using default value 392 Last cylinder or +size or +sizeM or +sizeK (392-30401, default 30401):  Using default value 30401

Command (m for help): p

Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start         End      Blocks   Id  System /dev/sda1              1          25      200781   83  Linux /dev/sda2             26         391     2939895   83  Linux /dev/sda4            392       30401   241055325    5  Extended

Change Partition Type of Extended Partition to W95 Ext'd (LBA)
Command (m for help): t Partition number (1-5): 4 Hex code (type L to list codes): L

0 Empty           1c  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid 1 FAT12           1e  Hidden W95 FAT1 75  PC/IX           be  Solaris boot 2 XENIX root      24  NEC DOS         80  Old Minix       c1  DRDOS/sec (FAT-  3  XENIX usr       39  Plan 9          81  Minix / old Lin c4  DRDOS/sec (FAT- 4 FAT16 <32M      3c  PartitionMagic  82  Linux swap      c6  DRDOS/sec (FAT-  5  Extended        40  Venix 80286     83  Linux           c7  Syrinx  6  FAT16           41  PPC PReP Boot   84  OS/2 hidden C:  da  Non-FS data  7  HPFS/NTFS       42  SFS             85  Linux extended  db  CP/M / CTOS / .  8  AIX             4d  QNX4.x          86  NTFS volume set de  Dell Utility  9  AIX bootable    4e  QNX4.x 2nd part 87  NTFS volume set df  BootIt  a  OS/2 Boot Manag 4f  QNX4.x 3rd part 8e  Linux LVM       e1  DOS access  b  W95 FAT32       50  OnTrack DM      93  Amoeba          e3  DOS R/O  c  W95 FAT32 (LBA) 51  OnTrack DM6 Aux 94  Amoeba BBT      e4  SpeedStor  e  W95 FAT16 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs  f  W95 Ext'd (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  EFI GPT 10  OPUS            54  OnTrackDM6      a5  FreeBSD         ef  EFI (FAT-12/16/ 11 Hidden FAT12    55  EZ-Drive        a6  OpenBSD         f0  Linux/PA-RISC b 12  Compaq diagnost 56  Golden Bow      a7  NeXTSTEP        f1  SpeedStor 14 Hidden FAT16 <3 5c  Priam Edisk     a8  Darwin UFS      f4  SpeedStor 16 Hidden FAT16    61  SpeedStor       a9  NetBSD          f2  DOS secondary 17 Hidden HPFS/NTF 63  GNU HURD or Sys ab  Darwin boot     fd  Linux raid auto 18 AST SmartSleep  64  Novell Netware  b7  BSDI fs         fe  LANstep 1b Hidden W95 FAT3 65  Novell Netware  b8  BSDI swap       ff  BBT Hex code (type L to list codes): f Changed system type of partition 4 to f (W95 Ext'd (LBA))

Command (m for help): p

Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start         End      Blocks   Id  System /dev/sda1              1          25      200781   83  Linux /dev/sda2             26         391     2939895   83  Linux /dev/sda4            392       30401   241055325    f  W95 Ext'd (LBA)

Creating logical partitions for swap + data
Command (m for help): n Command action l  logical (5 or over) p  primary partition (1-4) l First cylinder (392-30401, default 392):   Using default value 392 Last cylinder or +size or +sizeM or +sizeK (392-30401, default 30401): +300M Command (m for help): n Command action l  logical (5 or over) p  primary partition (1-4) l First cylinder (429-30401, default 429):   Using default value 429 Last cylinder or +size or +sizeM or +sizeK (429-30401, default 30401):   Using default value 30401

Command (m for help): p

Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start         End      Blocks   Id  System /dev/sda1              1          25      200781   83  Linux /dev/sda2             26         391     2939895   83  Linux /dev/sda4            392       30401   241055325    f  W95 Ext'd (LBA) /dev/sda5            392         428      297171   83  Linux /dev/sda6            429       30401   240758091   83  Linux

Change partition type of swap partition to swap
Command (m for help): t Partition number (1-6): 5 Hex code (type L to list codes): L

0 Empty           1c  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid 1 FAT12           1e  Hidden W95 FAT1 75  PC/IX           be  Solaris boot 2 XENIX root      24  NEC DOS         80  Old Minix       c1  DRDOS/sec (FAT- 3  XENIX usr       39  Plan 9          81  Minix / old Lin c4  DRDOS/sec (FAT- 4 FAT16 <32M      3c  PartitionMagic  82  Linux swap      c6  DRDOS/sec (FAT- 5  Extended        40  Venix 80286     83  Linux           c7  Syrinx 6  FAT16           41  PPC PReP Boot   84  OS/2 hidden C:  da  Non-FS data 7  HPFS/NTFS       42  SFS             85  Linux extended  db  CP/M / CTOS / . 8  AIX             4d  QNX4.x          86  NTFS volume set de  Dell Utility 9  AIX bootable    4e  QNX4.x 2nd part 87  NTFS volume set df  BootIt a  OS/2 Boot Manag 4f  QNX4.x 3rd part 8e  Linux LVM       e1  DOS access b  W95 FAT32       50  OnTrack DM      93  Amoeba          e3  DOS R/O c  W95 FAT32 (LBA) 51  OnTrack DM6 Aux 94  Amoeba BBT      e4  SpeedStor e  W95 FAT16 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs f  W95 Ext'd (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  EFI GPT 10  OPUS            54  OnTrackDM6      a5  FreeBSD         ef  EFI (FAT-12/16/ 11 Hidden FAT12    55  EZ-Drive        a6  OpenBSD         f0  Linux/PA-RISC b 12  Compaq diagnost 56  Golden Bow      a7  NeXTSTEP        f1  SpeedStor 14 Hidden FAT16 <3 5c  Priam Edisk     a8  Darwin UFS      f4  SpeedStor 16 Hidden FAT16    61  SpeedStor       a9  NetBSD          f2  DOS secondary 17 Hidden HPFS/NTF 63  GNU HURD or Sys ab  Darwin boot     fd  Linux raid auto 18 AST SmartSleep  64  Novell Netware  b7  BSDI fs         fe  LANstep 1b Hidden W95 FAT3 65  Novell Netware  b8  BSDI swap       ff  BBT Hex code (type L to list codes): 82 Changed system type of partition 5 to 82 (Linux swap)

Command (m for help): p

Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start         End      Blocks   Id  System /dev/sda1              1          25      200781   83  Linux /dev/sda2             26         391     2939895   83  Linux /dev/sda4            392       30401   241055325    f  W95 Ext'd (LBA) /dev/sda5            392         428      297171   82  Linux swap /dev/sda6            429       30401   240758091   83  Linux

Saving the new partition table to the hdd
Command (m for help): w The partition table has been altered!

Calling ioctl to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks.

sh-2.05b#reboot

warning if you deleted all the partitions this reboot won't work. It will work only if you left /dev/sda1 untouched. You can destroy and resize all the other partitions.

firmware-update
choose a firmware of your choice and use the firmware updater to flash the image to the harddisk. you can choose to update the hddrootfs only if you use the debug-options of the firmware updater.

customized original firmwares
jtymods firmware or telnet enabled stock firmwares can format the hdd over the webinterface.

freelink

 * use mkfs.ext2/mkfs.ext3/mkfs.xfs to create the filesystem on /dev/sda6
 * use mkswap to create the swap filesystem on /dev/sda5
 * modify your /etc/fstab accordingly to the filesystem-type

Partitions after firmware update
i already started to untar the big tarball with all my LS-development stuff from the usbstick at /mnt/usbdisk2 to /mnt/ls_config. thats why /dev/ls_disk1_1 (=/dev/sda6) isn`T completely empty.

root@LS-PRO:~# df Filesystem          1k-blocks      Used Available Use% Mounted on /dev/sda2              2907124    183660   2723464   6% / /dev/ram1               15360        96     15264   1% /mnt/ram /dev/ls_disk1_1        194443     10384    174020   6% /boot /dev/ls_usbdisk2_1     991752    552268    389104  59% /mnt/usbdisk2 /dev/ls_disk1_6     240544192    234384 240309808   0% /mnt/disk1

What are these partitions for?
/dev/sda1: the partition which normally gets mounted to /boot. if this partition gets full you get this acp-error when you try to reflash the box (in that case you have to delete some old files of the hddrootfs there) /dev/sda2: here is the normal unpacked rootfs stored. in fact this is / while in hddrootmode. /dev/sda4: this is an extended partiton. it is just a container for /dev/sda5 + /dev/sda6 /dev/sda5: this partition is used for swap /dev/sda6: the partition which normally gets mounted to /mnt/disk1/ this is where all your shares + data is stored.

Even more partitions, to ease your life (sort of making the partition scheme future-proof)
Those who need it may create additional partitions at the end of the large data partition /dev/sda6, thus keeping the partitioning scheme as before up to this partition (might keep the firmware updater happy on future updates), and making the data saved on them persistent during future firmware or OS upgrades / changes, without having to backup everything. Of course, they are optional, you can certainly do without them, it's just a proposal. Even better, if you just create them while you still can (no data yet on the big partition) and just mount them when the time comes, it's just good practice to be prepared... /dev/sda7: While some users install an alternative firmware on the LSpro, if they choose a full OS like Debian or Gentoo, they might even want to use the box as a home LAN server, maybe with centralized authentication (for Linux and Windows via Samba + OpenLDAP). In that case, it's common to have the /home in Linux and also the Windows user profiles mounted from the server. It is then very advisable to have a separate partition on the server for this, which will hold user settings, important documents for few users in a household. Big files would be off-loaded to the large data partition anyway. You should know how big you'd make this partition, according to your needs. /dev/sda8: An extra partition for OS-es like Gentoo, in which to hold the whole package database files, downloads and binaries built on the poor LSpro, which would only bloat the root files system, and also in order to have them ready to use after a major Gentoo re-installation. Of course, if you don't create this partition, you can still use a symlink to a directory on your large data partition for this purpose. If you create it, well, a size of 3 to 4GB would be good, as you might want to export these directories to other Gentoo machines in your LAN, too. More info when the upcoming Genlink for LSpro is released.

what is the best way to backup the data from EM if you still have something important on your disk?
this was the case for me..i wanted to rescue the folder where i had all my linkstation-related stuff... GPL, compiled apps and so on. i only had a 1 GB USB-Stick, but this obviously also works with a big usbdisk. 1) while in EM Mode connect your usbstick/hdd to the LS Pro 2) create a linux partition on the usbstick/hdd fdisk /dev/sdb d n p 1      3) now you have a linux partition which covers the complete usb-disk/stick 4) create an ext2 filesystem on the disk (FAT is NOT supported by the kernel while in the Ramdisk) mkfs.ext2 /dev/sdb1 5) manually mount the usb-stick/disk to /mnt/usbdisk1  mount /dev/sdb1 /mnt/usbdisk1 6) mount the data partition of the internal hdd to /mnt/disk1 mount /dev/sda6 /mnt/disk1 7a) now you can copy all the things to the other disk with cp or mv cp /mnt/disk1/ /mnt/usbdisk1/  mv /mnt/disk1/ /mnt/usbdisk1/ you can use the -r switch for recursive as well.

7b) or use tar (this again is recursive): tar -czvpf /mnt/usbdisk1/ .tar.gz /mnt/disk1/

7c) or even use cpio and find; quick guide at: http://jeremy.zawodny.com/blog/archives/010037.html mkdir /mnt/usbdisk1/ cd /mnt/sda1 find . -print | cpio -Bpdumv /mnt/usbdisk1/

how do i read that linux usbhdd/usbstick i used for backup?
possibly you need to use fix_ext2_magic befor you are able to access... '!!We need to port fix_ext2_magic to arm9!!' (it isn`t able to compile on the LS pro currently) Windows: www.fs-driver.org or http://www.diskinternals.com/linux-reader/ Linux: just mount the ext2-filesysytem