Formatting a USB drive from a TS-239 Pro II

Posted: January 31st, 2011 | Author: | Filed under: Linux, QNap | Tags: | No Comments »

Plug the USB stick into the Qnap. Then in a terminal, as root, do an lsusb to confirm that the USB drive has been recognised.

To find out what device name it has been assigned, do a dmesg | tail. This will print the latest lines from the kernel log, which should contain information about the inserted USB drive:

fdisk -l, which shows all connected drives, can also be used to find the right device name. The USB drive can be recognised by its size. In this case, it is a 2 GB one:
output from fdisk -l
If the USB drive is already formatted with e.g. NTFS, it has probably been mounted automatically, in which case it should be unmounted. You can check this with the df command:
df
Once we know the name of the drive and it is unmounted, we can create a new linux partition using fdisk:

  • If for example the device is sdv1, do an fdisk /dev/sdv1
  • type d to delete any existing partitions.
  • Type n to create a new partition.
  • Make it primary and first
  • Go with the defaults when prompted for start and end cylinder
  • Press t to change the filesystem to linux (number 83)
  • Type w to write the changes to the disk and exit

Finally, format the partition with the ext3 filesystem:

mke2fs -j /dev/sdv1


Now the partion is formatted and it can be mounted again:

mount /dev/sdv1

The USB drive is now ready for use :)


Starting, restarting and stopping daemons in Linux

Posted: January 16th, 2011 | Author: | Filed under: Linux, QNap | Tags: , , , , | No Comments »

Daemon services, or just daemons, are started at boot time. They are roughly equivalent to services in the Windows world.
To see which daemons are available on a system, do an

ls -l /etc/init.d/

Every script in that directory represents a daemon, which can be started, restarted and stopped manually using the following syntax:

/etc/init.d/<daemon name> start | restart | stop

If, for example, I wanted to restart an nzb-get daemon due to changes in its configuration files, I would type

/etc/init.d/nzb-get.sh restart

After issuing the command, the daemon will usually print some lines to the terminal indicating what it is doing, e.g.: ”Starting NZB-Get Daemon” or “Shutting Down“.

If you want to make sure whether a daemon is running or not, you can grep for its name in the list of running processes. If I wanted to see if the nzb-get daemon was really started, I could do the following grep:

ps -aux | grep nzb

If the daemon is running, this will produce a result like:

8148 admin 2456 S /opt/bin/nzbget –daemon
8355 admin 564 S grep nzb

The first line is the daemon. Notice the “–daemon” at the end of the line. The second line is the grep process we just ran to find the daemon.