Obtaining original QNAP firmware
If you lost your backup of the QNAP firmware and want to restore the QNAP OS, you can extract the files from the Live CD that QNAP provides.
First, download the Live CD provided by QNAP.
You should have a file called live-cd-20130730.iso
or
live-cd-20140212.iso
(depending on your QNAP model).
You have to mount this ISO image. Within the ISO image, there is a Squash
image located at casper/filesystem.squashfs
. Loop mount that image and
you'll find images of the QNAP firmware under tftpboot
. Take the image
for your QNAP device.
sudo mkdir /media/qnap-cd /media/qnap-live
sudo mount -o loop,ro ~/Downloads/live-cd-20130730.iso /media/qnap-cd
sudo mount -o loop,ro /media/qnap-cd/casper/filesystem.squashfs /media/qnap-live
ls -1 /media/qnap-live/tftpboot | head -n 3
cp /media/qnap-live/F_TS-YOURMODEL_20130611-1.1.10.img ~
sudo umount /media/qnap-live
sudo umount /media/qnap-cd
Now you can extract the Linux kernel (mtd1
) and ramdisk (mtd2
) from the
QNAP image. You can do this with these commands:
dd if=F_TS-*_20130613-1.1.10.img of=mtd1 bs=1M skip=2 count=2 dd if=F_TS-*_20130613-1.1.10.img of=mtd2 bs=1M skip=4 count=9
Now you have mtd1
and mtd2
and can continue with the installation of QNAP OS.
Limitations
Historically, Debian only modified mtd1
and mtd2
. We never touched any
of the other MTD partitions.
However, some people use modified MTD partition layouts in order to run
newer versions of Debian. If you use that, you may need to extract other
files from the QNAP image and restore them. (Probably mtd3
.)
This is how the QNAP image is arranged:
Partition | Function | Size | Size (bytes) |
---|---|---|---|
mtd0 | U-Boot | 512 KB | 524288 |
mtd4 | U-Boot Config | 256 KB | 262144 |
mtd5 | QNAP Config (ext2) | 1 MB + 256 KB | 1310720 |
mtd1 | Linux kernel | 2.0 MB | 2097152 |
mtd2 | ramdisk | 9.0 MB | 9437184 |
mtd3 | ramdisk 2 | 3.0 MB | 3145728 |