Sunday, 27 September 2009

Ubuntu Tip: Simple Backup Command Using CP

Backing up your computers hard drive is extremely important. Should the worst happen and you lose all of your important data, you need a way back. While there are many excellent utilities in the Ubuntu repositories that handle partial and full system backups. Sometimes a simpler solution is all that is needed.

Fortunately Ubuntu and Linux in general in fact comes with everything you need in the for of the very simple but also extremely powerful cp command. In case you haven't figured it out yet, cp is Linux command line speak for copy. The examples below will show you how to use cp to back up your entire system.

sudo cp -r -u -x -v [source directory] [destination directory]

Example 1:
sudo cp -r -u -x -v /home/ /media/MY_USB_DRIVE

sudo: Gives temporary root privileges.

cp: Linux command line copy command.

-r: Used with cp this switch causes cp to copy directory content recursively. Meaning it will copy all files and subdirectories in the directory being copied.

-u: Used with cp this switch causes cp to only copy files that have changed or don't already exist at the destination.

-x: Used with cp this switch stops cp jumping to other file systems which it will do if it encounters hard links or symbolic links.

This switch also stops cp eating it's tail if you choose to back up your entire system. See examples 2 and 3 below.

-v: Used with cp this switch cause cp to give feed back on what's happening.

Full System Backup With CP
If we wish to perform a full system backup then we might feel inclined to use a command similar to that in Example 2 below. The trouble is without the -x switch cp will also attempt to backup the backup to the backup. Basically eating it's own tail in a never ending loop until all disk space is used up.

This happens because all other file systems are mounted to a location branching from the root file system. So if root is / then home is mounted to /home. Within Ubuntu all USB drives tend to be mounted to /media/a_USB_drive, etc.

However with the -x switch the command in example 2 will not be enough to back up the entire system if there are several storage devices or file systems mounted to different mount points. To get around this problem we must write a small script that will backup each file system separately. Example 3 shows a small example where the root files system / and /home are backed up separately.

Example 2:
sudo cp -r -u -v / /media/MY_USB_DRIVE

Example 3:
# cp based backup script.
sudo cp -r -u -x -v / /media/MY_USB_DRIVE
sudo cp -r -u -x -v /home/ /media/MY_USB_DRIVE

This script can be created in any text editor like gedit or nano. After the script has been saved it must be given permission to be run as a program. Example 4 shows the command needed to change to the directory/folder where the script is stored. How to apply execute permissions and how to run the script.

Example 4:
First open a terminal window if you haven't already done so and enter the following commands. The actual location of your script is where you chose to save it.

cd /home/aikiwolfie/scripts/ (press enter)
chmod a+x my_backup_script (press enter)
./my_backup_script (press enter)

And that's it. Sit back and watch the backup script do it's job.

Sunday, 20 September 2009

Friday, 18 September 2009

Microsoft Thinks Your Stupid!

Does anybody seriously believe this child just happened to perfectly copy and paste all the key promotional slogans for Windows 7 into a slide show? My nieces and nephews don't even play with Power Point. They jump right onto cbbc and play games!

Boycott Windows 7

Digg doesn't like the direct IdeaStorm link. It does go through a lot of redirections. So here it is.

Redmond Running Scared!

Microsoft are seriously pushing the boat out here. But still manage to put the boot into their UK customers. Why is Windows 7 cheaper in the US for students than it is in the UK? If memory serves me correctly Microsoft pulled a similar pricing stunt with Windows Vista. How much longer are people going to tolerate such shoddy treatment?

The price gap can't be explained purely by exchange rates alone. So what gives? Does Microsoft think students in UK colleges and universities are stupid? Are they just sheep to be pumped dry and ripped off? Why is it Microsoft has decided to climb aboard the "rip-off Britain" band wagon? Any company treating you like this does not deserve your money. Vote with your feet and your wallets and buy something else.

You could also head on over to Dell IdeaStorm and show one of Microsofts largest OEM partners exactly how you feel about Microsoft ripping you off. Register an account and vote to Boycott Windows 7. Better yet, if you're looking for a new netbook to take to college. Order one of Dells Ubuntu Linux based models. Which contrary to Microsofts BestBuy indoctrination FUD are fully supported by Dell.

Of course it's only fair we ask the question. Why are Microsoft being so agressive with their pricing of Windows 7? It can't be because of Linux. Linux is free to download, install and use. You can even get your hands on the raw source code if that's what floats your boat. Linux in short is a fully functional and fully customisable all purpose OS. Ubuntu, which is pre-installed on some Dell netbooks is a fully featured OS with no artificial limts imposed on it. In contrast netbooks with Windows 7 will be running the "Starter Edition".

