0

I asked this question over at StackOverflow and have been advised to better put it in here.

I recently bought a QNAP TS-431K NAS, installed 4 harddisks and set it up as a RAID. Then I configured the network etc. and installed some packages. This works very well, so far. I want to automate some things with Python, but the device resets its internal filesystem on every reboot, so I need to put my Python scripts onto the RAID volume, but in order to start them at bootup, I need to change a certain autorun.sh, which I cannot access.

According to this QNAP Wiki page (section "All HAL-based Intel and AMD NAS" fits to my case, my OS is QTS 4.5.2) I need to mount a device that is dynamically obtained by the given command (I'll also add the expanded line below) into /tmp/config. There I would be able to edit the file, but mounting fails. Here the command:

mount $(/sbin/hal_app --get_boot_pd port_id=0)6 /tmp/config
# "$(/sbin/hal_app --get_boot_pd port_id=0)6" expands to "/dev/mtdblock6"

Output:

mount: you must specify the filesystem type

This error is totally reasonable, as -t <type> is missing in the example. So I tried to find information about the filesystem that is used. The filesystem ext2 from the other examples didn't work. Unfortunately I had no luck, so far, so I listed the available filesystems with cat /etc/filesystems, which gave me:

ext3
ext2
nodev proc
nodev devpts
iso9660
vfat
msdos
hfs

proc and devpts would work in a sense that there is something visible at /tmp/config, but these are no real filesystems and iso9660 is for optical media. Any other filesystem says:

mount: wrong fs type, bad option, bad superblock on /dev/mtdblock6
...

So then I tried to analyze the device with fdisk -l /dev/mtdblock6, which said:

Disk /dev/mtdblock6: 15 MB, 15728640 bytes
255 heads, 63 sectors/track, 1 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock6 doesn't contain a valid partition table

So I assume, there is nothing there, yet. As there is no such thing as a /dev/mtdblock without a number or letter at the end, I assume I would have to create a partition table, a partition and an ext2 filesystem on it. I still couldn't figure out what it is with /dev/mtdblock0 through /dev/mtdblock5.

So my questions are:

  • Do I need to format that device under /dev/mtdblock6 and just add the autorun.sh?
  • Is ext2 here suitable or do I have to use a different filesystem and which one then?
  • Or am I completely wrong and I should do something completely different? In that case I would appreciate any hint to QNAP documentation etc. I would have missed.

1 Answer 1

1

Try this:

ubiattach -m 6 -d 2
/bin/mount -t ubifs ubi2:config /tmp/config
nano /tmp/config/autorun.sh

And after you finish editing,

chmod +x /tmp/config/autorun.sh
umount /tmp/config
ubidetach -m 6
1
  • Thanks for your answer. I'm not sure, how far I've come with this, as this has been very long ago. I'll try again later. Would you be so kind to explain, what the parameters to ubiattach and ubidetach do exactly? Feb 12, 2022 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .