Miscellaneous things you ought to know

Here's a selection of topics that it might benefit you to know when trying some of these tips, but which i have been unable to mention above.

Understanding disk partitioning when you installed ubuntu you probably repartitioned your disk. The hard disk partition containing Windows was shrunk and two new partitions were created alongside it for Ubuntu: root and swap. The root partition is simply ubuntu's main partition where all the data is stored. The swap partition is the same as the swap file under Windows (sometimes known as the paging file), except that it is housed within its own

Figure 2.14: Changing file/folder ownerships


What's important to many tips in Ubuntu Kung Fu is how Ubuntu refers to the partitions. Every item of your PC's hardware under Ubuntu is represented as a virtual file in the /dev folder. If you installed Ubuntu in the standard way, opting for default installation choices and dual-booting with windows, the windows partition is referred to on a technical level as /dev/sda1, while Ubuntu's root partition is usually referred to as /dev/sda5 (assuming you're using Ubuntu 8.04 Hardy Heron or later).15

14. Actually, the swap partition is not exactly the same as Windows' swap file. The swap partition is also used to hold the RAM contents when the hibernation power saving mode is used. This is why the swap partition will always be the same size as your RAM, or larger.

15. The installer of Ubuntu 8.04 (and later versions of Ubuntu) first shrinks the Windows primary partition and then creates an extended partition for Ubuntu's root and swap partitions. This explains why the root and swap partitions are numbered sda5 and



File Edit View Jerminal Tabs Help

[email protected] /dev/hdal

Is: cannot access /dev/hdal: No such file or directory

[email protected]:~S Is /dev/sdal


[email protected]:-$ |

Figure 2.15: Checking to see how the hard disk is referred to

However, your computer might refer to the Windows partition as /dev/hda1 and Ubuntu's root partition /dev/hda5. The only difference is that the "s" is swapped for an "h". This difference in nomenclature is simply down to what hardware drivers are used for the motherboard chipset; there's absolutely no other significance in the case of a standard desktop or notebook computer.

To find out which side of the fence your PC sits on, open a terminal window and type Is /dev/hda1. If you see the following error message:

ls: cannot access /dev/hda1: No such file or directory

...then your computer uses the /dev/sda references. See Figure 2.15 for an example. If you see a file listed, and no error message, then your computer uses the /dev/hda references. If that's the case you will have to do some substituting when reading the tips—every time you read /dev/sda, regardless of the number that follows, you will have to type /dev/hda.

sda6 respectively, rather than simply sda2 and sda3, as is the case with earlier releases of Ubuntu, where the root and swap partitions were created as additional primary partitions.

For example, Tip 223, on page 258, explains how to fix file system errors. At one point you're told to type sudo fsck.ext3 -f /dev/sda5 into a terminal window. If your computer is one of those that refers to the hard disk partitions as /dev/hda, you would have to type sudo fsck.ext3 -f /dev/hda5 (incidentally, don't try this command without reading the tip first!).

If you installed Ubuntu on a computer that had no operating system, Ubuntu's root partition will be the first on the disk, so will be identified as /dev/sda1 (or, of course, /dev/hda1).

The boot loader software used under Ubuntu, known as GRUB, counts hard disk partitions not from 1 upwards, but from 0. So it would refer to /dev/sda5 as the fourth partition. On a dual-boot system with both Windows and Ubuntu installed on the hard disk, in the language used in the GRUB configuration file (hd0,4) refers to the Ubuntu root partition on most systems with Windows installed alongside. The Windows partition will be referred to as (hd0,0). If Windows isn't installed then Ubuntu's root partition will be referred to as (hd0,0). It doesn't matter to GRUB whether Linux refers to your hard disk as sda or hda.

Watching out for Wubi

From Ubuntu 8.04 onwards, it's possible to install Ubuntu within the existing Windows file system if you intend dual-boot, thus avoiding repartitioning the disk. Effectively, the Ubuntu partitions (root and swap) are created as large files within the Windows file system.

However, aside from possibly being a little slower in operation, there is not much difference between a Wubi and standard Windows installation. The user chooses between Windows and Ubuntu at boot-up, using the standard Windows boot menu, after which the Ubuntu boot menu appears as usual and everything that follows is the same as a standard Ubuntu session.

The main difference for readers of this book is that the tips in this book that talk about manipulating partitions won't apply. Nor will those that talk about accessing the Windows partition, because this is off-limits due to how Wubi operates.

Getting help if you need it

Help is never far away when you're using Ubuntu. I mentioned the man command earlier in this chapter. Other built-in documentation worth reading is that contained in /usr/share/doc/. There you'll find a folder for virtually each piece of software installed on the system, and, if you're lucky, inside will be a README file that will run-through what the software does and how it can be used. This file can be read using the less command, or opened in Gedit.16 The README is usually more informal and not as strictly technical as man pages. There are usually several other files in the folder relating to copyright and authorship, but the one other file worth reading—if present—is README.Debian, which contains specific information about how the program is configured to run on your system.

As always, the internet can be a gold mine of information. Your first port of call should be the Ubuntu Kung Fu community site—http://www. ubuntukungfu.org, where you can talk to other readers and, if he's around, the author of this book. Other than this, the primary source of help for all Ubuntu users is undoubtedly http://ubuntuforums.org, which is the official meeting place for the ubuntu community. Another forum worth visiting is http://www.linuxquestions.org which, while catering to all renditions of Linux, has a very strong ubuntu section.

Command-line text editors

There was a time when discussing command-line text editors was the equivalent of walking into a lion's den wearing a shirt made of bacon. This was due to the intense rivalry between advocates of the emacs and vi text editors.

But I'm not going to recommend either. If it's ever the case that you can't use Gedit to edit a configuration file, i advise you use nano. Although it runs at the command-line, nano is not a million miles away from old-fashioned word processors you might have used. The cursor keys navigate around the text and you can hit [Backspace or [Delete to remove text. To insert a new line, just go to the end of an existing one and hit [Enter).

To save the file, hit [Ctrl ](not [Ctrl] +1 s I). Check the filename is correct and then hit Enter. To quit the program, hit [Ctrl ]+[x|. If you've made any changes since you last saved, you'll be prompted to "save modified buffer". This is just another way of asking if you want to save the file. Hit [y to do so, or Q if you want to abandon your changes.

16. Some README files are gzipped, so have the .gz file extension, but these can still be read using less—decompression of the file is handled automatically.

Was this article helpful?

0 0

Post a comment