Kitz Forum

Computers & Hardware => Apple Related => Topic started by: sevenlayermuddle on September 22, 2013, 02:12:03 PM

Title: How OS X killed my TV
Post by: sevenlayermuddle on September 22, 2013, 02:12:03 PM
Yes, really  >:(

My TV viewing these days is all mythtv based, with diskless front ends, that boot from USB sticks.  The other day I was doing some maintenance, and plugged one of the boot sticks into my MAC to do some config edits.  Then I quickly changed my mind and unplugged it again.  Yes, I know I should have gone through the 'eject' sequence, and I forgot.  But I hadn't actually done anything to it, so what harm could it do?

Plenty.  Whenever you plug a USB stick into a bog standard OS X, it seems to write dozens of files to hidden folders, named .Spotlight-V100, .Trashes, and a few others.  I have no idea what they do, and no inclination to find out.  But  next time I rebooted the frontend, 'boot error', no TV, boot sector stuffed I guess.  I can think of no other explanation than that the damage was done by OS X writing these files, and me pulling the stick without proper eject. :(

Thankfully, I had a binary image backup and so was able to restore, but what a pain.  Why on earth would the authors of an OS assume I wanted it to write to a USB stick, just because I plugged it in  ???

Title: Re: How OS X killed my TV
Post by: roseway on September 22, 2013, 03:24:13 PM
I suppose you might just have been unlucky, pulling the stick out just as the OS was writing something critical to it. But I agree with you that it seems a bit odd that it should write to the stick at all. I guess this is part of the automation built into OS X, but I know nothing about how the system works.
Title: Re: How OS X killed my TV
Post by: neilius on September 22, 2013, 03:59:22 PM
The .Spotlight folder holds metadata for OS X's indexing service, Spotlight. It runs when a new drive is mounted and scans all the files on that device, building an index that is searchable through the spotlight button in the menu. As for .Trashes, that's created for when you delete files on the device in Finder. They actually get moved there and are only deleted when you empty the Trash in Finder. The . in front of each folder name is the normal Unix way of making a file or folder hidden and since OS X is basically Unix underneath...
Title: Re: How OS X killed my TV
Post by: sevenlayermuddle on September 22, 2013, 04:20:42 PM
The .Spotlight folder holds metadata for OS X's indexing service, Spotlight. It runs when a new drive is mounted and scans all the files on that device, building an index that is searchable through the spotlight button in the menu. As for .Trashes, that's created for when you delete files on the device in Finder. They actually get moved there and are only deleted when you empty the Trash in Finder. The . in front of each folder name is the normal Unix way of making a file or folder hidden and since OS X is basically Unix underneath...

Thanks, yes - I realise that OS X is Unix underneath.  But having a spent  most of my career working on Unix systems, I'm not at all sure that 'behind the scenes' shenanigans such as writing data to a USB drive without being asked, is really in the spirit of Unix.  And it is asking for trouble - yes I should have 'ejected' the volume before removing it, but people make mistakes and it's too high a price to pay for such a simple mistake.

In my view simply plugging a USB stick into a PC, then immediately removing it without even browsing its contents, really should not corrupt the stick.

I also see no value in services like 'spotlight'.  If I put the files on the system then I know where they are, so  why would I want an index?  And for the rare occasions I may forget, there's always good old Unix 'find'.
Title: Re: How OS X killed my TV
Post by: GigabitEthernet on September 22, 2013, 04:35:31 PM
You do know that you can change what Spotlight indexes right?
Title: Re: How OS X killed my TV
Post by: broadstairs on September 22, 2013, 04:44:30 PM
Just goes to show that Apple are almost as bad as Microsoft. I agree no OS should write anything to any usb device when initially plugged in, I dont care what it is for and OSX should by default not do this UNLESS the users turns such an option on.

Stuart
Title: Re: How OS X killed my TV
Post by: sevenlayermuddle on September 22, 2013, 05:02:59 PM

Just goes to show that Apple are almost as bad as Microsoft. I agree no OS should write anything to any usb device when initially plugged in, I dont care what it is for and OSX should by default not do this UNLESS the users turns such an option on.

Stuart

Yep, that's my whole point.

You do know that you can change what Spotlight indexes right?

I do now since you have told me so, for which I am grateful (even if I sound grumpy  :D) and I will investigate, but the point is I never asked it to do anything at all in the first place, so I'm a bit a bit miffed given the outcome.
Title: Re: How OS X killed my TV
Post by: sevenlayermuddle on September 23, 2013, 10:22:46 PM
You do know that you can change what Spotlight indexes right?

Hi again Alec,

I've had a look at the spotlight options under system preferences and can't find anything that would stop it writing to an unrecognised  stick the minute I plug it in.  :(

It's clearly a well recognised bug that goes back a long way, and there are people on forums suggesting command line hacks, but my OS X system is quite precious for building apps.   Even if thes hacks work (which I doubt) I'd not want to resort to any undocumented tactics. ...

Any suggestions would be appreciated.
Title: Re: How OS X killed my TV
Post by: kitz on September 24, 2013, 12:03:02 AM
Im just glad that you had a backup to be able to restore from.
The thought crosses my mind on if something similar could affect other systems that run from USB.


btw.. if the OS writes to the USB everytime.. even if it doesnt need to/shouldnt... wont this drastically effect the lifespan of the USB stick?
Title: Re: How OS X killed my TV
Post by: sevenlayermuddle on September 24, 2013, 07:43:28 AM
Im just glad that you had a backup to be able to restore from.
The thought crosses my mind on if something similar could affect other systems that run from USB.


btw.. if the OS writes to the USB everytime.. even if it doesnt need to/shouldnt... wont this drastically effect the lifespan of the USB stick?

Hmm, interesting points.

Another thought that crossed my mind...  on a recent holiday, I allowed a friend I was staying with to borrow the SD card from my camera so he could plug it into his laptop and copy some photos.  It was a MacBook,   so I wonder... will that have made an uninvited contribution to my camera's card?    :o   Must have a look and see.
Title: Re: How OS X killed my TV
Post by: sevenlayermuddle on September 24, 2013, 08:38:38 AM
btw.. if the OS writes to the USB everytime.. even if it doesnt need to/shouldnt... wont this drastically effect the lifespan of the USB stick?

I was pondering that thought during my morning cuppa', but thought it would probably not be an issue, as long as nothing had changed, it wouldn't need to modify existing index data.  Or would it?

So I've just tried again using that same USB stick (very very carefully!). I installed it, noted the timestamp on the Spotlight files, then I ejected, removed it and installed it again, and lo' the timestamps were all updated.  Therefor I'd say yes, I guess there will be a theoretical impact on USB lifetime.

It is now back in my myth front end, happily booting up (phew!).  Reason I had a backup was of course I built it myself, but it was ages ago and probably took me a good two or three days to get everything working.  I really didn't want to go through that again, so good old Linux 'dd' to the rescue...  with which the boot sticks' binary images can very easily be archived and recreated.