Tuesday, January 6, 2009
You want to be able to backup your most important data but you are too lazy to copy and paste everything all the time.
This is a tool in the command line, but don't be scared off by that, it is very simple to use, and if you don't have the patience to fully learn it then read on and I'll show you a simple yet effective method of backing up your data.
Rsync is a useful command as it only backs up the files you have changed. So, the first time you run it it will backup everything you select, and in the future it will backup only those files that have changed from within the original selection.
For the purposes of this tutorial I assume the following:
1. User name: bob (so home folder is /home/bob/)
2. External hard drive is mounted at: /media/harddrive/
First of all its always a good idea to create a folder inside of your external hard drive before backing up:
Open a terminal and enter the following:
Now we are going to be making the backup bash script. I prefer making a script as the command is quite long. First we need to make a folder to store the script in (so it is easier to access).
Then we must create the bash script:
In this text file put the following in:
sudo rsync -rltDvu --modify-window=1 --progress --delete --delete-excluded --exclude-from=/home/bob/Bash/BackupBigExclude.txt /home/bob/ /media/harddrive/backup
Explanation of commands:
rsync: this is the program used to sync the data. Rsync basically can check the destination data and see if any changes have been made in the source data so that ONLY the source data that has been changed is updated. VERY useful.
-r: copies directories recursively
-l: copies symlinks as symlinks
-t: preserves modification times
-D: preserves device and special files
-v: shows output (verbose)
-u: skips files that are newer at the destination
--modify-window=1: this is essential if you are backing up to a filesystem that is NOT ext3 or ext2, e.g. NTFS or FAT32. Basically in windows filesystem times are kept as even numbers. This command tells rsync to ignore file changes that are only 1 second in difference from the original. It is almost impossible that you will create a file, sync it, and in ONE second make a change and want to sync it again. So it is safe to use this option and it means that rsync will not back up everything every time simply because of a one second change.
--progress: simply shows the progress
--delete: this is important. Basically rsync syncs files that have been changed. But what if you delete a file from the source directory? This command deletes it from your backed up hard drive as well.
--delete-excluded: this deletes folder/files that you have specifically excluded.
--exclude-from=/home/bob/Bash/BackupExclude.txt: this is the other crucial command. This basically tells rsync to exclude the files/folders found in the list BackupExlude.txt. To create this list do the following:
Now in the text editor it is entirely up to you what you want to exlcude.
This is my list:
I am not backing up my MyDownloads directory as I download a lot of files/data some of which I do not want to backup. and I am not backing up my .VirtualbBox directory as its a massive 2gb file that will update every time I log into VB, a waste of time/resources. Just list the files/folders here that are in your home directory that you do not want to backup
Here are some other hints/tips for the exclude command file:
1. To exclude hidden directories (all the directories that start with .) do: .*/
2. To exclude hidden files (all the files that start with .) do: .*
locations: the /home/bob and /media/harddrive/backup tells the script where to backup from and where to backup to.
There are numerous other settings/commands you can use, including compression, etc. My method is simply to have a place where I can access all my data with minimal hassle.
Suffice to say these commands are quite technical, but they all work for me.
Save the files.
Now open a terminal and type the following:
This should run the backup, it may take a long time depending on how much data you have.
NB: Make sure you take care when changing any settings. If you are unsure please ask. In fact don't even change the location without first confirming.
For example, You want to backup /home/bob/ to backup /media/harddrive/ and you have lets say data x.txt, y.txt, z.txt on /media/harddrive/. If you do not create a separate folder all data on /media/harddrive will be erased. SO BE CAREFUL!
For more information on rsync commands see http://www.samba.org/ftp/rsync/rsync.html.
Saturday, January 3, 2009
You have an external (or internal) hard drive that has been formatted using the "ext3" filesystem for Linux. Unfortunately, Windows cannot read ext3 natively.
The program "Ext2 IFS" (despite its name) has the ability to display your ext3 formatted hard drive in Windows XP.
1. Navigate to: http://www.fs-driver.org/
2. Download the executable file.
3. Connect your ext3 formatted hard drive
4. Install the Ext2 IFS executable.
5. Follow the prompts and you should be able to see your drive in the windows explorer.
Till now I have not had any problems with this and I have been able to use this tool for everything from copying files to watching movies.
Thursday, January 1, 2009
Wednesday, December 24, 2008
Thursday, December 18, 2008
Since Hardy I have had numerous issues with the audio on ubuntu. Apparently since Hardy the PulseAudio driver was being used and this created a whole host of compatibility issues. While some programs worked fine, others did not. Since I could see no benefit from Pulse I decided the easiest thing to do would be to remove Pulse entirely.
First, we need to remove the pulseaudio package, open a terminal and type:
$sudo apt-get remove pulseaudio
$sudo mv /etc/X11/Xsession.d/70pulseaudio /etc/X11/Xsession.d/70pulseaudio.bak
$sudo apt-get install esound
Now we need to setup Gnome Sound preferences:
1. Open System > Preferences > Sound:
Make sure everything is set to "Autodetect" (as in the screenshot) and set Sound Capture to "ALSA".
2. Open System > Preferences > Sessions:
Uncheck "PulseAudio Session Management"
Finally, restart the computer and everything should be working fine.
You want to assign short-cuts to your function (F1-F12) keys.
The basic shortcuts:
1. Browse to System>Preferences>Keyboard Shortcuts
The more advanced shortcuts:
1. Open a terminal and enter:
$sudo apt-get install gconf-editor2. Click "ALT+F2"
3. Type in "gconf-editor"
4. Browse to apps/metacity/global_keybindings
5. Here you can change the values for each "run_command". As is shown in the example (above).
4. Now browse to "keybinding_commands"
5. Here change the corresponding command (e.g. if you set run_command_10 to F10, then here you will have to change command_10). It is difficult for me to suggest any particularly useful command, however, any command that you run in the terminal can be run from here. As an example my commands do the following:
F1 - opens a terminal
F2 - opens gedit (text editor)
F3 - opens nautilus
F4 - opens nautilus as root
Ctrl-Alt-Del - opens up the gnome system monitor
If you would like suggestions please comment.
While most of these issues have been fixed in Intrepid, the iPod still remains problematic in Linux. This is a guide I have put together on the most effective way of using the black 80gb iPod Classic with Amarok 1.4 in Hardy Heron (although it could apply to any distribution).
NB: Going to start RIGHT at the begining, so I am assuming that you have ALL your music somewhere on your computer, and not just on your iPod.
Cleaning out your iPod
1. Connect the iPod.
2. It should appear in nautilus (if it does not, see below)
3. Browse to the iPod folder.
4. You should see the following folders: Calendars, Contacts, iPod_Control, Notes, Recordings.
5. Delete everything (NB: This erases you're iPod to factory settings erasing everything, including Music, Pictures, Videos, and Contacts)
6. Eject you're iPod.
7. Wait a bit and the apple logo should appear on the iPod
8. Select you're desired language.
If you're iPod did not automount do the following:1. Create a folder in the media directory:
$sudo mkdir /media/iPod2
2. Check where the iPod is mounted:
$sudo fdisk -lWhen you find the iPod (it should be FAT) make a note of what it says (e.g. /dev/sdf)
3. Type in the following
$sudo mount /dev/sdf /media/iPod2(Where /dev/sdf/ is the location of the iPod from step 2).
Amarok and Libgpod3
For Hardy Heron and newer:
1. In a terminal:
$sudo apt-get install amarokFor Gutsy Gibbon and older:
1. First to install the latest libgpod, in a terminal enter the following:
2. Installing amarok (NB: if you already had amarok this will overwrite everything!)
$cp /etc/apt/sources.list /etc/apt/sources.list.tmp
$echo deb http://gb.archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse >> /etc/apt/sources.list
$aptitude install libgpod3 libgpod-common
$aptitude install amarok3. Removing the old libgpod
$aptitude remove libgpod(this may prompt you to remove the ubuntu-desktop package, don't worry - it's only a meta-package)
4. Remove the newly added source
$mv /etc/apt/sources.list.tmp /etc/apt/sources.list
Setting up Amarok
1. Here I assume you know how to use amarok (i.e. adding music, doing your own customisations, etc).
2. After you have done all that connect up your iPod.
3. Go to devices and your iPod should appear here (you may have to click connect) - you will be asked to "Initialize your iPod", say OK"
4. Set your iPod model by going to iPod (just below main toolbar on top)>Set iPod Model>Classic>80gb or 160GB (black or silver).
5. Next go to collection and right click on whatever songs you want to transfer and select transfer to media device.
6. Next go back to device tab and select transfer (from the top).
1. Click on the gears next to where it says iPod, this should open up a dialog for mounting and post-disconnect commands.
2. Leave the mount command blank and put the following in the disconnect box:
eject -t -d %d3. Click OK
4. WAIT for everything to complete (including on the bottom statusbar of Amarok which should say Flushing iPod Cache).
5. When everything seems to have stopped click on iPod>Update Artwork (this may take a while depending on the number of songs, but after it is done you will see Artwork updated on the bottom).
6. Click disconnect, it should say device successfully disconnected.
7. Now right-click on the iPod icon (either in nautilus or on the desktop, and select eject).
NB: All of this worked for me and my iPod is running fine with music AND videos.
The wireless card seems to be switched on but it does not not pick up any networks and is essentially useless.
1. Open a terminal
2. Input the following:
$sudo modprobe -r iwl39453. In the blank file enter the following:
$gksudo gedit iwl3945
alias wlan0 iwl39454. Save the file and close it
5. In the terminal:
$sudo modprobe iwl3945Wait a few minutes and hotspots should start showing up.
$sudo ifconfig wlan0 up
Lets say you have just downloaded a .tff font file, but don't know how to use it within OpenOffice.
1. Browse to your home directory (e.g. /home/bob/)
2. Click on "View" and tick the "Show Hidden Files" option.
3. Now a bunch of folders should become visible.
4. Look for the ".fonts" folder. If you cannot find it, create it.
5. Copy the .tff font files into this folder.
6. Restart OpenOffice
Good resource for fonts: www.dafont.com
Wednesday, December 17, 2008
You have installed Ubuntu and then realise that you need to dual-boot with windows. Unfortunately, after you install windows, in a separate partition, GRUB (Grand Unified Boot loader – the thing that tells ubuntu to load) gets erased! How do you successfully dual-boot?
1. Boot off the Ubuntu LiveCD
2. Open a Terminal and type in the following commands, noting that the first command will put you into the GRUB "prompt", and the next 3 commands will be executed there; also note that hd0,0 implies the first hard drive and the first partition on that drive, which is where you probably installed GRUB to during installation:
$sudo grub3. Reboot (removing the LiveCD), and your boot menu should be back.
$ root (hd0,0)
$ setup (hd0)
Putting windows into the GRUB file, so that you can dual-boot:
1. Open the GRUB file:
$sudo gedit /boot/grub/menu.lst2. Scroll to the bottom and add the following:
title Windows XPNote that you should also verify that hd0,0 is the correct location for Windows. E.g. if you had installed Windows on the 4th partition on the drive, then you should change it to (hd0,3).
Now when you restart your computer, hold down ESC and you will enter the GRUB menu
While Ubuntu's theme is great, I personally prefer the slick brushed metal look of a mac. This is a quick guide on how to change Ubuntu's theme to make it look like Mac OSX:
1. Go to:
http://sourceforge.net/projects/mac4lin/ and download the mac4lin package.
2. Right-click on the downloaded file and click "Extract here"
3. Open a terminal and browse to the newly created folder:
$cd Mac4Lin_v1.0_RC14. Execute the install script:
$./Mac4Lin_Install_v1.0_RC.shThats it, just follow the prompts!
1. Usually when you download a program that needs to be compiled it comes zipped. Therefore, you need to run the following command from the terminal t0 unzip it:
$ tar -xvf packagename.tar.gz(usually the package will be in the tar.gz format, but it may not so you may have to change the extension)
2. Naviagte to the newly created folder:
$cd packagename3. Now use the following commands to begin the compiling process:
$ sudo apt-get install build-essential(NB: the ./configure command may fail as many packages do not have that specific file, ignore it).
$ sudo make
4. Now you have two options as to how you want to compile, you can use the old method which will simply compile the program, or the newer method which compiles the program and creates a .deb package which you can then use to install the program. The advantage of the later method is that a .deb package is much simpler to install (just double-click on it, like a windows .exe file) and the .deb package will be in your package manager (e.g. synaptic) so you can easy uninstall it from here.
a) Old Method:
$sudo make installb) New Method:
$sudo checkinstallThe program should now be installed!
Lets say you have set up your ubuntu installation with all the packages you need. Now you want to backup all the installed deb files so that you can restore them quickly and efficiently.
Why would you want this?
When I was using windows I had a directory of every single program that I had downloaded and installed. For one thing it would be easier to install everything as I would not have to go online and hunt for them. It would also be useful when a computer does not have internet connection. In ubuntu "hunting" for programs is a rare occurrence thanks to the fantastic package managing system. However, I personally have about 20-30 programs that I have either compiled from source (using checkinstall), or downloaded debs from obscure locations. Now each of these debs I will save in a directory so that in the future I do not have to go hunting for them. With this command all the installed packages are backed up, including the ones in the package manager. So, why would you want that?
Firstly, this is very useful if lets say you have setup a very basic installation with all updates, and all non-free video/audio codecs. Further, you have installed some basic software. Now lets assume you want to install the same setup on someone's computer who does not have internet. Using this script you can have all your debs in one simple location, so you will not have to re-download everything.
Secondly, lets assume you work for a school, or a company, and you need to install the same ubuntu installation (with the same software) on 30 computers. Wouldn't it be easier to simply put all these debs in a central server and issue the dpkg -i *.deb command. This way you don't have to individually select the packages and the packages don't have to download.
Thirdly, (and this is purely personal) I like to be able to have all my installed packages at hand. This command doesn't take much effort, and for me it only requires 1.4 gb of space, so for a bit of piece of mind I can easily have all my packages on hand. There is no real reason to do this if you are already doing a full system backup (e.g. an image of your Ubuntu partition using partimage). This is just something I discovered and feel could be beneficial to other users.
Open a terminal and paste the following into it:
$ sudo apt-get install dpkg-repack fakeroot(the last command will take some time)
$ mkdir ~/dpkg-repack; cd ~/dpkg-repack
$ fakeroot -u dpkg-repack `dpkg --get-selections | grep install | cut -f1`[/code]
Now if you scroll to your home folder, you should find a folder called "dpkg-repack" which should have all the deb files of all your installed packages.
If you want to re-install the packages, navigate to the folder with the packages and input the following command in the terminal:
$ sudo dpkg -i *.deb
You want a quick and effecient way of backing up all the installed packages and re-install them after reformatting your computer.
1. Open a terminal.
2. Enter the following command:
$ sudo dpkg --get-selections > installed-software
This will create a file called "installed-software" in your home directory, listing all your installed packages.
3. To restore all the packages:
$ sudo dpkg --set-selections < installed-software
$ sudo apt-get install dselect
4. Scroll to install
You may need to repeat the last step multiple times to make sure everything has been installed.