Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / SQL

GoFlex Repair And Snooping Around

4.33/5 (4 votes)
6 Jan 2016CPOL4 min read 13.2K  
Fix your goflex media server files and have poke around on the device.

Introduction

After 2 years of my 2Tb GoFlex giving me grief with disappearing files, disappearing device, etc., I have finally bitten the bullet, I am going to fix this thing if it kills me.

So we are going to log on to the GoFlex, and repair the broken database it uses to list files. Obviously, there is a risk you will trash the GoFlex as we are going to be using root access, but hey, what's life without a little risk?

So you will need:

  • A GoFlex (mine is a 2TB - I presume they all fail and work the same)
  • An admin account to the GoFlex
  • SSH Putty tool

Getting Started

Download putty from the following link:

Get the windows installer for everything, run it and you should get your putty icon to double click.

Getting the IP address involved me going to the web admin page of my GoFlex in Firefox:

Now click on the bottom right on the about "go flex home" link, and write down the product code (note it is also physically written on the actual GoFlex drive). Now in Firefox (or whatever browser you are using), open up Tools->Web Develoer->Inspector, this will open a pane, click on the Network tab, and in the Headers section, you can find your Goflex IP address. Of course, I use static IP addresses, so I can predict my IPs for my Raspberry Pis and Banana Pros (for VNC'ing). To set up static IP addresses, read my other article.

So run putty, and put in the IP Address in the Host Name or IP address box, leave the rest as defaults, save the session so you can go back and do this again whenever.

A SSH shell will pop up, login with these credentials:

Username: <admin_username>_hipserv2_seagateplug_16 CHARS PRODUCTCODE
Password: your admin password

For example, mine looked like this:

Username: mjobrien_hipserv2_seagateplug_PGWK-ZDRY-YRDZ-OSSS
Password: Imnottellingyou!!

Now we have logged in to the linux OS running on the GoFlex! Let's do some damage:

sudo -s

This gets us root access, use the same password as above.

Make sure you are root:

whoami

Now you should know that the name of the service used by GoFlex to broadcast itself as a media server is called minidlna.

I created a scripts folder (mkdir scripts), and created the following scripts, you don't have to, you can simply type these commands on the command line:

checkstatus.sh - checks the status of the service that broadcasts the GoFlex (minidlna)
/etc/init.d/minidlna.init status

startdlna.sh
/etc/init.d/minidlna.init start

stopdlna.sh
/etc/init.d/minidlna.init stop

restartdlna.sh
/etc/init.d/minidlna.init restart

unmount.sh
umount /tmp/minidlna

rebuilddb.sh
/usr/sbin/minidlna -f /etc/miniupnpd/minidlna.conf -R -d

Now, if you have made these scripts, make sure they are executable (chmod 777 *).

So to fix the missing files bollox, simply run the unmount script, and then the rebuilddb script (or type those commands straight in)!

If the service is busy when you try to unmount then you will have to run the stopdlna.sh script first.

Wait for about 10 days (I'm exaggerating), and after lots of fuss, you should have a working Goflex, with all your files!

Now start the service with the start script, and check its status (make sure it's running) with the checkstatus script, or use this:

ps -ef | grep dlna

Now I thought I'd snoop about so I hunted for the .db files, the GoFlex uses sqlite as a DB server (kind of). So find all your db files:

find -name *.db

I got thousands of thumbs.db files, so I cleaned them up:

find . -name Thumbs.db -print0 | xargs -0 rm -rf

Note be careful with deleting lots of files!

Next, I opened the sqlite to look at the DB contents:

sqlite3 './GoFlex Home Public/.tmp/mt-daapd/songs3.db'

Make sure you use quotes around any file names with spaces in them !!

So I looked at the databases in my session:

.databases

I had one called 'main', so I looked at what tables are in there:

SQL
SELECT name FROM main.sqlite_master WHERE type='table';

I could see lots of tables, i.e., songs, playlists, etc. So I had a look in songs:

SQL
select * from songs;

Now from here on, you can do what you like, rename batches of data rows, clean the db, etc. It's up to you !

I hope that was fun, anyway good luck with it all, and happy goflexing!

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)