Back from the Dead – Fixing Drives in Linux
So as you all know I lost my NAS due to some disk errors.
Sadly, it was actually my flash adapter card (http://www.dealextreme.com/details.dx/sku.711) failed and this caused my FreeNAS to fail.
After much debugging – since this solid state drive seemed like a power supply failing: power turns off a couple seconds after being turned on, turning it on sometimes would do nothing until you unplugged the power supply then plug it back in. (http://hubpages.com/hub/How-to-Tell-When-Computer-Power-Supply-Is-Failing)
Anyway, after figuring it out, I put in an old unlocked X Box hard disk (15 Gb) and that’s now my boot drive. I used the newest version of FreeNAS which allows for a “full install” on a hard disk. (simply boot it up, and use the console menu to install)
Now that I’ve got my FreeNAS server up again, I still have a broken 500Gb drive to fix.
I took the 500Gb drive out and put it in my Ubuntu Linux lab server. I usually use this machine for any experiments that I’m doing and for virtual machines.
Canada computers and a few others have some pretty good deals on 1Tb drives right now. (I got mine for $90.00. http://www.canadacomputers.com/index.php?do=ShowProduct&cmd=pd&pid=024109&cid=HDD.443.877) So this is a good time to upgrade my drive.
I put it into my lab server, and dd’ed the drive to make a complete copy onto my new 1Tb drive.
Now I have a whole bitwise copy of my drive, now the fun part.
I don’t know UFS as well as I know FAT or EXT, so I was hoping to find a utility to help me with the restoration of this drive.
A quick google found me a utility called “testdisk”, (http://www.cgsecurity.org/wiki/TestDisk) and since I have a bitwise copy of my drive, I thought let’s give it a try.
Ran it, it took literally 1 hour to analyze the drive. It was so slow that I almost gave up. However, beer and a night of Simpsons let me relax and let it do its work.
I wish I’d taken screen shots for you, but I was thrilled to find out that it actually worked.
It recognized the UFS filesystem, GFI partition and all. It rewrote the partition table, and dropped me to a command prompt.
I installed “ufsutils” with apt-get install, and ran fsck.ufs on it. fsck did it usual “i found xxx fix?” and the drive was repaired.
I copied the data from the old 500Gb to the new 1Tb, and installed the new 1Tb drive into my FreeNAS server, added the drive, and ta-da it worked.
Back in business.
Now, the new version of FreeNAS has some neat new features that I discovered, the least of which is “/etc/rc.d/transmission blocklist-update” – which makes my old tutorial redundant, and I’ll write an update about that sometime soon :)
This week I’m going to reconfigure it – and I’ll probably write a little tutorial for you all who are interested.
In the meantime, I got my NAS back – and my movies.
Revisit Royale Noir
But, since i’ve been looking at the same page of posts for the last couple of weeks i thought i owe it to you to write something… anything, just to keep you (and me) on our toes.
Since this is something of a revisit but I think it’s quite catching and really a nice personal touch that many of us can use to make our windows boxes just a little more unique.
It’s called “Royale Noir”, a secret hidden XP theme that is only available using a special “luna.msstyles” visual settings file by Microsoft.
Installation is a snap, you just download the royale_noir.zip file that I literally stole from the old “istartedsomething” post (see: http://www.istartedsomething.com/uploads/royale_noir.zip) unzip it into a “royale noir” subdirectory in your “%WINDIR%\resources\themes\” folder, double click on the “luna.msstyles” file and select “Noir” from the colour scheme.
Beautiful.

Royal Noir Display Properties
Burn a CDROM to a friend?
Ever wanted to send your friend a cdrom, but didn’t want to send an iso or whatever? this is for you!
Interesting bash prompts
Sorry I haven’t posted in a while, been busy working on many MANY things. However, I did find this which I find quite intersting
There’s some really cool bash prompts at this site:
http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04
In my opinion bash is getting quite large and a bit of a resource hog, for a shell that is; but with all it’s bloat comes some VERY decent features, including the ability to modify your prompt to run small shell scripts and display the output.
The site shows 8 simple examples; but my favorite one displays a happy “^_^” emoticon or a “O_O” emoticon if the last command succeeded or failed:
PS1=“\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$ “
Google Scripts without Google API
A client I just finished working with had a few applications where they would judge the deployment of a product (a piece of software for example) by using googles output.
They considered any search product with <100,000 results obscure, less than 1,000,000 moderate, 1,000,000 to 100,000,000 significant and greater than that still as broad.
They were doing this by hand.
Searching google and looking at the “Results x- x of about xxxx” section of google search, and using this output to judge the deployment, as I said.
The problem here is that they wanted to script this, but NOT by using google’s api (for legal reasons).
I therefore would have to find a way around.
The easiest way, I could think of, is just capturing the output of the search… But how?
The command line browser “lynx” in unix systems is amazing for this sort of thing. Lynx can render a simple html page and dump it as text (using the -dump parameter)
All I had to do then is wrap it in a nice script that would read the rendered output, and output something meaningful.
You can find the script in my script section called “googleit.py” and “deployment.py”
Restrict a 14 year old from the internet
So I’ve taken a bit of time off – to spend with my son who came to stay with me from the far away place called Orillia.
I’m quite liberal with our computing environment – so he gets his own computer and to be “self regulated” over the Internet. He knows well enough that I have quite a complex network and know all the traffic that travels through our up link to the Internet.
Giving your 14 year old unrestricted internet access has it’s ups and downs. One major down was that he managed to eat my entire Rogers High Speed Internet quota in a matter of 4 days.
That’s right 4 days.
So to limit him, I entered his MAC address in my deny list and he isn’t able to attach to the internet. Easy right? No.
I also have a Wii, which has an Internet connection, and frequently will download updates for itself. My son also loves to play the Wii.
I don’t know exactly where he got the idea, but Suddenly I noticed that my Wii was unplugged, and instead the “Wii” was browsing the Internet, Gigabytes at a time on World of Warcraft, Runescape, uTorrent, and Youtube. A browsing pattern I knew FAR too well.
He went into the Wii’s menu, looked up it’s MAC address, unplugged the Wii, then changed his own MAC address to the Wii’s easily circumventing my restrictions.
Like father like son, I suppose. Now I have to physically log into my OpenBSD server from wherever I am and forcibly unload it’s networking modules with a cron job to reload them when he would be allowed to regain access to the internet.
Tutorial: cvs server on FreeNAS
First, when I started to research if “cvs” would work on my FreeNAS I found a whole lot of links to cvsd… but I recall using cvs over ssh for many many projects. Couldn’t I run just cvs over ssh?
Yes You Can!!! And this makes cvs on FreeNAS easier than ever. Not much modification is required, and I am very happy to report that I’ve got mine working very well.
So let’s get into it shall we?
In order to get cvs working, we need the cvs binary. FreeNAS is a FreeBSD core underneath the covers. There are many many releases of FreeBSD so we should find out what release we have. We can do this by running uname on the command prompt of your FreeNAS.
Mine says:
nas:/mnt/default# uname -a FreeBSD nas.ejes.gotdns.org 6.4-RELEASE-p3 FreeBSD 6.4-RELEASE-p3 #0: Sat Apr 18 22:17:59 UTC 2009 root@vmbsd64i386:/usr/obj/freenas/usr/src/sys/FREENAS-i386 i386 nas:/mnt/default#
Now that I have the release number, I can simply browse the FreeBSD repository at ftp://ftp.freebsd.org (the 6.4 release is ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/6.4-RELEASE/6.4-RELEASE/packages/All/), and following the directory tree you can find most any other release.
Simply download the “cvs” binary cvs+ipv6-1.11.17_1.tbz (ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/6.4-RELEASE/6.4-RELEASE/packages/All/cvs+ipv6-1.11.17_1.tbz)
I used fetch on my system:
nas:/mnt/default# fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/6.4-RELEASE/6.4-RELEASE/packages/All/cvs+ipv6-1.11.17_1.tbz cvs+ipv6-1.11.17_1.tbz
100% of 442 kB 266 kBps
Then, in the GUI, I added a group called “cvs”, I gave it the group id 2401 because port 2401 was the cvs server port (and I may want to use pserver one day).

The Group I used for my cvs

the user _cvs for myself
Thankfully a tbz file means a tar bzipped file. So we can use tar to extract the package from freeBSD i want all my cvs stuff in one place so i’m going to extract it to my /mnt/default/cvs/tmp directory.
nas:/mnt/default/cvs/tmp# tar -vxzf cvs+ipv6-1.11.17_1.tbz x +CONTENTS x +COMMENT x +DESC x +MTREE_DIRS x man/man1/cvs.1.gz x man/man5/cvs.5.gz x man/man8/cvsbug.8.gz x bin/cvs x bin/cvsbug x bin/rcs2log x share/cvs/contrib/README x share/cvs/contrib/check_cvs x share/cvs/contrib/clmerge x share/cvs/contrib/cln_hist x share/cvs/contrib/commit_prep x share/cvs/contrib/cvs2vendor x share/cvs/contrib/cvs_acls x share/cvs/contrib/cvscheck x share/cvs/contrib/cvscheck.man x share/cvs/contrib/debug_check_log x share/cvs/contrib/intro.doc x share/cvs/contrib/log x share/cvs/contrib/log_accum x share/cvs/contrib/mfpipe x share/cvs/contrib/pvcs2rcs x share/cvs/contrib/rcs-to-cvs x share/cvs/contrib/rcs2log x share/cvs/contrib/rcslock x share/cvs/contrib/sccs2rcs x info/cvs.info x info/cvs.info-1 x info/cvs.info-10 x info/cvs.info-2 x info/cvs.info-3 x info/cvs.info-4 x info/cvs.info-5 x info/cvs.info-6 x info/cvs.info-7 x info/cvs.info-8 x info/cvs.info-9 x info/cvsclient.info x info/cvsclient.info-1 x info/cvsclient.info-2 x info/cvsclient.info-3 nas:/mnt/default/cvs/tmp#


Go back and “Give full shell access to user.” to the _cvs user and log-in or “su _cvs” to become him.
Now we have to initialize the cvs root directory; mine is /mnt/default/cvs/root. Run cvs init, and we’re off.
nas:/mnt/default/cvs/tmp# su _cvs %cvs -d ~/root init %exit nas:/mnt/default# chown -R _cvs:cvs cvs nas:/mnt/default#
Everything should be functional, all we need to do now is add anyone we want to be able to access cvs, to the “cvs” group. I added “user” as a test.
On my OpenBSD terminal I setup a simple cvs system
$ CVS_RSH=ssh cvs -d:ext:_cvs@nas:/mnt/default/cvs/root checkout .
works! GREAT!! Add my user to the “cvs” group, remove “shell” access from _cvs done!
My Remote users have to set these settings:
CVS_RSH=ssh
CVSROOT=:ext:user@host:/mnt/default/cvs/root
CVSEDITOR=nano
Now I can import directories using: cvs import -m “comment” module_name committer start
Check them out on another machine using: cvs checkout module_name
Add files or directories: cvs add “file/directory”
And Commit my changes once they’re made: cvs commit
For example:
nas:/mnt/default# ssh user@192.168.0.2 user@192.168.0.2's password: Last login: Tue Aug 4 16:46:50 2009 from 192.168.0.3 OpenBSD 4.4 (GENERIC) #1021: Tue Aug 12 17:16:55 MDT 2008 Welcome to OpenBSD: The proactively secure Unix-like operating system. Please use the sendbug(1) utility to report bugs in the system. Before reporting a bug, please try to reproduce it with the latest version of the code. With bug reports, please try to ensure that enough information to reproduce the problem is enclosed, and if a known fix for it exists, include that as well. $ CVS_RSH=ssh; export CVS_RSH $ CVSROOT=:ext:user@192.168.0.3:/mnt/default/cvs/root; export CVSROOT $ CVSEDITOR=nano;export CVSEDITOR=nano $ mkdir src $ cd src $ mkdir testing $ cd testing $ touch a file $ ls a file $ cvs import -m "testing" test ejes start user@192.168.0.3's password: N test/a N test/file No conflicts created by this import $ mkdir new $ cvs add n $ touch new/more $ cd .. $ ls testing $ rm -rf testing/ $ cvs checkout test user@192.168.0.3's password: cvs checkout: Updating test U test/a U test/file $ cd test $ mkdir new $ touch new/more $ cvs add new user@192.168.0.3's password: ? new/more Directory /mnt/default/cvs/root/test/new added to the repository $ cvs add new/more user@192.168.0.3's password: cvs add: scheduling file `new/more' for addition cvs add: use 'cvs commit' to add this file permanently $ cvs commit cvs commit: Examining . cvs commit: Examining new user@192.168.0.3's password: RCS file: /mnt/default/cvs/root/test/new/more,v done Checking in new/more; /mnt/default/cvs/root/test/new/more,v <-- more initial revision: 1.1 done $
Video Capture Card Driver Woes
leave a comment »
So lately I’ve been working on copying my old VHS movies to digital format so that my NAS can serve them up to my XBMC.
In my stumbles around the internet I found this really great project.
It seems to include EVERY older Video Capture Card for Windows drivers all into 1 beautiful fast and easy to install package.
Since I don’t use windows, I don’t really have much to do with it, but it’s good for those of you who do.
Fun
http://btwincap.sourceforge.net/
Take a look
Written by ejes
November 4, 2009 at 3:29 pm
Posted in Commentary, Hacking, Neat Stuff/Good Ideas
Tagged with howto, instresting sites, video capture