What is the "Starter Edition"? Basically it's cripple ware. Microsoft in one way or another artificially limit the capabilities of Windows to force you the consumer who has already "paid money" for a legal copy of pre-installed Windows to cough up more cash. Hardly seems fair. But Microsoft have been getting away with it for years.

Note: Windows 7 Starter Edition no longer has the infamouse "3 applications" artificial limitation. Microsoft buckled under preasure of scathing critisim by almost the entire technology press and on-line publications, blogs, twitters and whatever else. If it was talking about Windows 7 Starter Edition (other than the Microsoft Windows 7 blog), the artificial 3 applications limitation was torn apart.

Saturday, 5 September 2009

I Want To Be Blissfully Ignorant

Okay I demand to be told what is in the water these people are drinking. I personally feel it is my God given right to be this blissfully ignorant of the world.

Friday, 4 September 2009

Ubuntu Tip: How To Mount ISO Disk Images

If you use .iso CD/DVD images here's how to mount them from the command line or in a terminal window.

Open a terminal window and type the following commands;
  • sudo mkdir /media/iso
  • sudo modprobe loop
  • sudo mount filename.iso /media/iso -t iso9660 -o loop
  • mkdir creates a new directory. This directory will be used as a "mount point" by Ubuntu to allow you access to the .iso file. In reality any directory can be used. It's good practice however to use a clearly defined location. You avoid problems and keep your file system clean and tidy.
  • filename.iso is the name of the iso file you wish to mount. Substitute "filename.iso" for the name of your .iso file.
  • To unmount the file use the following command: sudo umount /media/iso or whatever you called your new mount point.

Wednesday, 2 September 2009

Five Best Disk Defragmenters

This article Five Best Disk Defragmenters from Lifehacker which I came across while browsing through took me back some. All the while Randall C. Kennedy is bitching about GUIs that don't meet his high journalistic standards and Linux design concepts "contaminating" Windows, Windows users are still defragmenting their hard drives? I mean seriously!

I can remember having to defrag my hard drive when I was using MS-DOS 6.22, Windows 3.1, Windows 3.11, Windows 95, Windows 98, Windows 98 SE and Windows XP Professional. I can remember setting the PC upat night to run it's course and it still wouldn't be done by morning.  In the days of MS-DOS to Windows 3.11 I only had a tiny hard drive. A few hundred megabytes of capacity. When I got Windows 95 I moved up to a Quantum Bigfoot 1 GB drive. Which back then was huge! With Windows 98 and 98 SE I leapt up to 8GB and 10GB drives.

Defragging my PCs hard drives back then seemed to take forever. It was something you planned in advance. You'd have to clear your schedule for the week and mark it in the diary before hand. And after all the effort to get your files sorted out into easily accessible contiguous blocks of data, they were all messed up again as soon as you used your PC. Defragging was and still is a truly pointless endeavour. And Windows users are still doing this?

I was of the impression Windows Vista was supposed to have ushered in a new era? Windows 7 was to build on that and make it better? Why then are Windows users still behaving as though they're using MS-DOS? With my current Dell XPS 720 I have 1.5TB of internal storage on the hard drives and an addition 1TB extrenal drive. That's 2.5 terrabytes in total I'd have to defragment if I were still using Windows. The very thought alone gives me hives.

In my opinion defragmenting a hard drive on a PC is not only pointless. It's archaic. It's pre-stone age technology. Nobody should have to do this any longer. There are file systems out there in the real world being used everyday that essentially avoid this problem altogether. I've never defragmented a Linux hard drive. Not when I was using Red Hat Linux years ago. Not While using openSuSE and never while using Ubuntu. It's something I have simply never needed to do. It didn't even enter my mind until i read the Lifehacker article.

Microsofties really need to wake up and demand better from their masters.

Ubuntu Tip: How To Install 32-bit .debs In A 64-bit Ubuntu

This is a very simple tip for Linux users and in particular Ubuntu users. If you're running a 64-bit version of Ubuntu you will occasionally need to install a 32-bit application. The very awesome World of Goo for example only comes in a 32-bit package. It does however run just fine on 64-bit Ubuntu 9.04.

Simple double clicking on the 32-bit .deb package will throw up a "wrong architecture" error. The way around this is to use the "--force-architecture" switch from a terminal window. See the example below.

  • sudo dpkg -i --force-architecture Desktop/WorldOfGooSetup.1.40.deb

Before we can do that however there are a few preparations to make. We must make sure all the supporting 32-bit libraries are also installed. To do this open a terminal window and enter the following command.

  • sudo apt-get install ia32-libs

And that is really all there is to it.

News Just In! Randall C. Kennedy Becomes Even More Pointless!

