Backing up the /sdcard of a Galaxy Nexus

After a long wait 4.0.4 is finally out for the Galaxy Nexus.I wanted to do a fresh install. I saved some important stuff using Titanium Backup, but I then needed to backup my data that shows under /sdcard.

After fighting with broken MTP on Ubuntu and even on Windows, I ended up doing a partition image using the dd command on an USB stick connected with an OTG cable:

mkdir /data/USB
 mount -rw -t ext4 /dev/block/sda1 /data/USB
 dd if=/dev/block/mmcblk0p12 of=/data/USB/SD.img

Ftp Synchronisation

A customer of mine is making some files available to me on an FTP server. As I need those locally, I searched around for a solution to synchronize those files to a local folder.

I have found the great tool called lftp which is available from the Ubuntu’s repositories. I use that command in a crontab:

lftp ftp://user:password@ftp.host.com -e "mirror -e / /path/to/my/local/folder ; quit"

Google docs isn’t ready for me

I decided to move all my word processing on Google Documents, but I had to withdraw that decision.
I have two critical issues with text documents. The first being the inability to number my heading in text documents. There was a solution in the old Google Documents editor by editing the CSS of the documents. A feature that doesn’t exist anymore, and which is, according to Google, impossible to add back.

The second is that I can’t setup a different heading and footer for te first page of a Goggle document.

It is crazy that Google hasn’t implemented such features! Their support forum is full of message concerning those missing features, and the removal of the edit CSS option.

On an other side, the spreadsheet editor seems really powerful. It does what I need for now, and I hope it’ll continue so.

I then noticed that it is possible to store any type of file in Google Documents. This is nice as Google offers 1 GB of free storage and additional storage is cheap. But for such feature to be really usefull to me I need the documents to be synced accross my computers. Which is not yet possible.

Come one Google, bring us a real online word processing experience!

Monitoring IBM hardware RAID (SAS1064ET PCI-Express Fusion-MPT SAS)

I have an IBM X2 server with a hardware RAID handled by an LSI card (SAS1064ET PCI-Express Fusion-MPT SAS) and running Ubuntu 10.04 Lucid. I needed to monitor my RAID status and searched a lot on the web but I finally got it.

Getting raid status from command line

First install mpt-status

sudo apt-get install mpt-status

Then checkout if mptctl kernel module is loaded

sudo lsmod | grep mptctl

I personally get:

mptctl                 31642  0 
mptbase                91642  3 mptctl,mptsas,mptscsih

If you don’t, load it

sudo modprobe mptctl

Then launch mpt-status

sudo mpt-status -p

I get

Checking for SCSI ID:0
Checking for SCSI ID:1
Checking for SCSI ID:2
Checking for SCSI ID:3
Checking for SCSI ID:4
Checking for SCSI ID:5
Checking for SCSI ID:6
Checking for SCSI ID:7
Checking for SCSI ID:8
Checking for SCSI ID:9
Found SCSI id=9, use ''mpt-status -i 9`` to get more information.

So, as said, I run

sudo mpt-status -i 9

And I now have my raid status

ioc0 vol_id 9 type IM, 2 phy, 698 GB, state OPTIMAL, flags ENABLED
ioc0 phy 1 scsi_id 11 ATA      HUA721075KLA330  AB4A, 698 GB, state ONLINE, flags NONE
ioc0 phy 0 scsi_id 10 ATA      HUA721075KLA330  AB4A, 698 GB, state ONLINE, flags NONE

Getting email reports on status change

First we need to get the kernel module to load at boot. It get achieved  by editing /etc/modules and adding mptctl to the end of that file. Then reboot your server. After reboot, mpt-status -p command should work.

Next create an  /etc/default/mpt-statusd file and paste in:

MAILTO=root  # Where to report problems
PERIOD=600    # Seconds between each check    (default 10 minutes)
REMIND=7200   # Seconds between each reminder (default 2 hours)
RUN_DAEMON=yes
ID=0

Change the value as you wish. Be care to set the correct ID (the number from the command mpt-status -i 9 , for me it is 9)

You then need to set the daemon to run at boot:

sudo update-rc.d mpt-statusd enable

And fially start it:

sudo service mpt-statusd start

You are done and you will receive an email alert when the RAID status changes.

Setup the brother DCP-357C in Ubuntu

I had a problem where the printer was cutting the top edge of every page using Ubuntu’s brother-lpr-driver-extra & brother-cups-wrapper-extra.

So I downloaded the packages from brother web site. The package are not really wellll done so a couple of hacks are needed. First download the the debs from here

Then issue those commands:

# sudo mkdir -p /usr/share/cups/model
# sudo mkdir -p /var/spool/lpd/dcp353c
# sudo dpkg -i --force-all dcp353c*

A last command is necessary to not have the top of each page cut off:

# sudo /usr/bin/brprintconf_dcp353c -pt A4

For the scanner download the files from here and then:

# sudo dpkg -i brscan*

Then you have to give the scanner some permissions:

# gksudo gedit /lib/udev/rules.d/40-libsane.rules

and add this to the end of the hardware list of the file:

#Brother DCP-357C
ATTRS{idVendor}==”04f9″, ATTRS{idProduct}==”01e4″, ENV{libsane_matched}=”yes”

And finally restart udev:

# sudo service udev restart

Solve the TwentyTen theme dropdown menu from going out of the screen edge

If you have a lot of pages in a hierarchical organization you might have noticed that the drop-down menu of the default WordPress theme, TwentyTen, always unfolds to the right.

The problem is that, if a top parent menu is on the right of your website, it unfold its child items out of the screen edge…. Continue reading Solve the TwentyTen theme dropdown menu from going out of the screen edge

Auto-populate nav menu with sub-pages

Today I faced a problem. I am building a website for a customer using WordPress. This web site is huge, about 200 pages in a hierarchical organization. I came to the point where I needed a custom menu. I didn’t need the “Home” link and some other pages to show. And I needed some other menu customizations. Continue reading Auto-populate nav menu with sub-pages