Restoring Stock Firmware without TFTP

Notes before you begin
This process has been confirmed to work on virtually every model of ARM based Linkstation/Terastation. There are some slight variations for some devices which will be called out in the instructions and/or mentioned on the page for the individual device.

For Intel-based devices the process involves creating and then booting from a usb recovery disk. Information about creating a recovery disk can be found here: Create Recovery Disk for Intel-based Terastation

Some devices have a built in method for installing the firmware from their on-board NAND flash which is typically easier that following this method. Check the wiki page for the device and/or the user's manual to see if that option is available to you.

For best results start with completely blank drives. It is usually sufficient to prepare one drive as described below and leave the others completely blank.

Most multi-bay devices won't install the firmware successfully without a certain number of drives present. I haven't investigated every combination of model and number of disks, but generally:
 * 2-bay usually require a drive in both bays
 * 4-bay models vary (some share firmware with 2-bay models and will accept 2, others won't)
 * 6-bay and 8-bay models usually need a minimum of 4 drives.

Note: Some 2-bay models may incorrectly set their number of drives as 4 and refuse to install with only 2 drives (TS1200, TS-WVHL and possibly others). To correct this or if you just want to set up the device with less than the maximum number of drives you can run the following command via ACP Commander when the device is in EM Mode before you start the install: java -jar acp_commander.jar -t -c "echo MAX_DISK_NUM=2 >> /etc/nas_feature" This will only affect the current EM Mode session and has no permanent affects on the device.

https://forums.buffalotech.com/index.php?topic=38569.msg111977#msg111977

Once the firmware is installed most devices are perfectly happy running with just 1 disk if that's what you want.

'''Recent versions of the firmware updater have removed the re-partitioning feature. You can manually trigger that process by calling the underlying script directly with ACP Commander:''' java -jar acp_commander.jar -t -c "/usr/local/bin/create_partition.sh"

There is a minimum disk size which is different for different models. This isn't usually a problem since the minimum is usually much smaller than one would typically use with a NAS. For example I found that most older devices will happily install their firmware on 32GB SSD but not a 16GB SSD, for many newer devices I found even that didn't work for testing.

Obtain the boot files for your device
see Extract Boot Files from Stock Firmware

Prepare the hard drive
These steps currently assume that you're running a Linux system such as a Debian Live EnvironmentDebian Live environment. All of these command need to be run as root (or using sudo).

Some folks have had success doing this under windows using ext2fsd. I have not found anything similar for OSX.

Another solution for either OS would be use VirtualBox to boot a Linux VM and allow it access to the hard drive to perform the steps, though just booting into a USB drive may be simpler at that point.

create a partition table
All except the very oldest devices work with GPT partition tables, I believe MBR will work for all devices as well. The partition table can be created by whatever tool you prefer (fdisk,gdisk,parted etc).

create partition1
The process of installing the firmware will repartition the drives and reformat the drives, as a result the exact partitioning isn't vital as long the device can boot from it. Create a partition that is:
 * The first partition on the drive
 * 1GB or less (some older device seem to work better with 512MB, most will except 1 GB)

format partition1 as ext3
Newer versions of linux have started using a default inode size of 256 but some of the older devices can only read filesystems with an inode size of 128 (ex. Linkstation Pro (Ls-GL), Terastation-II Pro, Terastation-III and most older devices). This can be set with the following command:

mkfs.ext3 -I 128 /dev/sdx1

copy the boot files to the drive
The files are typically named uImage.buffalo and initrd.buffalo. Sometimes files for multiple devices are included in a firmware package, usually you can determine which one is for your device and rename it appropriately. In the case of the Terastation ES the device actually boots from "uImage-88f6281.buffalo".

mount the ext3 filesystem you created, ex:

mkdir /mnt/buffalo mount /dev/sdx1 /mnt/buffalo

Then copy the boot files you extracted earlier to it: cp *.buffalo /mnt/buffalo

Boot the device
Insert the drives into the device and power it on, after a few minutes it should boot into "EM mode".

Some devices seem to require that the drive with the boot files is drive 1 though if all the other drives are blank they will almost always find the correct drive.

Enable Debug Options in firmware updater
see LSUpdater/TSUpdater

Install the Firmware
It should find the device in EM mode. go to the debug menu and check the boxes as described in (I typically just check them all if starting with a blank drive) :

https://herzig-net.de/?page=unbrick_ls-wxl

With any luck the firmware install will succeed and the device will boot up after about 10 minutes.