Brother HL-2270DW printer driver install: Ubuntu 13.04 64 bit versions

This post is to let people know that the Brother HL-2270DW printer can be installed and works under linux. I am currently using the printer in wifi mode printing to it from Ubuntu 13.04. I have posted installation instructions for Ubuntu 12.04 and these instructions also work for Ubuntu 13.04. Here is the link to the installation instructions http://chadchenault.blogspot.com/2012/05/brother-hl-2270dw-printer-driver.html.

I hope you enjoy this printer as much as I have.


Remove Directories Using BASH Find Command

This post is to help me remember how to use the BASH find command to search and remove directories on my linux server. I currently am running an rsync backup command and storing the backups on the server. Each backup is stored as a folder as a date and time. For example '2013-1016-1400' would be a backup that occurred on October 16, 2013 at 1400 hours (2 pm).

List of Commands with Explanation

list only directories
  ls -d */

Search examples

! = do not find
example: ! -name "2013*" # do not find file name beginning with "2013"

Find year 2013, months 5-8, day 31, but not time 22**
 find . -maxdepth 1 -name "2013-0[578][3][01]-*" ! -name "*-22??"

Find year 2013, months 5-8, day 31, but not time 22**, and then delete directory
find . -maxdepth 1 -name "2013-0[578][3]1-*" ! -name "*31-22*" -print0 | xargs -0 rm -vR

Find year 2013, month 6, all days, but not date and time 0628-2001
 find . -maxdepth 1 -name "2013-06*-*" ! -name "*0628-2001"

Find year 2013, month 6, all days, but not date and time 0628-2001, and then delete directory
 find . -maxdepth 1 -name "2013-06*-*" ! -name "*0628-2001" -print0 | xargs -0 rm -vR


Hot Swap (remove and add) a RAID 1 disk in Ubuntu 13.04

Edit 2015-0630: Do not use the below as a backup solution. A better solution I now use is rsync to mirror my raid array to an external LUKS encrypted hard drive.  
This article shows you how to remove a disk from a RAID 1 array in Ubuntu 13.04 and add a new disk to the Array. This is known as hot swapping when you replace the drive without shutting the computer down.

I have a home server that I back up all my data to from all my different devices and computers. This data is on an encrypted LUKS filesytem with software RAID 1 array. A RAID 1 Array requires a minimum of 2 disks and the disks are mirrored so that if one disk fails, you still have your data on a second disk. I also like to keep a third disk off site and rotate it into the RAID 1 Array. The off site backup protects my data in case my computer is ever stolen or destroyed in a fire. This is easiest if you have a hot swap hard drive bay in your computer.

Requirements for this to work.
  Linux Operating System
  Mdadm software installed (RAID software)

All of the following commands are in the terminal.
  You will have to replace 'md1' and 'sdd' with your own values from your machine.

  • Identify disk to remove from Array
    • sudo fdisk -l
  • Fail disk from the Array
    • sudo mdadm /dev/md1 -v --fail /dev/sdd
  • Remove disk from the Array
    • sudo mdadm /dev/md1 -v --remove /dev/sdd
  • Check disk is removed from the Array
    • sudo mdadm --detail /dev/md1
  • Physically remove disk from the machine
  • Insert new disk into machine
  • Check that new disk is seen by machine
    • sudo fdisk -l
  • Add disk to the Array, different method for new disk with no partitions versus readding a disk back to the Array
    • New hard drive with no partitions
      • sudo mdadm /dev/md1 -v --add /dev/sdd
    • Disk that has been part of the Raid Array before
      • sudo mdadm /dev/md1 -v --re-add /dev/sdd
  • Monitor status of Raid rebuild
    • sudo mdadm /dev/md1 --detail
It takes many hours to synchronize new large hard drives.

I use dm-crypt software for disk encryption.


Nautilus File Manager: Add An Application to "Open With" menu in Ubuntu Linux 13.04

I found myself needing to open .mp3 and .ogg files with an application (pyRenamer) from within the file manager nautilus, also called Files, in Ubuntu Linux 13.04. From within Files, you can right click on a file and a menu opens, then select "Open With" and the application you want the file to open in.
My problem was "pyRenamer" was not listed in the applications and so this post gives instructions on how to add an application to the "Open With" menu in the Files application.

I used information from this site: https://ubuntugenius.wordpress.com/2012/06/18/ubuntu-fix-add-program-to-list-of-applications-in-open-with-when-right-clicking-files-in-nautilus/

1. Find the name of the application you want to open. It is probably found in /usr/share/applications. You can list all the applications in this directory with
ls /usr/share/applications
The name of the application will end in ".desktop", for example pyRenamer.desktop.

2. Edit pyrenamer.desktop file. This method affects all users of the machine.
sudo gedit /usr/share/applications/pyrenamer.desktop
edit the line: Exec=pyrenamer
to: Exec=pyrenamer %F
Save file and exit.
This allows you to select pyRenamer application from within the right click menu:Open With/Other Application... 

3. This is an alternate method of adding an application to the right click "open with" menu. This method is user specific.
Open the file /home/$USER/.local/share/applications/mimeapps.list in your favorite text editor. $USER will be your user name and does not need to be changed if you paste this into the command line.
gedit /home/$USER/.local/share/applications/mimeapps.list

4. Edit this file so that .ogg and .mp3 files can be opened by pyRenamer application. There are two highlighted lines that I added.

Hope this helps!