Click here to Skip to main content
15,867,308 members
Articles / Programming Languages / SQL
Tip/Trick

GoFlex Repair And Snooping Around

Rate me:
Please Sign up or sign in to vote.
4.33/5 (4 votes)
5 Jan 2016CPOL4 min read 12.7K   1
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)


Written By
Technical Lead
Canada Canada
I have a blog here

http://www.electricalengineeringschools.org/blog/

And my robotics web site is here :

http://www.roboticsfordreamers.com/

I have been a software engineer for over 20 years now. I'm an expert in writing scalable restful web API services, which I've been doing for over 7 years now for games companies such as EA and Ubisoft. I've also worked on several video games, including Skate 2 and 3, NHL, Need for Speed, various Assassins Creed games, Far Cry 3 and 4, Driver San Francisco and most recently with a team of 15 on EA's UFC free to play. On this latest project I designed, implemented, tested (including load tests in Gatling and JUnit on AWS), deployed and supported all the web services for the game client, supporting up to a half a million active sessions.

I am proficient at programming in C, C++, C#, Java etc. I've developed many types of games, applications, SDKs and web services in Linux, Unix, iOS, Android and Windows.

My spare time is spent teaching and lecturing computing languages and science. I have a PhD in Artificial Intelligence (specialising in knowledge representation - Semantic networks with inference engines).

Currently I am also building an A.I. general purpose robot. The brains behind it are a mix of 6 Raspberry Pi and Banana Pros, with 2 USB cameras, SATA drive, Router Switch with inter-pi Comms, 2 motorised track systems, plus various sensors including motion/pir/sound etc.

The six pi's are split according to functions, including eyes (image processing/recognition), ears (speech processing and simulated speech),motor (object avoidance, environment mapping, drives all movement), entertainment (web browsing, media playing etc), brain (knowledge system, and adaptive learning/memory systems) and development system ( logging, diagnostics, debugging).

I am available as a consultant, so if you need to get something out the door quick, or want to set down an expandable and resilient framework, ping me !

Comments and Discussions

 
QuestionAutomation to reset GoFlex? Pin
bradut24-Mar-16 11:27
professionalbradut24-Mar-16 11:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.