Lacking any real news to report and desperately needing to fill a void left by Steve Ballmer after excavating Randalls' sphincter, Randall C. Kennedy has resorted random attacks on everything and anything not of Redmond.

Apple takes the first hit in a childish tantrum regarding Apples' advertising antics. Before they'd even started. It seems Randall has a case of the iGitters. Moving on however, next up for the chopping block was Googles' own Linux based OS. Chrome OS.

The short,snappy and memorable title of this particular blog entry "Will Chrome OS collapse under the weight of it's own Web browser?" would seem to imply Chrome OS is overweight. Morbidly obese one might say. Which is somewhat odd considering Windows not only seems to require a new PC with every iteration. But some how manages to devour the storage space on the hard drive like a fat chick let lose in a cake shop. Windows appetite for devouring system resources is so unseemly Microsoft considered it to be a huge achievement to get a tweaked version of Windows 7 running on a netbook.

Speaking of which. I'm sure I'm not the only one who's noticed netbook specs have been on the up and up. In fact if it weren't for the 32-bit x86 based Atom CPU at their heart they'd be fully fledged notebooks with smaller screens.

Randall can't stop at bitching about Apple or Chrome OS though. Next target is the Linux desktop. The rather ironic title "Will desktop Linux ever grow up?", implies desktop Linux isn't ready to be the headline act. I'm pretty sure Canonical and others would disagree. Sharp in particular has just released a new Ubuntu based MID in Japan. One of the largest economies in the world no less. Brazillian education (52 MILLION NEW USERS) has all but abandoned Windows and Microsoft products entirely and Microsoft for the first time have included HP and Intels' Linux efforts as a threat to their business on their recently filed 10-K report.

Lacking any real complaints about the Linux desktop Randall unwisely decides to pick on maintain the X server. Randalls gripe with this? The code has a 30 year history! Oh gosh quick we better not use it. Software does after all corrode with time doesn't it? Actually no it doesn't. Planned obsolescence, crap design and a total lack of foresight is what makessoftware bog down over time.

If the code is well maintained and properly looked after 30 years of service is a good sign of maturity and not decrepitude. X has served Linux and other NIXs well over the years. Better still it's going through a major overhaul right now as you read this to meet modern demands. Yes these changes break drivers. All major changes to an OS breaks something somewhere. For example when Microsoft implemented their new driver model they broke driver compatibility with XP. Then broke it again and again and again until their partners got fed up and did things on their own schedule leaving many Vista users with crap driver support for weeks if not months after the official release. ATI and Nvidia were amongst the companies that failed to deliver decent drivers on time. OUCH!

Next up it was Snow Leopard. Randall completely and I suspect deliberately misses the point of Snow Leopard. Unlike Windows 7, Snow Leopard isn't just a cosmetic make over. It's a re-plumbing of all the tubing and technical bits underneath the shiny Apply GUI that Windows and Linux users can't stop trying to emulate with theme packs. While the enhancements to Snow Leopard don't really help existing third party software. All Apple software has been rewritten to take advantage of them and third party offerings won't be far behind.

As a result of Apples tinkering with Snow Leopard, OS X has a smaller installed foot print and runs considerably faster. The net result of Windows 7 is a version of Vista that looks decent, is less secure and doesn't crash as much. BSODs are also still a coveted feature.

Finally we get to Randalls latest Cephalopoda like spaz attack with tentacles flailing every where desperately grasping for a target. "The 'Linuxification' of Windows has begun". Okay then. This "blog entry" has me seriously bewildered. FileZilla, VirtualBox and the Gimp all come under fire. For one reason or another their GUIs just aren't good enough. Apparently all GTK+ GUIs are a complicated ill designed blasphemous disaster. They should carry a public health warning. VirtualBoxs' error dialogues are clearly hazardous to ones health. Of course Windows BSODs are so intuitive. I speak in HEX daily. In fact I refuse to speak anything but HEX codes unless absolutely necessary.

Seriously, does InfoWorld actually pay this man-child to write this tripe? It's not helpful, it's not informative, it's not even a fully formed and thought out opinion. It's just random crap drugged up to draw attention away from the competition and back to Microsoft? Microsoft PR must be cringing right about now. At least they tried to spice up their tripe with some Photoshopping.

Well I have more bad news for Randall. Maybe this will send him completely over the edge. Dell are releasing an Android based smart phone in China. Remember Android is Linux based Randall. Now when will Linux grow up? I wonder? Who Runs Ubuntu Linux?

It really is time to wake up Randall. The Linux kernel is in one form or another embeded in every facet of your life. Remember when you use the Internet or a DVD player or a satnav, you're using Linux.