Posts Tagged ‘Linux’

How To: Copy Files Off of Your LinkStation Pro via USB

Friday, January 4th, 2008

My LinkStation Pro NAS is great for holding all my files, and really has made a small portion of my life more convenient. The only fly in the ointment is transferring huge files to/from it over my wireless network can take ages. Copying 8 gig of data would, as a relevant example, take me the best part of the rest of my evening. Maybe the USB ports at the back can be put to good use?

The LinkStation can’t be connected to a PC via USB (as far as I can see). It can, however, connect to other USB harddiscs. It does this to expand storage, but also gives us the ability to transfer data via the USB port - which is so much quicker. To do this, we’ll need to connect to the NAS via Telnet (the web interface doesn’t support using USB thumb-drives as a transfer medium), detect and manually mount the USB drive.

First, to telnet in we’ll need to enable Telnet on the NAS:

  1. Download ACP Commander from here.
  2. Use ACP Commander using the command java -jar acp_commander.jar -t <linkstation_ip>.
  3. Telnet in. Look! It’s Linux!
  4. The standard username is root, with no password. Note this gives you complete access to the software innards of the NAS. You don’t want to do anything rash, like delete random files, in this mode.
  5. Poke about if you’re interested.

Now we need to find out where the USB thumb-drive is (obviously, your thumb-drive needs to be stuck into one of the ports at the back):

  1. Run the command dmesg | grep -i "SCSI device". The output will look something like:

# dmesg | grep -i “SCSI device” SCSI device sdb: 16121856 512-byte hdwr sectors (8254 MB) SCSI device sdb: 16121856 512-byte hdwr sectors (8254 MB)

We’re interested in the bit that says sdb. Yours may be different (possibly sda). This is the location of the USB drive in the dev directory.

Okay, to mount it:

  1. Create the directory /mnt/usbdrive to create our mount point.
  2. Run the command mount -t vfat /dev/sdb /mnt/usbdrive.

The USB drive is now accessible from within Linux on the NAS. You can copy files to and from it using the standard Linux cp command.

Unmounting the USB drive can be done via umount /mnt/usbdrive.

(Thanks to this site, here, for all the info).

How To: Get Syntax Highlighting Working for Vi in Ubuntu

Wednesday, January 2nd, 2008

If you can’t get syntax highlighting to work in a new Ubuntu install, it’s probably because the standard Vim install in Ubuntu is from the vim-tiny package. This is a cut-down version of Vi that does very little but edit files. If you want full Vi (with syntax highlighting), you need to uninstall the vim-tiny package and install vim-runtime:

  1. sudo apt-get update - may as well make sure we’re aware of the latest package updates
  2. sudo apt-get remove vim-tiny - we’re going to replace this package. You’ll be asked if you want to uninstall ubuntu-minimal. It’s safe to do this (explanation below).
  3. sudo apt-get install vim-runtime - this is quite a big package (20 meg or so).

Now we have the latest version of Vim. The command :syntax on will turn on syntax highlighting. To have it on automatically for yourself, create the file ~/.vimrc and enter the text syntax on. You can also edit /etc/vim/vimrc (as root) and change the appropriate lines to make the settings global instead. You can also set whether the background is dark or light (which affects the colour scheme).

When uninstalling vim-tiny, you’re prompted about the removal of ubuntu-minimal. This is an umbrella package that has lots of dependencies to packages needed for a basic workable Ubuntu install. If you uninstall one of the packages, you’ll need to uninstall the umbrella package too. This doesn’t affect the other dependencies so it should be safe.

As an aside, it seems to work better over Putty too. Happy days!

How To: Get Ubuntu To Stream Videos To Your Xbox360 With UShare

Wednesday, December 26th, 2007

The recent Xbox360 fall update gives users the option to view DIVX films. If, like me, you have a huge collection of DIVX movies stored on a separate Linux machine, you’ll want to find a way to get the linbox to deliver these movies to your Xbox (trust me, it’s great). The particular tool I’ve used to do this is uShare (part of the GeeXBoX distro - specialising in HTPC implementations).

So, to get started, install uShare. The uShare website (here) gives details on how to do this. Installing uShare using apt-get will set up three files (amongst others) on your Ubuntu machine:

  • /usr/bin/ushare - the uShare binary file
  • /etc/ushare.conf - the uShare configuration file
  • /etc/init.d/ushare - the uShare daemon start/stop script

We can get uShare to start serving our files immediately to the Xbox with the command

uShare -D -x -c /media/directory (where /media/directory is the path to your files).

This isn’t very neat though, so read on if you want to integrate uShare properly with your Ubuntu install.

We now need to make sure uShare knows which files to serve and to make it operate in Xbox 360 compatibility mode. Bring up your text editor (using sudo) and open up /etc/ushare.conf. Change the line ENABLE_XBOX= to USHARE_ENABLE_XBOX=yes. Set USHARE_DIR to the path(s) of the files you want to serve. If you want web access, change the line ENABLE_WEB= to USHARE_ENABLE_WEB=yes and set the USHARE_PORT.

The uShare daemon script also needs to be amended slightly to tell uShare to use the config file we’ve just changed. Using your text editor (again with sudo), open up /etc/init.d/ushare and add a new line under the CONFIGFILE=/etc/ushare.conf that reads USHARE_OPTIONS="-f $CONFIGFILE" (running uShare straight on the command line will automatically open that config file. For some reason, the command used in the script doesn’t. Thanks to [this forum](http://ubuntuforums.org/showthread.php?t=631213&page=7 for the solution)).

Once this is all done, restart the uShare daemon by running the command

sudo /etc/init.d/ushare restart.

If you load up your Xbox 360 and go into the Videos section under the Media blade, you’ll see your new media server listed as “uShare” (press X to change video source if not). Happy viewing!

Still need to resolve the following issues:

  1. uShare does not differentiate between media types, so all my movies are appearing as music as well. Music also isn’t organised into albums.
  2. Only the first directory I’ve specified for sharing in the configuration file is being scanned and delivered.

Conclusion - Use uShare if you want to just deliver movies. For delivery of multiple media types, including a large music collection, uShare can’t seem to handle it just yet.

Media Server: A New Hope

Saturday, December 8th, 2007

With all the different ways to access music, it makes sense to centralise my collection so it can be accessed from anywhere in the house. Same for videos and pictures. And it’s always fun to start a new computer project which I probably will lose interest in a few weeks before completion. So far I’ve selected a vague outline on the software I’ll need and, from that, the hardware. Progress can be tracked here.

Jay’s also creating his own media server which’ll be part-bespoke. Details are on his site.