ubuntu dual boot illustrated site ubuntu dual boot windows 7 maverick meerkat
Filesystems Page

Edited Saturday, February 04 2011 Document made with KompoZer

This web-page is part of a larger site giving examples of how to install Windows+Ubuntu Linux operating systems 'dual boot' in a computer.  Illustrated Dual Boot HomePage
                                      
PAGE INDEX



Modern new ways to do things in Ubuntu - managing file systems is easier now

Click-Icon Mounting  -  Mount file systems the easy way in Ubuntu Hardy Heron and later

How To Set File System Labels With GParted - recommended

Running a filesystem check with GParted - a user friendly GUI method

Why Linux filesystems never need defragging - (a link to a nice external site)

Filesystem mounting basics  If you're new and want to learn, this explains things a little.

Traditional and other Linux methods

The 'mount' Command Method For Mounting
You can use this old traditional method when running Gutsy Gibbon and older Live CDs or a hard disk installed operating system. This method can be used for regular work or for file rescues.

Mounting Filesystems with the mount command - Traditional olde reliable method

Rescue your Linux system with a Live CD - includes commands for opening vital files


Edit /etc/fstab Method for Mounting
This method is mainly useful when running Gutsy Gibbon and older hard disk installed operating systems, but with this method the mounting is done automatically at boot up.

Edit /etc/fstab Method for Mounting

Mount an .iso file in /etc/fstab

Updating /etc/fstab filesystem UUID Numbers

File Ownership and Permissions - fix read, write, execute and ownership issues



Ext2, Ext3 and Ext4 File System Section

Running a filesystem check on an ext4  filesystem - from the command line, live CD

What to do if your file system doesn't fit your partition - resize2fs

How to take a look at your ext4 superblock

What to do if you have a bad ext4 superblock

Recovering files from lost+found - with advice from confused57

Make a label for your ext4 file system - give your ext4 file systems descriptive names

ReiserFS

Running a filesystem check on a reiserfs filesystem

Setting a Volume Label in a Reiser File System

BTRFS -  Link

JFS -  Links

XFS -  Links

SQUASHFSHow to mount casper -rw in persistence USB install

FAT32

When the bootsector is not the same as its backup - FAT32

Running a filesystem check on a FAT32  filesystem

FAT32 usbdisk volume label give your FAT32 usbdisk a pet name

NTFS

NTFS and FAT32 file system repair and maintenance - Windows CHDSK - Linux ntfsfix

Restore an NTFS boot sector with it's backup 

CD and DVD File Systems

Mounting an .iso file

genisoimage commands for making .iso files to burn to CDs and DVDs

Floppy Discs

Mount a floppy disk

Filesystems checks at Boot-up

Automatic filesystem checks on bootup

Running a check for bad blocks on your hard disk - test your hard disk

Smartmontools - check your hard disk's health records

Avoiding filesystem damage      (Proper Emergency Shutdown Procedures for Linux)

To find and 'kill' a runaway process

Proper techniques (in the event of a frozen system) to prevent filesystem damage

Emergency Shutdown Procedures for Linux

Links About Linux Filesystems


What is a file system?

The surface of the Earth can be divided up with imaginary lines of latitude and longitude so that  co-ordinates on a map can be recorded and used to describe the exact location of a real feature or object on the ground,  at sea or even in the air.

A hard disk is similarly divided up, but hard disks are shaped like flat platters and not spherical or geodal.
Early hard disks used to be divided into cylinders, tracks, blocks and sectors. They used to call that 'CHS Addressing'. For the last ten years or more we use LBA, 'Logical Block Addressing' meaning the sectors are just numbered from the start of the disk to the end something like frames in a roll of movie film. Data in a hard disk is stored in sectors. Each sector can hold up to 512 bytes of data.  They're numbered from the outside edge in starting at 0, (the MBR).

It is possible but not very practical to use 'dd' commands to write data to a hard disk without having any file system. If we did that we would need to be able to remember the exact sector numbers where we stored certain files or else we would have a hard time looking that information back up again. Maybe we would write the sector numbers down on a piece of paper. That paper(s) could then be said to be serving as our file system. That would be a very slow and tedious way of doing things. We'd probably need a filing cabinet to store all the paperwork. That would be a physical file system.

Why not make the computer do the work for us?
Well that's pretty much what happens. We 'format' a partition with a file system. We dedicate part of the disk itself for storing the information about where the files are stored, kind of like a map of the disk.
The kind of file system I'm talking about now is a digital file system and includes an elaborate set of rules for the operating system's kernel to use for writing files to disk and automatically record where it left them so it can look them up and find them again later. Linux operating systems can work with many different kinds of file systems, FAT16, FAT32, NTFS, ext2, ext3, ext4, reiserfs, reiser4 and jfs, xfs and so on.

In order to do this, we need some sectors reserved for the file system itself and there are special sectors reserved for recording 'metadata'. 'Metadata' is 'data about data', and is used to record details about the files we're going to store. Metadata includes exactly where each file is located on the hard disk, as well as other properties such as the file's size, time and date the file was first created, when it was accessed and when it was modified, who owns the file and what file permissions are set for that file and so on.
When it's time to read the files again, the kernel refers to these metadata blocks to learn the file's location on disk. If the file is modified it writes the changes to disk and updates the metadata. I am trying to be very brief here. If you want to learn more a good place to start is here, Understanding UNIX / Linux file system - Nixcraft

If you want to do an experiment to see how much room a file system takes up in a partition, just use GParted to create a partition in a spare disk of some kind, maybe an empty USB flash memory stick for example. Format the partition with a file system and you will see that even though it is empty, GParted will show you a graphical representation showing that some of the space is already occupied. That's the amount of room used by the file system itself. This is called 'file system overhead', and different file systems have different file system overheads, (useful to know if you need to install in a very small disk). You will also find that there are limits to the minimum size you can shrink partitions with variuos file systems in them too.

To the user, a file system appears as a directory tree structure, with directories containing more directories and files.
The top level is called 'root', and it is usually symbolized with a 'slash' symbol, like so: /
There are around 20 directories in / (root), and they each contain different sorts of files.
A 'directory' is just another name for 'folder', in case your new here.
Here's a link about that: Linux's directory structure - Tuxfiles.
And another link: The Linux filesystem explained - FreeOS.com

That's my attempt at explaining what a file system is. 'In a nutshell'.  I'm not sure if I'd get full marks for that in an exam if I had to pass one, but that's the best I can do so far.


Click-Icon Mounting

Mounting file systems is now a lot easier since Ubuntu Hardy Heron than it used to be in earlier versions of Ubuntu.

The easy new way to mount a file system in mdern versions of Ubuntu is to just go looking in the 'Places' menu and click on the icon for it.

p10/001.mount.png
If your icons appear with generic names like '13.2GB Media', don't despair, see my next article about how to label your ext2, ext3 or ext4 Linux file systems, Make a label for your ext3 file system.

You'll be given an icon for it on your Desktop when it is mounted.
p10/002.mount.png
If you only want regular GUI access, just right-click on the icon and click 'Open'.
You can still use Linux commands in your terminal to access your file system if you want.


p10/003.mount.png
It should open for you right away when you click 'Open' if you're using a Ubuntu live CD.
If you're working in a hard disk installed Ubuntu operating system you will be asked for your password.
Once the partition is open if it's just a data partition and it belongs to you then you can normally do what you like, (read/write, copy/paste). Otherwise if it's not yours, access may be restricted subject to Linux file ownership and permissions rules.
If it contains an operating system, you can access your own data files with it, in your /home/username directory and you can easily make a file rescue or backup or restore all your own files.

If you need to make important system changes you can, but since file system permissions may limit what you're allowed to do you will probably need to use Linux commands in your terminal to obtain 'root' or 'superuser' access, see: Rescue your Linux system with a Live CD.


Set File System Labels with GParted
p10/SetLabel.png
Recent versions of Gnome Partition Editor have a great new feature!
You can easily set a volume label for most file systems without needing to use Linux commands.
This feature can be found in Intrepid Ibex and later versions of Ubuntu, or in recent versions of GParted Live CD.
Just right-click the partition you want to set a label for and click 'Label', and give your file system a name.
You can find Gnome Partition Editor in your Ubuntu Live CD under 'System'-->'Administration'-->'Partition Editor', and you can install it in your Ubuntu operating system with 'Applications'-->'Add/Remove (Programs)'.

p10/005mount.png
This is great for those of us who multi boot and those who use USB devices too.
The mount points in /media will be automatically given the name we chose for the label from now on, and therefore the icons will also appear on our desktops with the right labels too.


Filesystems and filesystem checking

Running a filesystem check with Gnome Partition Editor

Even someone who doesn't know anything about file systems or how to use the command line can easily run an effective file system check with Gnome Partion Editor.

Some people seem to be frightened and nervous about running file system checks, especially those of us who are new to Linux. There's nothing to be afraid of and it's a good idea to run a file system check in your Linux file systems whenever you have some spare time. It only takes a few minutes and you should do this every once in a while as a matter of routine. Regular file system checks keep your file system(s) in top shape so your operating system will keep running like a well oiled machine.
Quoted from Linux ext3 FAQ:

Theodore Ts'o said:

It's best to just always run e2fsck. [...]

File systems always need to be unmounted before working on them.  
We can't run a file system check in an operating system partition while the operating system is running. Most modern programs will not allow you to do it or will at least give you warning messages. Do not ignore the warnings. Working on a mounted file system would be something like trying to change a tire on a car while the wheel is still turning. It's not recommended and will most likely cause a lot of damage if you try it.

If you're using GParted and you're trying to check a file system in your computer tha doesn't belong to Ubuntu, you can usually just right-click on the partition and click 'unmount' first.

If you're using the command line instead and you're not sure if a file system you want to check is mounted or not, the old fashioned method was to check with the 'mount' command with no additional arguements.
mount
 That will give you a list of your currently mounted file systems. If the file system was mounted, we used to use the 'umount' command to dismount the file system before we could run a file system check on it.  The Umount Command

One of the easiest ways work on file systems is to boot a Live CD and work on the file systems in the hard disk from the live CD operating system. Most Live CDs won't mount your hard disk's partitions unless you command them to do so.

Ubuntu Live/Install CDs tend to contain very old but stable and well tested versions of GParted.
The Ubuntu Live/Install CDs run a large operating system and therefore they do automatically look for and use any Linux swap area partition that may exist in a hard disk. Sometimes that means you can't work on an extended partition when it contains a swap area that's in use. If that's a problem and you're using GParted you can right-click on the swap area and click 'swapoff'.
The old fashioned method was to use the 'swapoff' command  swapoff when we needed to work on a swap area partition from a Linux Live CD. If you have a computer with lots of RAM as most modern computers do, that won't matter, but in an old, low specced machine made back when RAM was expensive it could freeze the system or slow it to a crawl.

GParted -- LiveCD is a Live CD operating system which is nice and small and light so it does not need to mount any swap area in your hard disk, (or any file system either unless it's explicitly told to). It's made for working on partitions and file systems and contains a relatively up to date version of GParted.
You should always make sure you're using the most up to date version of GParted Live CD.

Parted Magic is undoubtably and without question the best Live CD for file system and partitioning work. It always contains the most up to date version of GParted and other softwares too.
You should always make sure you're using the most up to date version of Parted Magic Live CD.
I highly recommend using the most recent available version of Parted Magic Live CD if you're serious about  your disk partitioning and file system work.
  1. Boot your Live CD, open Gnome Partition Editor and right-click on the partition you want checked. In most versions of Ubuntu it can be found by going  'System-->'Administration'-->'Partition Editor'.
  2. Select 'check' from the right-click menu. If 'check' is greyed out you might need to select 'unmount' first, and then click 'check'.
  3. Click the 'Apply'  check mark button up on the toolbar.
  4. Click the 'Apply' button in the confirmation pop-up window
  5. Watch the reciprocating bar for a few minutes, a very large file system may take a while
  6. Click on the 'Details' triangle to expand the window
  7. Click on the triangle in front of 'Check and repair filesystem (ext4_ on ....)' for details
  8. Be sure to fully expand all details and read what has been done. If it's the Ext file system, GParted will have calibrated your file system and run e2fsck -f -y -v on it for you, and has run resize2fs for you to make sure your file system is the right size to fill your partition.
If you don't do it yourself, Ubuntu will do it for you automatically whether you're ready or not once every thirty or so mounts, Automatic filesystem checks on bootup.
To avoid this happening at an inconvenient time, you can induce a quick startup file system check early,  anytime you like,  by opening up a 'terminal', (Applications, Accessories, Terminal), and typing in the following code:
sudo touch /forcefsck
a file quick file system check will be run automatically the next time you reboot.

 The startup file system checks don't fix much though, they're more just to take a quick look and make sure everything's still okay. If your file system has been damaged by an improper operating system shutdown, such as might be caused by a sudden power loss or the like you will be notified.


Automatic filesystem checks on bootup

The operating system looks at the /etc/fstab file automatically at each boot-up just before the '/' (root file system) and other file systems are mounted.
The hard disk is scanned for the  'Superblock' of each filesystems listed in /etc/fstab  and marked with a '1' or a '2' in the 'pass' column. The superblock contains information such as a counter that counts the number of times the file system has been mounted since the last time it was checked. Normally, file systems are scheduled to be checked around once every 30 mounts, or every six months, whichever comes first. (Some Linux systems, such as servers, may be left running for extremely long times between reboots. I have read of Linux servers running for three years or more without a reboot).  How to take a look at your ext4 superblock.

If you have had a power interruption, or turned your computer off the wrong way, the filesystem will be marked as 'unclean', and your operating system will do a filesystem on re- booting for sure, regardless of how recently it has been checked previously.

With ext4, the file system check is very quick and you won't be kept waiting very long. Always be patient and wait until the file system check completes. Cancelling a file system check that's in progress or rebooting can cause severe file system damage.

Minor errors will be automatically corrected, but if there are any bad problems it lets us know to run another filesystem check manually to fix them.  How to do that is explained a little further down this page, see Running a filesystem check on an ext4  filesystem.

If the filesystem is corrupted or missing we get an error message to say 'Bad magic number in superblock when trying to open /dev/sdx,y'...
Most often this just means that you or I forgot to edit the etc/fstab file with the changed file system UUID numbers after the last time we used disk partitioning software to add or remove one or more file systems.
The filesystems that the operating system expects to be there is gone and maybe there is a different one there instead. Just press 'Ctrl+d' to exit the shell and continue booting, update your /etc/fstab file and most of the time that will solve the problem.

Here are two a great links from 'Tips For Linux Explorers', you should read:
Why Linux filesystems never need defragging

Linux file systems like a file system check now and again, but they never need defragging.

Okay, maybe 'never need defragging' is an exaggerating a little.
They can begin to get fragmented when more than around 80%  of the available space is used up. Make sure your Linux partition is large enough to contain all the files you want and still leave at least 20% spare. If it gets too full, either delete some files or resize your partition.







The Old Fashioned Methods for Filesystem Mounting
What does 'mounting' a file system mean?

When your computer boots up, the boot loader finds your Linux kernel and loads it into the RAM. The kernel runs boot-up scripts and checks the file system before mounting it.
I think of it as something similar to mounting a horse.
In that analogy, you're getting on top of it, (in the saddle), and you're controlling it. (or trying to). So, the Linux kernel is taking control of the file system on the hard disk.

When we 'mount' another file system under the file system we're already using, we are attaching it somewhere, (at a 'mount point'), and the Linux kernel takes control of the next file system too. Now we can read and write to it maybe, or whatever is appropriate.
There are two traditional ways to mount filesystems in Linux, these are,
  1. Mount command method Mount the filesystem with a 'mount' command. This method needs to be repeated after each reboot and is the only way to mounting hard disk filesystems when running a Live CD operating system. It can be used from a hard disk installed operating system as well. 
  2. Edit /etc/fstab method Make a mount point (directory) and edit the /etc/fstab file. This method is more 'permanent' in that the filesystems will be automatically remounted during each boot-up. This method is only for hard disk installed operating systems.
There are three basic steps involved in mounting filesystems in Linux, these are,
  1. Find partition information. To make up our mount command or our line for or /etc/fstab file, we need to know the exact details of the filesystem we want to mount. we have to find out what is the proper device name (partition number) for the partition we want to mount, and also what type of filesystem it has in it. For 'Dapper Drake', we can find out by opening 'System'->'Administration'->Device Manager' and looking there. We can look in 'System'->'Administration'->'Gnome Partition Editor', or we can use the 'sudo fdisk -l' command, and the 'blkid' command for finding the filesystem's UUID numbers.
  2.  Make a 'mount point'. In simple terms, a mount point is just a directory (folder) somewhere that you can open to see and browse the other filesystem. A mount point can be anywhere. I tried making some in my /home/username folder and it worked just fine.  The standard location for a mount point (directory) in Linux is inside the /mnt directory, that's what the /mnt directory is for.  In Ubuntu, we prefer to make mount points in our /media directory instead, because that way we get a nice icon on our desktop we can use to open the mounted filesystem with. That's more convenient than having to navigate to the /mnt directory each time we want to open the file system. 
  3. We issue the appropriate command in a terminal, or paste the appropriate line in our /etc/fstab file. In either case it has to be typed correctly, using the correct syntax.
The rest of this page goes into more details about how to perform each of the above steps.

Tuxfiles is a great website with an excellent page on How to mount filesystems in Linux - 1.1
That can be read in addition to this page, it often helps to read things explained in slightly different ways.


The 'mount' command method for mounting

How to mount Linux ext3 or Reiserfs, 
Windows FAT or NTFS, .iso files and floppy disks from the command line.

Advantages and when to use this method
  •  can be used from a hard disk installed Linux or Linux Live CD operating system.
  •  doesn't slow down your boot-up (filesystem doesn't need to be checked at boot time) 
  •  better for security (the file system is not mounted all the time, only when you want it)

How to use this method
(a) find filesystem details (partition number, filesystem type)
(b) make a mount point if one doesn't already exist
(c) run an appropriate mount command in terminal


(a) find filesystem details (partition number, filesystem type)
One way is to use the sudo fdisk -lu command to list partition details if you are doing this from a Live CD, this is the most popular,
example:
herman@work:~$ sudo fdisk -lu
Password:

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1              63    41576219    20788078+   c  W95 FAT32 (LBA)
/dev/hda2   *    41576220   153276164    55849972+  83  Linux
/dev/hda3       153276165   156296384     1510110    5  Extended
/dev/hda5       153276228   156296384     1510078+  82  Linux swap / Solaris

Disk /dev/hdb: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders, total 58605120 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *          63     2104514     1052226    b  W95 FAT32
/dev/hdb3        56725515    58605119      939802+   5  Extended
/dev/hdb4         2104515    56725514    27310500   83  Linux
/dev/hdb5        56725578    58605119      939771   82  Linux swap / Solaris

Partition table entries are not in disk order

A different command you can use is 'blkid'.  The 'blkid' command is slightly more informative.
Code:
herman@work:~$ sudo blkid
Example:
herman@work:~$ blkid
/dev/hda1: UUID="2629-16F0" TYPE="vfat"
/dev/hda2: UUID="fe7bf845-7ce9-4733-b6de-f70f2b62076d" SEC_TYPE="ext2" TYPE="ext3"
/dev/hda5: UUID="7affdc27-ab39-4b16-91da-e9e8d9b672dd" TYPE="swap"
/dev/hdb1: UUID="44F0-A71B" TYPE="vfat"
/dev/hdb4: UUID="237f0cef-9905-41fb-82ba-bc360fb43a25" SEC_TYPE="ext2" TYPE="ext3"
/dev/hdb5: UUID="191d4618-7b62-41e6-ab41-7bd7a0708244" TYPE="swap"
From this output I can guess which partition will be the one I want to mount and pick out the partition numbers and filesystem type to use for the mount command.

Another way to see which partition, or more correctly, file system, you want to mount is to take a look with a graphical partition editor like GParted.


(b) make a mount point if one doesn't already exist
Use the ls command to take a look in /media to see if there's already a mount point you can use,
Code:
herman@work:~$ ls /media

Example:
herman@work:~$ ls /media
cdrom  cdrom0  floppy  floppy0  hda1

I also used the 'ls' (list command to take a look around in my /media folder to see what's there already. The one called 'hda1' there would be my Windows mount point, there is no mount point there yet to mount my other filesystem in, I will make one myself.


If there isn't one use the mkdir command to make a new directory in /media as your mount point
herman@work:~$ sudo mkdir /media/datapartition
If 'datapartition' is the name you want for your new mount point. You can substitute any name you like for 'datapartition', which I gave here as an example. If you have more than one mount point you will need to make up a different name for each one. Descriptive names are usually best.
If you are making a mountpoint for a Windows partition, you might want to call it 'Windows'.


(c) run an appropriate mount command in terminal
You are welcome to pick out one of these that best fits your needs and copy and paste it into your terminal to save typing. You might need to modify it to suit your computer first before you enter it though.

For a partition with a FAT32 filesystem
herman@work:~$ sudo mount /dev/hda1 /media/windows -t vfat -o umask=000
Where: Windows partition number is /dev/hda1
Where: the mount point you made for it is named /media/windows
Where:  your windows has the fat32 file system
If not, please alter the command to suit your particular computer's setup.
We can do anything we like with the FAT32 Windows filesystem. We can open files with Ubuntu applications and work on them and save the changes, copy files out, and paste files into the FAT32 filesystem. Any 'other' operating system with the FAT32 filesystem is ideal for dual booting with Ubuntu.

For a partition with an  NTFS filesystem
What is NTFS? - ntfsprogs website, www.linux.ntfs.org
herman@work:~$ sudo mount /dev/hda1 /media/windows -t ntfs -o umask=0002,nls=utf8
Where: Windows partition number is /dev/hda1
Where: the mount point you made for it is named /media/windows
Where:  your windows has the ntfs file system
If not, please alter the command to suit your particular computer's setup.
Note: The NTFS filesystem is mounted 'read only', so we can only copy things out of it, we cannot paste things into it or alter any files while they are in the NTFS filesystem.
Thanks to: How to mount you NTFS volume - ntfsprogs website, www.linux.ntfs.org

For a partition with an EXT3 filesystem
herman@work:~$ sudo mount -t ext3 /dev/hda2 /media/ubuntu
Where: Ubuntu's partition number is /dev/hda2
Where: the mount point you made for it is named /media/ubuntu
Where:  your Ubuntu has the ext3 file system
If not, please alter the command to suit your particular computer's setup.


For a partition with a reiserfs filesystem
herman@work:~$ sudo mount -t reiserfs /dev/hda2 /media/ubuntu
Where: Ubuntu's partition number is /dev/hda2
Where: the mount point you made for it is named /media/ubuntu
Where:  your Ubuntu has the ext3 file system
If not, please alter the command to suit your particular computer's setup.

To mount an .iso file

herman@work:~$ sudo mount -o loop -t iso9660 mycdrom.iso /media/mycdproject
Where: the .iso file to be mounted is located in my /home/herman directory
Where:  the name of the file is 'mycdrom.iso'
Where: the mount point you made for it is named '/media/mycdproject'
If not, please alter the command to suit your particular computer's setup.
Note: We can read and copy from a mounted .iso file but we can't write to one.  At least I haven't been able to find out how. To alter an .iso file we mount it so we can copy the contents to a regular directory. Then we do whatever work we need to do, and then make a new .iso file out of the directory with a genisoimage command.
Click the following link to look further down this page for some information about genisoimage commands.
If you want to see a worked example of this process in action, look at this link, How To Build a Super GRUB Disk/GParted/Puppy Linux CD / DVD, you can try it out too if you want!

Mount a floppy disk 
Before you try to mount a floppy disk, don't forget to slide the little plastic square in the corner to close the hole first before you insert it in the drive if you want to write to the disk.

These days with Hardy Heron and later versions of Ubuntu, it looks like we can just go 'Places' --> 'Removable Media'-->'Floppy Drive', as illustrated in Filesystem mounting basics.

Here is the traditional way, using the command line,
Code:
herman@work:~$ sudo mount /dev/fd0 /media/floppy0
Make sure you remember to unmount the floppy disk when you are finished.
Be sure to 'write-protect' your floppy disk as soon as you are finished by sliding the little plastic square to open the extra hole in the corner, so both corner holes are open.
How to Write-Protect a Floppy Diskette - HelpDesk (external link).

Another way to mount and unmount a floppy disk is to install a little program called 'disk mounter' with an icon in your top panel. Just right click on your top panel (Ubuntu for 'tool bar'), and click 'add to panel'. In the window that opens, scroll down and look for 'Disk Mounter', it has an icon that looks like a floppy disk.

Rescue your Linux Operating System with a Live CD

Linux is immune from viruses but it isn't immune from operator error.
If you 'borked' your system and have problems booting, you can usually rescue your Linux operating system with your Live CD, here are two ways to gain access to your important files to fix them.

NEW: GUI method for Hardy Heron and Later

1) Boot your Ubuntu 'Desktop' LiveCD

2) Click 'Places' -->' Removable Media', and click on an icon. 
  • If your file system has a label, it will appear on the Desktop with it's own label, so you'll be able to easily identify which icon to click on.
  • If your file system doesn't have a label, it will just appear on the Desktop as '21.0 GB Media', or something like that. You might have to play around a little until you find the right icon.
When you have clicked an icon and you have a new icon on the Desktop for it, your file system has been mounted.

3) Click 'Applications'-->'Accessories'-->'Terminal', and after the terminal prompt, type 'gksudo nautilus'.
ubuntu@ubuntu:~$ gksudo nautilus
 A new Window will open titled 'root - File Browser'.

4) Click the Up arrow to go to the top of the live CD's file system tree.

5) Open the /media directory.
You'll see any mounted file systems in /media as directories. (Mount points).
If your file system has a label, the mount point you're looking for will be easy to identify.
If your file system isn't labelled, look in 'disk', disk-1', 'disk-2' and so on until you find the file system you need to work on.

6) Some vital files people might need to use the LiveCD to edit would include:
  • /boot/grub/menu.lst - see this website's GRUB Page for more info
  • /etc/fstab - see this webpage's Updating /etc/fstab filesystem UUID Numbers
  • /etc/X11/xorg.conf - this website's Xserver Page has some links that might help
  • /home/username/* - (Personal files) - if your operating system is beyond repair, you may wish to rescue personal files from your /home/username directory before you re-install.
  • lost+found
For Linux File Rescues, see also SSH Network, or just copy files to an external USB.

===================================================

TRADITIONAL METHOD: for Ubuntu Gutsy Gibbon and Earlier

1) Boot your Ubuntu 'Desktop' LiveCD

2) 'Applications', Accessories,'Terminal'.
Enter the 'sudo fdisk -lu' command to get detailed information about your hard disk partitions. This information will be needed for making up the 'mount' command correctly.
code:
herman@work:~$ sudo fdisk -lu
Password:

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1              63    41576219    20788078+   c  W95 FAT32 (LBA)
/dev/hda2   *    41576220   153276164    55849972+  83  Linux              
/dev/hda3       153276165   156296384     1510110    5  Extended
/dev/hda5       153276228   156296384     1510078+  82  Linux swap / Solaris

Disk /dev/hdb: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders, total 58605120 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *          63     2104514     1052226    b  W95 FAT32
/dev/hdb3        56725515    58605119      939802+   5  Extended
/dev/hdb4         2104515    56725514    27310500   83  Linux
/dev/hdb5        56725578    58605119      939771   82  Linux swap / Solaris

Partition table entries are not in disk order

3) Pick out the partition you think is the right one to mount.  For example, this time I have decided I want to mount /dev/hda2 . I know that that is my Ubuntu install, and I remember it has the ext3 filesystem.

4) Make a 'Mount Point'.
Either type, or copy and paste the following code into your terminal,
Code:
ubuntu@ubuntu:~$ sudo mkdir /media/ubuntu
This above code is to make a 'mount point' (directory) for me in my /media directory to mount the installed file system in.

5) Mount your disabled Ubuntu operating system in the Live CD,
Code:
ubuntu@ubuntu:~$ sudo mount -t ext3 /dev/hda2 /media/ubuntu
 Where: /dev/hda2 is the correct partition name for my installed Ubuntu filesystem. If yours is different, replace this number with something else as seen by your own sudo fdisk -lu command output, similar to mine shown two steps above here.
Where: the /dev/hda2 partition contains an ext3 file system.

If your Ubuntu partition is not /dev/hda2, you will need to edit the above command before you can use it for your particular system.


Okay, now my hard-disk installed Ubuntu operating system is mounted in my Ubuntu Live CD operating system. To check, I went up two levels the top of the filesystem and opened my /media folder. (In GUI mode). Inside that was my new 'ubuntu' folder.
I opened my /media/ubuntu folder to see my Ubuntu root files.
We can take a look around in GUI mode and copy stuff alright, but we are not to allowed to save any system changes. For any serious work, we need to use the terminal.


6) Some vital files people might need to use the LiveCD to edit would include:
  • /boot/grub/menu.lst
  • /etc/fstab
  • /etc/X11/xorg.conf
  • /home/username/*

/boot/grub/menu.lst

Here's how to open and edit the /boot/grub/menu/lst file in the Linux (Ubuntu) partition we just mounted, just in case anyone finds that handy. 
code:
ubuntu@ubuntu:~$ gksudo gedit /media/ubuntu/boot/grub/menu.lst

This website's GRUB Page has a lot of information about how to edit your menu.lst file.


/etc/fstab
In some cases a problem in your /etc/fstab file can make your installed operating system unbootable too, this livecd mounting method shown above an also be used for gaining access to that.
ubuntu@ubuntu:~$ gksudo gedit /media/ubuntu/etc/fstab
Editing /etc/fstab is shown right below here, just scroll down.


/etc/X11/xorg.conf
ubuntu@ubuntu:~$ gksudo gedit /media/ubuntu/etc/X11/xorg.conf
And this is a way to gain access to your xorg.conf file to edit that if that's what is preventing you from booting. (You can boot but you can only get a black screen with a command prompt, no GUI).

This website's Xserver Page has some links about /etc/X11/xorg.conf. Remember to make a backup copy before editing any file.

/home/username/*
ubuntu@ubuntu:~$ sudo cp -r /media/ubuntu/home/username/* /media/usbdisk/
If your operating system is beyond repair for some reason and you want to delete it and simply re-install, you might want to rescue all your personal files from your /home directory.
In this example, they will be copied to a USB external hard drive.
See also this website's  SSH Network for Linux File Rescues to a networked computer.


Edit /etc/fstab Method for Mounting
The /etc/fstab file in Ubuntu is an important operating system configuration file that  is made when Ubuntu is installed, and is needed for Ubuntu to boot. 
The /etc/fstab file controls what file systems are mounted automatically when our computer boots up, how to mount them, what rules to mount them with and whether they will be given a file system check first or not. 
We can modify our /etc/fstab files to customize the behavior of our operating systems to our liking or needs. Usually we might decide to do that after we have added new partitions and file systems to our computer.

Advantages
of mounting your other filesystems by listing them in /etc/fstab is that they will be checked and automatically mounted during each bootup. You won't have to bother doing it manually. You might use this method if you need to access other file systems all the time. It's very quick and convenient.
Disadvantages of mounting your other filesystems by listing them in /etc/fstab are that if a filesystem check is enabled during bootup before the other filesystems are mounted (recommended), it can slow down your boot up or maybe even stop you from being able to boot normally if there is a problem.
From a security point of view, if you decide to keep confidential files, (and who doesn't?), you might find it a little bit safer to keep those in a partition that will not be automatically mounted all the time. You can mount it yourself, but only when you need access to the sensitive data. That way people with network access to your computer or even physical access will need to work a little bit harder to get at the protected information. Depending on the nature of the information you should possibly look at other security measures too, but at least not having the file system mounted all the time in the first place is a step in the right direction.

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc            /proc           proc    defaults        0       0
#
/dev/hda2       
UUID=61e29deb-c5c3-4401-8557-81482aedc839  /   ext3    defaults,errors=remount-ro 0       1
# /dev/hda1
UUID=124D-170D  /media/hda1     vfat    defaults,utf8,umask=007,gid=46 0       1
# /dev/hda5
UUID=a08d44f6-d681-4901-a7cc-345fc9fa9eb6 none            swap    sw              0       0
/dev/cdrom        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
Above is an example of a typical /etc/fstab file.
Normally the columns are not very neat or straight, which makes it a little harder to make sense of, but that's the way they are.

# /etc/fstab: static file system information.
#
# <file system> <mount point>       <type>           <options>                <dump>  <pass>

   proc          /proc               proc             defaults                  0       0

#
/dev/hda2       
UUID=61e29deb-c5c3-4401-8557-81482aedc839  /   ext3    defaults,errors=remount-ro 0       1

# /dev/hda1
UUID=124D-170D   /media/hda1         vfat    defaults,utf8,umask=007,gid=46       0       1

# /dev/hda5
UUID=a08d44f6-d681-4901-a7cc-345fc9fa9eb6 none  swap     sw                       0       0

/dev/cdrom      /media/cdrom0     udf,iso9660         user,noauto                 0       0

/dev/fd0        /media/floppy0      auto             rw,user,noauto               0       0
Here's the same /etc/fstab file again, I added the spaces between some of the lines in mine so it's a little easier to read. It wouldn't do any harm to tidy it up a little bit more too.


Here is some general information about what commands or info goes in each column in /etc/fstab and what it is supposed to mean.
<file system>  <mount point>  <type>   <options>          <dump>       <pass>

<file system>
The first column in /etc/fstab, headed <file system> is for specifying the UUID number for the exact filesystem you want to have mounted automatically on bootup. For example something like UUID=61e29deb-c5c3-4401-8557-81482aedc839 would go here. This replaces the older way of designating the file system just by its Linux device name like /dev/hda3, although these can still be reverted to if needed. (For compatibility with LiLo or maybe some other programs).

<mount point>
The second column in /etc/fstab, headed <mount point> is for telling the operating system what directory you want the filesystem mounted in. You can mount it anywhere you like as long as you specify an empty directory somewhere. Usually we make a special directory for each filesystem in the /media directory. Some Linux distros use the /mount directory.

<type>
The third column in /etc/fstab, headed <type> is for letting the operating system know what filesystem type to expect, for example ext2, ext3, reiserfs, vfat, ntfs, swap, or whatever the case may be.

<options>
The fourth column in /etc/fstab, headed <options> is for options, or what the operating system is supposed to do with that filesystem, or how it is to be mounted.
Here is a brief list of a few of the most common ones,
ro means read only, for CD-ROM drives and NTFS filesystems
rw means read an write
user means allow an ordinary user to mount this filesystem, (you don't have to be the superuser).
auto means mount the device automatically at bootup.
noauto
means do not mount the device automatically at bootup.
defaults the default options are: rw, suid, dev, exec, auto, nouser, and async.
nls is national language support.
utf8 is 8 bit character encoding (compatible with ascii.)
umask sets the default file permissions (ie. who can read, who can write, who can execute).

Links:
Reiserfs Mount Options, http://www.namesys.com/mount-options.html
mount(8) -Linux man page, http://www.die.net/doc/linux/man/man8/mount.8.html



<dump>
The fifth column in /etc/fstab, headed <dump> is used by the dump program.
I don't think we have the dump program in Ubuntu. Apparently from what information I can gather that's some kind of automated backup utility used by Redhat Linux and distros forked off Redhat.  I have never seen it marked other than with a 0, meaning to skip this, a 1 would tell the dump command do its thing. (If it we had that program installed and configured).

<pass>
The sixth column in /etc/fstab, headed <pass> is an important one.
 0 in this column tells fsck not to do a filesystem check on this filesystem during bootup.
   (You can place a in this column for a faster bootup when you know a filesystem has a problem and you plan to fix or delete the filesystem later, you just want a fast bootup for now.)
 1 placed in this column means this filesystem will be checked first on bootup, usually only the /            (root filesystem) should have a 1 in this column.
 2 means this filesystem will be checked second, and simultaneously with all the other file             systems which also are marked with a 2. This saves time during bootup.

Tuxfiles is a great website with an interesting page on editing /etc/fstab,How to Edit and Understand /etc/fstab -tuxfiles.

Also see How to fstab, by bodhi.zazen

Here is a link with some interesting information on editing /etc/fstab too, HOWTO: Tweak your ext3 filesystem for a performance boost, by GoldBudgie. 


So let's pretend I have made a few new partitions in my hard disk and I want to add lines for them into my /etc/fstab file so they will be automatically mounted at each boot-up.
I made a new FAT32 data partition, a new NTFS data partition, plus an ext3 data partition and a reiserfs data partition.
 
First, before we do anything, we'll make a backup of /etc/fstab,
code:
herman@bookpc:~$ sudo cp /etc/fstab /etc/fstab_backup
We always make a backup copy of any files we want to edit before we go doing things in case things don't work out as planned. To restore the original copy, just reverse the command used to make the backup, for example 'sudo cp /etc/fstab_backup /etc/fstab' will restore the file.

It is not a good idea to create a second backup of the same file using the same filename again though, as that will overwrite your original back-up and if you ever need that again you won't have it. It might be a good idea to include some numbers, such as the date in filenames.


How to use this method
(a) find filesystem details (partition number, filesystem type)
(b) make your mount points if they don't already exist
(c) edit /etc/fstab with the correct details for mounting the filesystem automatically each boot up

(a) find filesystem details (partition numbers, filesystem types)
I used the  ls /dev/disk/by-uuid/ -alh  command to list the UUID numbers for the filesystem types I have,
Code:
herman@bookpc:~$ ls /dev/disk/by-uuid/ -alh
Example:
herman@bookpc:~$ ls /dev/disk/by-uuid/ -alh
total 0
drwxr-xr-x 2 root root 180 2007-10-06 00:40 .
drwxr-xr-x 5 root root 100 2007-10-06 00:40 ..
lrwxr-xr-x 1 root root  10 2007-10-06 00:40 11d74980-3115-4aa5-8402-624581ef2b39 -> ../../sda8
lrwxr-xr-x 1 root root  10 2007-10-06 00:40 124d-170d -> ../../sda1
lrwxr-xr-x 1 root root  10 2007-10-06 00:40 285F98566380864A -> ../../sda7
lrwxr-xr-x 1 root root  10 2007-10-06 00:40 4706-4A09 -> ../../sda6
lrwxr-xr-x 1 root root  10 2007-10-06 00:40 61e29deb-c5c3-4401-8557-81482aedc839 -> ../../sda2
lrwxr-xr-x 1 root root  10 2007-10-06 00:40 66fb5a7b-d998-4aef-b57f-ba226c803f58 -> ../../sda9
lrwxr-xr-x 1 root root  10 2007-10-06 00:40 a08d44f6-d681-4901-a7cc-345fc9fa9eb6 -> ../../sda5
From this output I can see the filesystem UUID numbers for all my partitions at once, but I can't easily tell which is which or see what the filesystem types are.
I'll need this because I'm going to copy some of these UUID numbers into my /ect/fstab file soon.

herman@bookpc:~$ sudo parted /dev/sda p
This command will invoke GNU Parted with the 'p' option (P for Print).

herman@bookpc:~$ sudo parted /dev/sda p

Disk /dev/sda: 20.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number   Start   End     Size    Type     File system   Flags
1        32.3kB  3224Mb  3224Mb  primary  fat32         lba
2        
3224Mb  13.8GB  10.6GB  primary  ext3          boot
3        13.8GB  20.8GB  7066MB  extended
6        13.8GB  14.8GB  1069MB  logical  fat32
7        14.8GB  15.9GB  1077MB  logical  ntfs
8        15.9GB  17.0GB  1069MB  logical  ext3
9        17.0GB  19.7GB  2723GB  logical  reiserfs
5        19.7GB  20.8GB  1127MB  logical  linux-swap

Information: Don't forget to update /etc/fstab if necessary.
Okay, now I can tell which partition is which.
I'll need to leave this open so I can use it to help me edit my /etc/fstab pretty soon.


(b) make a mount point for each file system if one doesn't already exist
Use the ls command to take a look in /media to see if there's already any mount points I want to  use,
Code:
herman@bookpc:~$ ls /media

Example:
herman@bookpc:~$ ls /media
cdrom  cdrom0  floppy  floppy0  hda1

This is the output from the 'ls' (list command) I used to take a look around in my /media folder to see what's there already. The one called 'hda1' there would be my Windows mount point, there are no mount points there yet to mount my other filesystems in.  I will make some.



herman@bookpc:~$ sudo mkdir /media/fat32data
If 'fat32data' is the name I want for your new mount point. You can substitute any name you like for 'fat32data', which I gave here as an example.

herman@bookpc:~$ sudo mkdir /media/ntfsdata
This mount point will be for my ntfs data partition.

herman@work:~$ sudo mkdir /media/ext3data
This will be the mount point for my ext3 data partition.

herman@work:~$ sudo mkdir /media/reiserfsdata
And this will be the new mount point for my reiserfs data partition.



(c) edit /etc/fstab with the correct details for mounting the filesystem automatically each boot up

It is best to open a new terminal in another desktop to do this, so you can copy and paste to transfer information from the commands we entered in (a) above to the /etc/fstab file.

To get my /etc/fstab file I type 'sudo gedit /etc/fstab' in a terminal. like this,
Code:
herman@bookpc:~$ gksudo gedit /etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point>       <type>           <options>                <dump>  <pass>

   proc          /proc               proc             defaults                  0       0

#
/dev/hda2       
UUID=61e29deb-c5c3-4401-8557-81482aedc839  /   ext3    defaults,errors=remount-ro 0       1

# /dev/hda1
UUID=124D-170D   /media/hda1         vfat    defaults,utf8,umask=007,gid=46       0       1

# /dev/hda5
UUID=a08d44f6-d681-4901-a7cc-345fc9fa9eb6 none  swap     sw                       0       0

/dev/cdrom      /media/cdrom0     udf,iso9660         user,noauto                 0       0

(Above), my new /etc/fstab file, with UUID numbers.


These are the lines I'll  add to my /etc/fstab file to mount my FAT32 data partition, number 6 in my hard disk, or /dev/hda6
code:
  #/dev/hda6     
UUID=4706-4A09   /media/fat32data  vfat iocharset=utf8,umask=000     0       2
I copied the UUID number from the ls /dev/disk/by-uuid/ -alh  command output and pasted it into the right place in my /etc/fstab file, along with the appropriate options, refer to Feisty Starter Guide: 1.14.1.5 How to mount Windows partitions (FAT) on boot-up, and allow all users to read/write

These are the lines I would add to my /etc/fstab file to mount my NTFS data partition, if I had one.
What is NTFS? - ntfsprogs website, www.linux.ntfs.org
It wouldn't really make any sense to have an NTFS data partition for Linux, this is just for demonstration purposes,
code:
#/dev/hda7     
UUID=285F98566380864A   /media/ntfsdata  ntfs ro,umask=0002,nls=utf8      0         0
I copied the UUID number from the ls /dev/disk/by-uuid/ -alh  command output and pasted it into the right place in my /etc/fstab file, along with the appropriate options.
Refer to Feisty Starter Guide's  1.14.1.4 How to mount Windows partitions (NTFS) on boot-up, and allow all users to read only
and, How to mount your NTFS volume - ntfsprogs website, www.linux.ntfs.org



Here is the line for mounting my ext3 data partition which is my number 8 partition on hard disk, or /dev/sda8,
Code:
  #/dev/sda8   
UUID=11d74980-3115-4aa5-8402-624581ef2b39 /media/ext3data   ext3 defaults    0       2


Here is the line for mounting my reiserf data partition which is my number 9 partition on hard disk, or /dev/sda9,
  #/dev/sda9       
UUID=
66fb5a7b-d998-4aef-b57f-ba226c803f58 /media/mountpoint reiserfs defaults  0    2

herman@bookpc:~$ sudo gedit /etc/fstab
Password:

# /etc/fstab: static file system information.
#
# <file system> <mount point>       <type>           <options>                <dump>  <pass>

   proc          /proc               proc             defaults                  0       0

#
/dev/hda2       
UUID=61e29deb-c5c3-4401-8557-81482aedc839  /   ext3    defaults,errors=remount-ro 0       1

# /dev/hda1
UUID=124D-170D   /media/hda1         vfat    defaults,utf8,umask=007,gid=46       0       1

# /dev/hda5
UUID=a08d44f6-d681-4901-a7cc-345fc9fa9eb6 none  swap     sw                       0       0

#/dev/hda6     
UUID=4706-4A09   /media/fat32data   vfat    iocharset=utf8,umask=000              0       2

#/dev/hda7     
UUID=285F98566380864A   /media/ntfsdata   ntfs    nls=utf8,umask=0222              0       0

#/dev/sda8   
UUID=11d74980-3115-4aa5-8402-624581ef2b39 /media/ext3data ext3   defaults          0       2

 #/dev/sda9       
UUID=
66fb5a7b-d998-4aef-b57f-ba226c803f58 /media/mountpoint reiserfs defaults      0       2

/dev/cdrom      /media/cdrom0     udf,iso9660         user,noauto                  0       0

And finally, here is my finished /etc/fstab file, so all those file systems should now be automatically mounted for me on each boot-up.
The UUID numbers won't be colored, they'll be black, but I left them colored for the illustration.

File Ownership and Permissions
If you have trouble copying and pasting or reading and writing data from one file system to another there could be a problem with your file ownership and permissions.
Refer to this webpage's File Ownership and Permissions

Links:
How to Edit and Understand /etc/fstab -Tuxfiles.

How to fstab, by bodhi.zazen

HOWTO: Tweak your ext3 filesystem for a performance boost, by GoldBudgie. 

Mount an .iso file in /etc/fstab
This fstab entry can automatically mount an .iso file for you at each boot up, and give you a desktop icon for it.
Code:
  /home/herman/mycdproject.iso /media/isomount iso9660 loop,ro,user  0    0

To get the partitions to mount now we just have to enter this command in terminal,
herman@work:~$ sudo mount -a
,or if that doesn't work just reboot and your partitions should mount automatically on each boot up from now on.

To the best of my knowledge it is not possible to mount an .iso so you can edit the file directly. Mounting an .iso file allows you to browse the files in it without the need to burn it to a CD first.
If you want to edit the .iso file, the only way to do it is to copy all the files out of it, and paste them into a directory. Then edit the files, and re-run a genisoimage command to make the directory into a new .iso file with the same filename as the .iso you already had, to overwrite it.
See: genisoimage commands for making .iso files to burn to CDs and DVDs







Updating Filesystem UUID Numbers in /etc/fstab
After doing work with a hard disk partition editor and deleting or creating partitions and file systems, our /etc/fstab files always need to be updated with the recent changes.

If we forget, then booting will be interupted with a file system check error and we'll need to press 'Ctrl'+'D' to continue each boot-up.
Here's an example link, Problem in mounting special device at boot.

Ubuntu's /etc/fstab files since Ubuntu 6.10 'Edgy Eft' use file system UUID numbers instead of just partition numbers to specify the exact file systems to be mounted.
That makes it easier for people  who like plugging in different hard disks or whose partition numbers get changed.

Here is one command that can list the UUID numbers of our current file systems,
  herman@edgy:~$ sudo blkid

If that one doesn't work, try this one,
  herman@bookpc:~$ ls /dev/disk/by-uuid/ -alh

Example output:
herman@amd64hh:~$ sudo blkid
[sudo] password for herman:
/dev/sda1: UUID="6178d387-9ab5-4f23-a56d-8e0cba0addc3" TYPE="ext3" SEC_TYPE="ext2" LABEL="HARDY"
/dev/sda5: TYPE="swap" UUID="cf4f7390-4243-43b6-abef-30ad6f906b4a"
/dev/sdb1: UUID="3c0ea3df-9bbc-4365-84ff-c29b1ad50afa" SEC_TYPE="ext2" TYPE="ext3" LABEL="BACKUPS"
/dev/sdc1: UUID="e7e39ee8-2022-46bc-af71-a48ab3bd4f61" SEC_TYPE="ext2" TYPE="ext3" LABEL="GUTSY"
/dev/sdc2: UUID="9e9e5184-127f-45d2-bf4a-e6f0a112f180" SEC_TYPE="ext2" TYPE="ext3" LABEL="FEISTY"
/dev/sdc4: UUID="5b326dec-325e-416c-8bd3-5e8523bf259c" SEC_TYPE="ext2" TYPE="ext3" LABEL="OPENSUSE"
/dev/sdc5: TYPE="swap"
/dev/sdc6: UUID="555dc3b7-9ba8-4fd9-b639-d8d0ffd65efa" SEC_TYPE="ext2" TYPE="ext3" LABEL="DEBIAN"
/dev/sde1: LABEL="WEBSITE" UUID="f0ff07cb-3064-45fe-8ee5-a65a78cb20da" TYPE="ext3" SEC_TYPE="ext2"
/dev/sdd1: LABEL="DATA" UUID="1a206651-0db0-4b89-b468-608dbe379026" SEC_TYPE="ext2" TYPE="ext3"
The file system UUID numbers listed in our /etc/fstab files need to match the UUID numbers of the file systems we have in our partitions. If they don't then we need to edit the file.
  1. Copy the output from the blkid or ls /dev/disk/by-uuid -alh command
  2. Open your /etc/fstab file
  3. Paste your output from the blkid or ls /dev/disk/by-uuid -alh command to the bottom of the file
  4. Compare the UUID numbers registered in /etc/fstab with the new (current) UUID numbers
  5. When you find one that needs updating, copy the right one from your 'blkid' or 'ls /dev/disk/by-uuid/ -alh' command output and go to your /etc/fstab file and paste it over the old number to overwrite the old UUID number. 
  6. Delete your blkid or ls /dev/disk/by-uuid -alh output from the file, (or comment it out)
  7. Click 'Save' before you close the file.

Open your /etc/fstab file with this command,
  herman@bookpc:~$ gksudo gedit /etc/fstab

Be sure to carefully compare the UUID numbers listed in your /etc/fstab file with the ones from the 'sudo blkid' or  'ls /dev/disk/by-uuid/ -alh' command. Check each partition.
  # /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0

# /dev/sda1
UUID=6178d387-9ab5-4f23-a56d-8e0cba0addc3 /   ext3    relatime,errors=remount-ro 0       1

# /dev/sda5
UUID=cf4f7390-4243-43b6-abef-30ad6f906b4a none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

#/dev/sdb1
UUID=3c0ea3df-9bbc-4365-84ff-c29b1ad50afa   /media/BACKUPS   ext3   defaults    0       2

#/dev/sd1
UUID=1a206651-0db0-4b89-b468-608dbe379026   /media/DATA   ext3   defaults    0       2

##############################################################################################
#/dev/sda1: UUID="6178d387-9ab5-4f23-a56d-8e0cba0addc3" TYPE="ext3"
#/dev/sda5: TYPE="swap" UUID="cf4f7390-4243-43b6-abef-30ad6f906b4a"
#/dev/sdb1: UUID="3c0ea3df-9bbc-4365-84ff-c29b1ad50afa" SEC_TYPE="ext2" TYPE="ext3"
#/dev/sdc1: UUID="e7e39ee8-2022-46bc-af71-a48ab3bd4f61" SEC_TYPE="ext2" TYPE="ext3"
#/dev/sdc2: UUID="9e9e5184-127f-45d2-bf4a-e6f0a112f180" SEC_TYPE="ext2" TYPE="ext3"
#/dev/sdc4: UUID="5b326dec-325e-416c-8bd3-5e8523bf259c" SEC_TYPE="ext2" TYPE="ext3"
#/dev/sdc5: TYPE="swap"
#/dev/sdc6: UUID="555dc3b7-9ba8-4fd9-b639-d8d0ffd65efa" SEC_TYPE="ext2" TYPE="ext3"
#/dev/sdd1: UUID="1a206651-0db0-4b89-b468-608dbe379026" SEC_TYPE="ext2" TYPE="ext3"
 
It is really not too difficult to edit your UUID numbers in /etc/fstab once you get used to it.

If you use LiLo for booting or if you just don't like having UUID numbers in your /etc/fstab file and don't want to use them, you don't have to. You can make your /etc/fstab file back into a traditional style one like you were used to. Just remove the hash mark before the regular '/dev/hda' style partition designator and delete the UUID numbers.  New lines can be added in the traditional manner with or without the new UUID, it will work the old fashioned way. 

Here's a Ubuntu Web Forums thread on UUIDs:
 fstab UUIDs? ( 1 2 3)
mattisking

Here are some more commands that can be used to get file system UUID numbers.

To find the UUID number for just one partition, any of the following commands will be fine,
Code:
  herman@edgy:~$ sudo vol_id -u /dev/hda2
This one can be used for any type of filesystem.

When you know it's an ext2 or ext3 file system, gives lots of information
Code:
  herman@edgy:~$ sudo dumpe2fs -h /dev/hda2
(Where /dev/hda2 is an ext2 or ext3 filesystem in my computer, replace 'hda2' with a different number if you need to, to make this code suit your computer).

For a reiserfs superblock, this gives the UUID plus a lot of other interesting info,
Code:
  herman@edgy:~$ sudo debugreiserfs /dev/hda2
(Where /dev/hda2 is a reiserfs filesystem in my computer, replace 'hda2' with a different number if you need to, to make this code suit your computer).




File Ownership and Permissions

Gnu/Linux file systems feature the ability to keep track of who owns each file and control who's allowed to read it, write to it and who's allowed to execute it, (especially if it's a program). This is useful if you share the same computer with other users and it's particularly important if you have any kind of server software installed in your Ubuntu operating system, see SSH Network.

In normal GUI mode if you right-click on a file or folder and click 'properties', and look in the 'Permissions' tab you will be able to see the file's ownership and permissions.

Normally in a person's own /home/username directory all of the files will be owned by the user, so in my own /home/herman directory I can do whatever I want to my own files.

Operating system files or all files not in a /home/username directory are normally owned by 'root', and we are not allowed to create, delete or edit those files without typing the word 'sudo' before the command and entering our sudo (administrator's) password.
This is an important security feature in Gnu/Linux operating systems and it helps to protect the operating system files from careless or malicious users, malware and viruses.

A better way to look at your Gnu/Linux file ownership and permissions is with the ls -l command.
With the command line we can see a whole list of files at once instead of just looking at one file at a time.
The 'ls' is short for 'list', and the -l option stands to 'long', meaning 'detailed'. 

The /media and /mnt directories are interesting.
They contain some  files which are owned by a user and others which are owned by root.

Use 'ls -l' for a list of files and their file permissions and ownership details, for example,
ls -l /media

example output,
total 29







drwxrwxrwx
10
root
root
4096
2011-06-26 20:55
1ba4fe47-d855-4bce-9b22-06e6ee1f2c1d
drwxrwxrwx
34
root
root
20480
2011-07-17
14:52
DATA_1000GB
lrwxrwxrwx
1
root
root
7
2010-05-07
19:24
floppy -> floppy0
drwxr-xr-x
2
root
root
4096
2010-05-07
19:24
floppy0
drwxr-xr-x
9
herman
herman
648
2011-07-31
20:10
Verbatim
drwxr-xr-x
14
herman
herman
632
2011-06-22
05:41
WEBSITE
Can you spot my potential security problems here?  (The answer is further down the page).
 
In the first column,
The first letter could be a 'd' or an l, (d for 'directory' or l for 'link'), if it's just a file you will not see anything there.
The next nine letters or dashes tell us the security settings for the mount point or file, (more about that below).

The second column has a number in it which tells us how many directories are inside that mount point.

The third and fourth columns show the owner of the file and the name of any group to share it with.

The fifth column is supposed to show the size in bytes but I'm not sure how accurate that is.

The sixth column displays the date and time the file was last modified.

And finally, the seventh column show us the name of the file or directory. The directories we're looking at right now are special directories called 'mount points' and they're like a doorway into another file system, in another partition.



Now I want to expand on what the letters in the first column represent.

The nine letters or the letters and dashes like 'drwxr-xr-x ' represent the file's permissions.

r stands for read, w stands for write, x is for execute, (open it with a program), and - (a dash) means no permission.

There are three sets of three letters and dashes because there are three kinds of computer users who can access files.
These are the file's owner, the file owner's group (friends), and anyone (possibly strangers).
Each of these kinds of user can be allowed seven different types of access to a file.

Here's a table for quick reference,
ownergroupanyone
No permission - - - 0
Execute only - - x1
Write only - w -2
Write, execute - w x3
Read only r - -4
Read, execute r - x5
Read, write r w -6
Read, write, execute r w x7
No permission - - - 0
Execute only - - x1
Write only - w -2
Write, execute - w x3
Read only r - -4
Read, execute r - x5
Read, write r w -6
Read, write, execute r w x7
No permission - - - 0
Execute only - - x1
Write only - w -2
Write, execute - w x3
Read only r - -4
Read, execute r - x5
Read, write r w -6
Read, write, execute r w x7

NOTE: The numbers 1 to 7  in the right-hand columns in this table are to tell you what numbers to use for your chmod command, (below).



The chmod and chown commands

chmod - changes file permissions
chown - changes file ownership

If you just want to try out the chmod command, a useful thing to do to begin with would be to chmod your /home/username directory to make it private.

As you can see from the ls -l command output shown here below, in a typical new Ubuntu installation my /home/username directory can be accessed by anyone,

code,
ls -l /home
 
output,
total 4
drwxr-xr-x 34 herman herman 4096 2011-08-08 09:05 herman
As you can see, my /home/herman directory is owned by me, but anyone I'm sharing my computer with or allowing into my PC via any networking software can easily see my  personal files.

To fix that, I can use the chmod command like so,
sudo chmod 700 /home/herman
The '700' part of the command means:
7 - read, write and execute permisson for the owner, (myself, herman)
0 - no permission for members of the group 'herman' to do anything
0 - no permission for anyone to do anything

Let's check and see if it worked,
ls -l /home

total 4
drwx------ 34 herman herman 4096 2011-08-08 09:05 herman
Now as you can see, I can still read write and execute files in my own /home/herman directory, but nobody else can have any access to them.

Well, not unless they have administor (root) powers and can over-ride my settings. If somebody has a Live CD and they have physical access to my computer they can just chmod the folder again to suit themselves and still be able to read it and do whatever they want. In that case, chmodding your home/username directory would only deter polite intruders.
For networking though, it's different. As long as you never give your guests administrative powers, (which would be rather foolish), then setting your file permissions for your /home/username folder would be quite effective and a highly recommended course of action.

A minor problem will be if I ever need to rescue my files, I will just need to use the chmod command again to gain access to my own files. Probably that's why Ubuntu doesn't come with the /home/username folder already chmodded at installation time, it would make it a little harder for new users who might not know about the chmod command to rescue their files with a Live CD when they 'bork' their systems.



Another popular example of the use of the chmod command would be when I make a bash script to run a sequence of commands with. To make it executable I would type:  sudo chmod 755 myscript.sh and that would mean I can read, write and execute (run) my script or program but anyone else can only execute it.
That's '7' for me, '5' for my group, and '5', permission for anyone else.

example,
sudo chmod 755 /my_script.sh



If you need to use both the chown plus the chmod commands


Let's take another look at the mount points I have in my /media directory I showed you earlier,
total 29







drwxrwxrwx
10
root
root
4096
2011-06-26 20:55
1ba4fe47-d855-4bce-9b22-06e6ee1f2c1d
drwxrwxrwx
34
root
root
20480
2011-07-17
14:52
DATA_1000GB
lrwxrwxrwx
1
root
root
7
2010-05-07
19:24
floppy -> floppy0
drwxr-xr-x
2
root
root
4096
2010-05-07
19:24
floppy0
drwxr-xr-x
9
herman
herman
648
2011-07-31
20:10
Verbatim
drwxr-xr-x
14
herman
herman
632
2011-06-22
05:41
WEBSITE

The top line is my encrypted file system which may contain confidential information and the next line down contains the bulk of my stored data, which also may contain files that I might prefer to keep private.

If I were to allow other people into my computer, either by creating an ordinary user account for them and letting them sit at my desk using my keyboard, monitor and mouse, or if I allow other people to enter my computer via the LAN network or internet, then I will need to change the ownership and permissions for these mount points.

Even the encrypted file system is easy for anyone else to see once I enter the password and have it mounted. File system encryption is great to keep people with physical access to the media from accessing your data, but it doesn't do anything for people with network access. This is where linux file ownership and permission rules are useful.

sudo chown herman.herman /media/1ba4fe47-d855-4bce-9b22-06e6ee1f2c1d

sudo chmod 700 /media/1ba4fe47-d855-4bce-9b22-06e6ee1f2c1d

sudo chown herman.herman /media/DATA_1000GB

sudo chmod 700 /media/DATA_1000GB

The results,
total 29







drwx------
10
herman
herman
4096
2011-06-26 20:55
1ba4fe47-d855-4bce-9b22-06e6ee1f2c1d
drwx------
34
herman
herman
20480
2011-07-17
14:52
DATA_1000GB
lrwxrwxrwx
1
root
root
7
2010-05-07
19:24
floppy -> floppy0
drwxr-xr-x
2
root
root
4096
2010-05-07
19:24
floppy0
drwxr-xr-x
9
herman
herman
648
2011-07-31
20:10
Verbatim
drwxr-xr-x
14
herman
herman
632
2011-06-22
05:41
WEBSITE

Now I can still have full access to my own files but any others who may have a user account in my PC, whether they have direct access to the computer or they access it via the network cannot easily see my private files. 

WARNING: When you're chmodding and chowning mount points, avoid using the -R option, (unless you know what you're doing).
The -R option means 'Recursive', so it changes the permissions of all the directories and files inside the folder you run it on as well as the folder itself.
Probably most of the time you don't need it and it would be 'overkill'. Not only that, but if you get in the habit of using the -R option and you ever use it on a mount point for a file system containing an operating system it will probably ruin all the file ownership and permissions settings for the entire other operating system. That would 'bork' the operating system and you'd need to re-install it.
It's usually (but not always) okay to use the -R option if you're just using it on a directory full of normal (non-operating system) files.



How to Create Users and Groups

You can create a new group if you go 'System'->'Administration'->'Users and Groups', and click on the 'Manage Groups' button.

Just for an example, let's imagine we're members of a cycling club and we want to set up our computer with SSH server software so we can keep in touch and share maps and pictures and other route information about our bicycle tours between members of our bicycle club.

Click 'Add Group', and then make up a name for your group, say 'bicycleclub' and click 'Okay'.

Now if you go back to 'Users and Groups', you can add each member of your bicycle club to your  list of registered users of your computer. Just fill in the form 'New user account', and before you close it, in the advanced tab, make sure you remember to add your new user to your bicycle club.
Each of your bike club members will have a /home/username folder of their own that they can use in your computer, either by direct access or by SSH network, if you have that set up. SSH Network.

Gnu/Linux operating systems gives you the adminstrator, the flexibilty to control what information gets shared with whom.
You can do that by using chmod and chown commands.

If you're not sure you understand Gnu/Linux file ownerships and permissions and the use of the chown and chmod commands, the best way to learn is to experiment and practice with them. You'll soon get the hang of it.



Tuxfiles has a great page on how to use the chmod command, Linux File Permissions
Tuxfiles has another great page on how to use the chown command too, How to change a file's owner and group in Linux - 1.0

See also FilePermissions - Understanding and using file permissions - Ubuntu Community Docs.





Ext2, Ext3 and Ext4 Filesystems
The ext series of file systems are the by far the most popular and best supported Linux file systems.

Ext - The first Extended Filesystem (ext fs),  was designed by Rémy Card and implimented in Linux in April 1992.
Link: Extended File System - wikipedia

Ext2 - the ext2 file system was the second in the series, also by Rémy Card and introduced and January 1993. Many people still use it. Link: Ext2 - wikipedia.

Ext3
- the ext3 file system, developed by Stephen Tweedie and introduced in 2001 is backwards compatible with ext2 and is basically the ext2 file system with journaling added.  Ext3 has a reputation for being very safe and stable and was the default file system for Ubuntu up until Karmic Koala.  Link: Ext3 - wikipedia.

Ext4 - features a lot of great improvements over ext3.  Theodore Tso is the lead developer of ext4.
Ubuntu was the first Gnu/Linux distro to feature the ext4 file system as the standard default file system and ext4
 has been the default file system for Ubuntu since Karmic Koala was released on 29 October 2009.

Ext4 features a default block size of  4 KiB or  4096 bytes, which divided by 512 equals 8 sectors, and  uses 'extents' of 128 KiB, or 256 sectors, making it particularly agreeable to erase block alignment in SSDs and flash memory applications.

Link:   Ext4  - wikipedia.


Ext series links

Design and Implementation of the Second Extended Filesystem

Linux Ext2fs Undeletion mini-HOWTO - linux.org

EXT3, Journaling Filesystem

Linux ext3 FAQ

Ext4 - kernelnewbies



Running a filesystem check on an ext series  filesystem
Here's the best way to run a file system check from the command line (terminal) for a Linux live CD or from a hard disk installed Linux after you unmount the file system first.
Code:
 herman@amd46b:~$ sudo e2fsck -C0 -p -f -v /dev/sda2
Where: sda2 is the ext* partition to be checked.
With these options, e2fsck can solve quite a large number of file system problems, even some quite severe ones.
This is a very effective command, and very beneficial to your file system. It never does any harm, only good. You could run this command regularly to keep your file system in good order. I use this one myself quite often.

That command will normally fix 99% of all file system problems.

If it doesn't, you might get one of these two classic error messages 1, 
e2fsck: Bad magic number in super-block while trying to open /dev/sda2

The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or 2,
/dev/sda2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options).

1. If you have the first error message, jump to What to do if you have a bad ext3 superblock.
2. For the second error message, carry on with the steps below.

2. Oh-oh!
That means e2fsck has found a problem it doesn't want to deal with without human supervision. Maybe some files will need to be unlinked and sent to the /lost+found directory!
e2fsck doesn't want to do that by itself, e2fsck wants you to hold it's hand so it knows you're aware of what's happening. You'll need to to run something a little stronger.
First, backup (or rescue) all your important files (if you still can).

 Then run a more 'heavy-duty' e2fsck command, probably one something like this one,
 herman@amd46b:~$ sudo e2fsck -y -f -v /dev/sda2
Keep your fingers crossed, your seat belt fastened and your helmet on!
If that doesn't fix just about any problem you might have with an Ext* file system then I don't know what will!
Check for files in your /lost+found directory afterwards, you may need to recover a few of your files again from your lost+found directory. Recovering files from lost+found

If you needed to run a file system check as severe as this, I recommend you also try the next two commands as well, in case there are bad blocks in your hard disk.

This one is more for coping with bad blocks in your hard disk.
 herman@amd46b:~$ sudo e2fsck -c -c -k -v /dev/sda2
You shouldn't need to use this command very often.
When this command is needed it's probably time to start shopping for a new hard disk, but this will help you keep your old hard disk running just a little bit longer.
NOTE: Some web pages recommend 'sudo e2fsck -cc -k -v /dev/sda2'.
Recovering files from lost+found 
After running a command like e2fsck -y -f -v /dev/hda2 or reiserfsck --rebuild-tree, you should check your lost+found directory in case the file system check had to move some files there. You might have a few files missing from their proper locations and you might be able to restore them from lost+found.
I think it's just for recovering personal files because the files will be saved without their file names. If you have operating system files in the lost+found it would be hard to identify them, they'll be useless without their original filenames, so in that case you'll probably need to re-install.
At least you can probably recover any personal files like photos and bank records or whatever.

Confused57 reported that he had all of the files in one partition sent to the /lost+found and he just did 'sudo nautilus', and recovered all his files this way,
Quote:
Opened the partition and the only folder present was  "Lost+Found"(owned by root), which contained all the folders that I previously had on the partition, except the folders were renamed to the inode on which they were found.  I just did a "gksudo nautilus", right-clicked on the "Lost+Found" folder, changed the ownership and permissions.  Although the folder names were changed the file contents inside the folders had the original filenames and were intact.  It was no problem to drag & drop the folders to a spare partition, even a couple of small FAT32 truecrypt volumes I was playing around with were completely recovered.  I believe I was able to recover nearly 100% of the data on the partition,

(Quoted from an email from confused57).
It's hard to find information about how to recover files from /lost+found, so any information on this subject is very much appreciated. This is the most recent and reliable advice I have so far.
Thank you so much for that good information, confused57, that sounds like the best way to do it! :) That will surely be likely to help someone out of a bad situation.

I have spent hours searching the internet and here is the best link I have been able to find on this subject so far, (it's a .pdf file),
[PDF] Untitled
File Format: PDF/Adobe Acrobat - View as HTML
The first thing to do when exploring an ext2 or ext3 lost+found directory is. to prepare an area on another disk to which you can temporarily copy files ...
www.oreilly.com/catalog/morelnxsvrhks/chapter/hack 96.pdf - Similar pages

Here are some more links on /lost+found,
 
FSCK Check forced - Exit Status 4

http://www.tldp.org/LDP/Linux-Filesy...lostfound.html

http://www.sunmanagers.org/pipermail...er/005866.html

http://archives.free.net.ph/message/...c72f03.en.html

http://ubuntuforums.org/archive/index.php/t-229143.html


What to do if you have a bad ext3 superblock
e2fsck: Bad magic number in super-block while trying to open /dev/sda2

The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
If you received an error message similar to the one illustrated above, read this great link from 'Tips For Linux Explorers' link:   DAMAGED SUPERBLOCK.

...and this one: Understanding UNIX/Linux filesystem Superblock

First, before you do anything, check to make sure that it is really an ext3 filesystem that you were trying to run a filesystem check on when you received the warning message about the superblock being missing or corrupted.
99 times out of 100, there is nothing wrong except the user (you or I), made a mistake when typing the command or we forgot to update /etc/fstab after changing partitions around with partition editing software.
Maybe the partition number you used refers to a partition that used to contain an ext3 file system but you have some other file system in that partition now.
 
Here is a command that you can use to check,
  sudo parted /dev/sda p

This command can be used to tell you where there might be backup superblocks to replace your corrupted one with.
  sudo dumpe2fs /dev/sda6 | grep -i superblock

Using one of the numbers from the output from the above command, now you do something like this, 'sudo e2fsck -b 32768 /dev/hda6'
  sudo e2fsck -b 32768 /dev/sda6
That should fix it.
If not, try again with different number.

How to take a look at your ext3 superblock

The dumpe2fs command is for taking a look at your ext3 superblock, for example,
Code:
herman@amdxz:~$ sudo dumpe2fs -h /dev/hda2 

herman@amdxz:~$ sudo dumpe2fs -h /dev/hda2
dumpe2fs 1.40-WIP (14-Nov-2006)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          9e9e5184-127f-45d2-bf4a-e6f0a112f180
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed directory hash
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              10010624
Block count:              20002933
Reserved block count:     1000146
Free blocks:              1346998
Free inodes:              9805595
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1019
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Sun Apr 29 05:09:01 2007
Last mount time:          Thu Oct  4 16:36:53 2007
Last write time:          Thu Oct  4 16:36:53 2007
Mount count:              28
Maximum mount count:      36
Last checked:             Fri Aug 24 14:11:51 2007
Check interval:           15552000 (6 months)
Next check after:         Wed Feb 20 14:11:51 2008
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
First orphan inode:       2981901
Default directory hash:   tea
Directory Hash Seed:      e893c292-11b2-45a6-97a3-843909001a8a
Journal backup:           inode blocks
Journal size:             128M

What to do if your ext file system doesn't fit your partition
Here is what to do if your partition looks like it's full when you know it really shouldn't be,  or if programs like fsck complain that your superblock is boasting of a larger file system than your partition size can actually accomodate.
Code:
herman@work:~$ resize2fs -p /dev/sda2
Where: sda2 is my ext3 partition

The resize2fs command is used to calibrate the size of the file system to the size of the partition. The file system needs to be unmounted to do this, so it's probably best if you can do it from a LiveCD, or at least from an operating system in a different partition, making sure to unmount the file system in the partition you want to work on.

Example threads,
 
Ubuntu 6.06 - partimage problem

increasing root partition size

ext2/3 super block repair? (block count wrong)
Using e2label to set a filesystem label an ext4 filesystem
Here's a really cool customization that'll make your day-to-day computing chores easier and more fun!

Set labels for your ext2, ext3 or ext4 file systems.

This idea is great for USB flash memory sticks with ext2 or ext3 file systems, especially if you have more than one USB flash memory stick and you want to be able to tell which is which.

File systems in your hard disks can be given labels too. This makes a great improvement to Hardy Heron's new click-icon mounting ability.
A file system that has been give a label will stand out from other file systems when you look for them among the icons in your 'Places' menu, (see Filesystem mounting basics). Rather than just appearing as '40.0 GB disk', or  'disk-1' or something dull and boring like that, your file systems can each have a recognisable name and they'll be mounted with that name too.

It's easy to set a label for an ext2, ext3 or ext4 file system, just run the e2label command, and give your file system a name. A descriptive name is often useful, but you can choose give your file system a pet name or any kind of name you like.

All you have to do is take a look at your partition table with fdisk, as shown below,
herman@work:~$ sudo fdisk -lu

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1              63    41576219    20788078+   c  W95 FAT32 (LBA)
/dev/hda2   *    41576220   153276164    55849972+  83  Linux
/dev/hda3       153276165   156296384     1510110    5  Extended
/dev/hda5       153276228   156296384     1510078+  82  Linux swap / Solaris

Disk /dev/sde: 514 MB, 514850816 bytes
255 heads, 63 sectors/track, 62 cylinders, total 1005568 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1              63      996029      497983+  83  Linux
herman@work:~$
I'm going to give my USB flash memory stick a label, so first I need to find out the Linux device name it is given, so I used the 'sudo fdisk -lu' command to find out.
As you can see, my usbdisk is called '/dev/sde1', by the Linux kernel. I need to use that for the next command.

herman@work:~$ e2label /dev/sde1 WEBSITE
This is the command that sets a volume label for my ext3 file system in my usbdisk.
From now on my usbdisk won't just appear on my desktop as 'usbdisk', it will be labeled 'WEBSITE'.

All ext2, ext3 and ext4 file systems can be labeled as easily as that and having them labeled is very convenient if you have several ext2, ext3 or ext4 partitions in your hard disk(s) and USB flash memory sticks.

It is quite safe to run e2label at any time to set a label or change any label on any ext2 or ext3 file system.
Your file system labels will show up in Gnome Partition Editor too, (GParted).

Related Link: RenameUSBDrive, - Community Docs.

Thanks Mylorharbour for prompting me to update file system labeling and and emphasize it more.
Handy ext2 and ext3 commands,
  • mke2fs is the command used to make an ext2 filesystem in a device. 
  • e2fsck is the command to use for file system checking
  • tune2fs is the ext2 or ext3 tuning program.
  • dumpe2fs shows information from the superblock. 'sudo dumpe2fs -h /dev/hda2' shows the information that is in the superblock of /dev/hda2.
  • e2label is great for labelling your filesystems, this is especially handy for USB disks.
  • resize2fs is for adjusting the size of the file system to fit the partition properly. (calibrating)
  • mklost+found - used for making a new lost+found directory in case yours got deleted.



ReiserFS

Working with the Reiser File System

The original home page for ReiserFS was, http://www.namesys.com/, but that link will be down for the foreseeable future.
The alternative home page for namesys it this one, ReiserFS - webarchive.org. 

The Reiser File System is great for  busy partitions containing a lot of small files because it is up to fifteen times faster than most other file system for writing small files.

ReiserFS was the first Linux file system to feature file system journaling. File system journaling makes it easy to recover after a crash, (like when my dog suddenly unplugs my power cords from the wall). 
If for some reason journalling isn't wanted, we can easily turn off file system journaling in the ReiserFS simply by adding the mount option 'nolog' to our /etc/fstab files.

Example:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0

# /dev/sda1
UUID=6178d387-9ab5-4f23-a56d-8e0cba0addc3 / reiserfs notail,nolog,relatime,errors=remount-ro 0       1

# /dev/sda6
UUID=c6d20ccc-de8e-42ea-b568-aaf0cd049166 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
The downside is, not using journaling makes it harder to recover the file system after a crash, so it's debatable whether this is a good idea for everyone.  Some people thnk it will reduce disk writes and give them a little more speed.

ReiserFS also features 'tail packing', and can save around 6% disk space, but at the expense of some of the extra speed. If you want speed, just leave the 'notail' option as it is. If you're cramped for room and you need to pack your files into a smaller amount of disk space, delete the 'notail' option from your /etc/fstab line.\

Because of reiserfs's reputation of being up to 15x faster than ext3 for small files, a few Gnu/Linux users, especially some from the Arch Linux distro like to advocate the use of multiple partition installations with ext file systems in most partitions and reisers for /usr and /var partitions. Some people believe this can result in faster operating system performance. They could be right especially if it's done in conjunction with some kind of short stroking strategy across two or three large capacity hard disks.

Personally I like to stick with the simplicity of a single partition installation. I used to prefer reiserfs for flash memory but that was before ext4 came along with its SSD/flash memory enhancements and in my tests there doesn't seem to be enough difference in speed between ext4 and reiserfs to convince me to use reiserfs right now. I have not tried reiser4 as yet though, sorry. I will do some reading about reiser4 and look into it sometime soon. Finally, Reiser4 Benchmarks Against EXT4 & Btrfs - phoronix
UPDATE: As far as I know Reiser4 isn't finished yet and won't be supported by the Linux kernel at least for the time being.

Running a file system check on a Reiser File System
The easiest way for new users to run a file system check in a partition containing a Reiser File System is to boot your Ubuntu 'Desktop' live CD and  Run a filesystem check with GParted  (a user friendly GUI method). GParted will run 'reiserfsck --yes --fix-fixable --quiet /dev/sdxy' for you.

The following information is for those of us who prefer to use the command line, or if GParted couldn't fix it.

In the following examples, the file system to be checked is in partition /dev/sda2, yours will likely be a different number, so please check with 'sudo fdisk -lu', or 'blkid', or open Gnome Partition Editor (GParted), and take a look.

Always dismount a filesystem (partition) before running a filesystem check.
Code:
sudo umount /dev/sda2
Where: /dev/sda2 is a partition containing a reiserfs file system.



--check

Here we go now, this is the command to run first,
Code:
sudo reiserfsck --check --logfile check.log /dev/sda2
NOTE: After you press 'enter', you will see a message to let you know what reiserfsck will do for you and asking you to confirm.
Make sure you type 'Yes', (with a capital 'Y') after the prompt, or nothing will happen.

This runs a quick check (takes a look around), and tells you if anything is wrong.
This is a safe command for anyone to run at any time you like.
It doesn't fix anything, but you can use this whenever you want to perform a routine disk check or  any time you think something might be wrong with a reiser file system.

The feedback from this quick check will tell you if any more work is needed.

Exit status 0 means no errors were discovered, (you can relax and be happy).

Exit status 1 (and a report about fixable corruptions) means that you should run reiserfsck again with the --fix-fixable option.

Exit status 2 (and a report about fatal corruptions) means that you need to run reiserfsck again with the --rebuild-tree option.

If reiserfsck --check fails in some other way you should also run reiserfsck again with the --rebuild-tree option.


--fix-fixable

If 'reiserfs --check' reports back that something needs fixing, (or exit status 1), you need to run reiserfsck again with the --fix-fixable option.
sudo reiserfsck --fix-fixable --logfile fixable.log /dev/sda2
Where: /dev/sda2 is the partition which contains the reiser file system to be fixed.
NOTE: After you press 'enter', you will see a message to let you know what reiserfsck will do for you and asking you to confirm.
Make sure you type 'Yes', (with a capital 'Y') after the prompt, or nothing will happen.

The above command should fix most problems the average user will ever have with the reiser file system.


--rebuild-tree

If 'reiserfs --check' reports back that it found some fatal corruptions, (or exit status 2), that's a little bit more serious, and the --rebuild-tree option will be necessary.
You really should make a backup of you data first (if you haven't done so already), as this command may unlink some data to the lost+found directory, see Recovering files from lost+found.
This may not be a safe option for new users, you might want to seek advice from more experienced Linux users before using it.
Here it is anyway,
sudo reiserfsck --rebuild-tree --logfile rebuild.log /dev/sda2
Where: /dev/sda2 is the partition which contains the reiser file system to be fixed.
NOTE: After you press 'enter', you will see a message to let you know what reiserfsck will do for you and asking you to confirm.
Make sure you type 'Yes', (with a capital 'Y') after the prompt, or nothing will happen.


For more reiserfsck command options, type 'man reiserfsck' into your terminal,
man reiserfsck 

This link here is quite helpful too, Repairing ReiserFS file system with reiserfsck - nixCraft

If you just want to see what's written in your reiserfs journal header,
sudo debugreiserfs -J /dev/sda2
This lets you take a look at your journal header. It shows details of the state of your file system like whether it's clean or not, how long since it has been checked, what the file system UUID number is and some technical facts and figures. 


Setting a Volume Label in a Reiser File System
It's a very good idea to give each of your file systems a label, especially if you have a few of them.
The easiest way if you have Ubuntu 'Intrepid Ibex' or later, is to open Gnome Partition Editor and right-click on the partition and click 'LABEL', (or something like that), and give the file system a name.

If you have an older version of Ubuntu, or if you love the command line, here is an example of how to set your file system label in a Reiser File System,
Code:
sudo reiserfstune /dev/sdc5 -l "DEBIAN"
Where: /dev/sdc5 contains a Reiser File System (check with 'sudo fdisk -lu', 'sudo blkid', or take a look with Gnome Partition Editor).
Where: I want to name it 'DEBIAN"

Now whenever my Reiser File System is mounted, it will be given a mount point in /media named "DEBIAN" and the name 'DEBIAN" will appear under the icon on my Ubuntu desktop.
It will also be listed as "DEBIAN in Gnome Partition Editor and when I run the command 'sudo blkid' too.


ReiserFS Commands:

reiserfs -

mkreiserfs - creates a Linux ReiserFS filesystem on a device (usually a disk partition).

reiserfsck- searches for a Reiserfs filesystem on a device, replays any necessary transactions, and                    either checks or repairs the file system, (depending on the options you use after the                          command).

resize_reiserfs  - resize_reiserfs - resizer tool for the ReiserFS filesystem

reiserfstune  - The tunning tool for the ReiserFS filesystem.

debugreiserfs   - The debugging tool for the ReiserFS filesystem.

Mount options


More links about Reiserfs:

O'Reilly's Hacks: Hack 95. Repair and Recover ReiserFS File Systems

The structure of the Reiser file system by Florian Buchholz

reiserfsck
EXIT CODESMEANING
0no errors were discovered (  be happy, don't worry)
1file system errors were corrected
2a reboot is needed, (please reboot)
4fatal file system errors were left uncorrected;
please make a backup of the whole partition before proceding,
please run reiserfsck --rebuild-tree
6fixable file system errors were left uncorrected;
please run reiserfsck --fix-fixable
8an operational error has been encountered
(please check your computer for hardware problems and try again)
16a usage or syntax error has been encountered,
(please check your command and try again)


BTRFS
The B-Tree File System

Links:

btrfs - Ubuntu Community Documentation



JFS
Journaling File System

Links:

JFS Filesysem - archlinux wiki

JFS For Linux - sourceforge


XFS

Links:
XFS - Wikipedia, the free encyclopedia

XFS: A high-performance journaling filesystem -

Introducing XFS  - Advanced filesystem implementor's guide



SQUASHFS

What is SquashFS - tldp.org

squashfs - sourceforge

SquashFS HOW TO - tldp.org

How to mount casper -rw in persistence USB install


Some people like to install Ubuntu in a USB flash memory stick and use it like a regular Ubuntu installation.
Currently the two most popular ways to make a  Live CD persistence type of Ubuntu installation in a USB flash memory drive are by using the Ubuntu Startup Disk Creator or by running third party software from Pendrive Linux.

At some time it might be necessary to be able to access the user's saved files inside the USB installation, but this isn't always easy for new users. You need to know how to use a few Linux commands.
Here is an example of the commands needed to make a backup or perform a file rescue from a Ubuntu Live CD Persistence type of installation in a USB drive when you're working from a real Ubuntu operating system.

From: Casper-rw -- How to Access - Ubuntu Web Forums

First, plug in your USB drive with the Ubuntu Startup Disk or Pendrive Linux type of Ubuntu CD install.

Then, open a terminal up and use the following commands to mount your file system,
sudo mkdir /media/casper

cd /media/TSB\ USB\ DRV/
Where: The name of the mount point of the USB drive in /media is TSB\ USB\ DRV/  be prepared to replace that with something else as your mount point name will be different than mine. Hint: use your TAB key or ls command.

sudo mount -o loop casper-rw /media/casper/

A folder should open and you should be able to navigate to your personal files in your Ubuntu Startup Disk or Pendrive Linux Persistence USB installation.

Perform your file backup or file rescue or whatever.

When you're done, you can dismount the file system and delete the mount point to clean up with the following commands,
sudo umount /media/casper

sudo rmdir /media/casper








Running a filesystem check on a FAT32  filesystem
You might have a FAT32 data partition or a USB disk that you need to run a file system check on but you might have a Linux-only  computer.

From Ubuntu
herman@bookpc:~$ sudo fsck.vfat -a -l -v /dev/hda1

From  GParted -- LiveCD
  root@GParted:~# fsck.vfat -a -l -v /dev/hda1

If you have a Windows operating system and you can use CHKDSK from Windows, then you might need to do that instead or Windows might not recognize it. I don't know why that is.

fat32 usbdisk volume label
If you have more than one an external usb thumb drive with a fat32 file system you can set a disk label so that every time you plug your usb disks in they will have a name so you can tell which is which.

To set a file system volume label in a usbdisk with a fat32 file system,
 mkdosfs  [ -n volume-name ] device
worked for me, use sudo fdisk -lu to work out which device it is first, (/dev/sd??) then apply the command, for example: mkdosfs -n 10GBvfatdata /dev/sdf1

Make sure you back up your usb disk's data first!!!
mkdosfs - create an MS-DOS file system under Linux.
Next time the usbdisk is plugged in and mounted it will be mounted with that label.

Make sure you back up your usb disk's data first, because this command makes a new filesystem!
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1              63    41576219    20788078+   c  W95 FAT32 (LBA)
/dev/hda2   *    41576220   153276164    55849972+  83  Linux
/dev/hda3       153276165   156296384     1510110    5  Extended
/dev/hda5       153276228   156296384     1510078+  82  Linux swap / Solaris

Disk /dev/sde: 514 MB, 514850816 bytes
255 heads, 63 sectors/track, 62 cylinders, total 1005568 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1              63      996029      497983+  83  Linux

Disk /dev/sdf: 30.0 GB, 30005820928 bytes
255 heads, 63 sectors/track, 3647 cylinders, total 58605119 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *          63     2104514     1052226    b  W95 FAT32
/dev/sdf3        56725515    58605119      939802+   5  Extended
/dev/sdf4         2104515    56725514    27310500   83  Linux
/dev/sdf5        56725578    58605119      939771   82  Linux swap / Solaris

Partition table entries are not in disk order
herman@work:~$

For example I want to set a volume label for this fat32 partition in my external USB disk. I can see it is /dev/sdf1 from the output above.

Make sure you back up your usb disk's data first, because this command makes a new filesystem!
herman@work:~$ mkdosfs -n 10GbFAT32 /dev/sdf1
So I entered the above command. Now after unmounting the disk, every time it is mounted again it will be mounted with the label "10GbFAT32". Now I can tell which USB Disk icon on my Desktop is which and choose the right one to click every time to open it with.

When there are 'differences between the bootsector and its backup'
If there is a FAT32 (Windows) file system present in the machine, it usually has an entry in our /etc/fstab file made automatically when Ubuntu is installed. That means it will be automatically mounted during each boot-up.
Ubuntu needs to check other file systems during boot-up to make sure they are in a fit and safe condition to write to, especially if they are to be mounted 'read/write'. A disaster could result if an attempt is made to write data to a file system already has some kind of small file system problem.

The file system check is turned on by a number in the 'pass' column in our /etc/fstab file.
Windows and other file systems would normally have a '2' in the 'pass' column so fsck will check them in parallel with any other file systems to save time during boot-up.
You can change the number in the 'pass' column from '2' to '0' if you don't want Ubuntu to check  your Windows file system at all, but I do not recommend that.
 
The first sector of a Windows partition is known as the boot sector.
Malware and viruses like to alter the code in a Windows boot sector so the malware or virus will be booted when Windows is booted, and/or to show you an ad as soon as your Windows computer boots.
Another way to foul up a Windows boot sector would be by installing GRUB to it by accident.
(GRUB should be installed to MBR, or a Linux bootsector, but not to a Windows bootsector).

Fortunately, in Windows with the FAT32 file system, there is a backup bootsector which can be used to restore the original bootsector.  
I don't  imagine there would be any Linux command you can use to fix the boot sector of Windows with the NTFS file system. It is only recently that Linux NTFS support has made NTFS safely writable from Linux. You would need to use FIXBOOT from a Windows  recovery console.

For Windows with the FAT32 file system you can do this in Ubuntu with a 'sudo' command. Make sure the file system is unmounted first, then use 'sudo dosfsck -ar /dev/hdx,y', or 'sudo fsck -V -r /dev/hdx,y'.
WARNING: First try scanning your Windows system for viruses and malware with as many anti adware and anitvirus apps as you can get your hands on, as they may can your bootsector and find the virus by recognizing it's code in your bootsector. Replacing your boot sector with it's backup right away might not be the best idea. You really need to get rid of the virus first.

For a different opinion about this error message and how to handle it, see this Ubuntu forums thread Not automatically fixing this  and in particular take note of what ncdave4life had to say in post #10. That seems to make sense to me too, and would likely be perfectly correct, if you have more than one version of Windows this error message might not be anything to worry about.

The example I will give here will fix your Windows FAT32 boot sector if you have accidentally made a mistake with the grub-install command and installed GRUB to the wrong partition.

It is best to use a Live CD for this type of work, so the file system won't be mounted.
In this example I used a GParted -- LiveCD.
If you use a Ubuntu Live CD, you still need to use the 'sudo' prefix before each command.
Code:
  root@GParted:~# dosfsck -ar /dev/hda1
Or:
  root@GParted:~# fsck -V -r /dev/hda1
Where: /dev/hda1 is a FAT32 file system partition. (Not NTFS).
After entering either of these commands, the program will show you a report, so you can see for yourself what the differences are.
Normally, the report would not be as large as the one shown here, and would only show a few bytes where the differences were found. This example was obtained by installing Grub to the FAT32 bootsector, which is not a recommended thing to do. (Don't try this at home, folks!).

  root @ Parted # sudo fsck -v -r /dev/hda1
fsck 1.39 (29-May-2006)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
There are differences between boot sector and its backup.
Differences: (offset:original/backup)
  62:03/00, 63:02/00, 64:ff/80, 66:00/29, 67:80/f0, 68:ce/16, 69:53/29
  , 70:47/26, 71:05/4e, 72:00/4f, 73:08/20, 74:fa/4e, 75:90/41, 76:90/4d
  , 77:f6/45, 78:c2/20, 79:80/20, 80:75/20, 81:02/20, 90:fa/33, 91:33/c9
  , 92:c9/8e, 93:8e/d1, 94:d1/bc, 95:bc/f4, 96:f8/7b, 97:7b/8e, 98:8e/c1
  , 99:c1/8e, 100:bd/d9, 101:78/bd, 103:c5/7c, 104:76/88, 105:00/4e, 106:1e/02
  , 107:56/8a, 108:16/56, 109:55/40, 110:bf/b4, 111:22/08, 112:05/cd
  , 113:89/13, 114:7e/73, 115:00/05, 116:89/b9, 117:4e/ff, 118:02/ff
  , 119:b1/8a, 120:0b/f1, 121:fc/66, 122:f3/0f, 123:a4/b6, 124:8e/c6
  , 125:d9/40, 126:bd/66, 127:00/0f, 128:7c/b6, 129:c6/d1, 130:45/80
  , 131:fe/e2, 132:0f/3f, 133:8b/f7, 134:46/e2, 135:18/86, 136:88/cd
  , 137:45/c0, 138:f9/ed, 139:38/06, 140:4e/41, 141:40/66, 142:7d/0f
  , 143:25/b7, 144:8b/c9, 145:c1/66, 146:99/f7, 147:bb/e1, 148:00/66
  , 149:07/89, 150:e8/46, 151:97/f8, 152:00/83, 153:72/7e, 154:1a/16
  , 155:83/00, 156:eb/75, 157:3a/38, 158:66/83, 159:a1/7e, 160:1c/2a
  , 161:7c/00, 162:66/77, 163:3b/32, 164:07/66, 165:8a/8b, 166:57/46
  , 167:fc/1c, 168:75/66, 169:06/83, 170:80/c0, 171:ca/0c, 172:02/bb
  , 173:88/00, 174:56/80, 175:02/b9, 176:80/01, 177:c3/00, 178:10/e8
  , 179:73/2b, 180:ed/00, 181:bf/e9, 182:02/48, 183:00/03, 184:83/a0
  , 185:7e/fa, 186:16/7d, 187:00/b4, 188:75/7d, 189:45/8b, 190:8b/f0
  , 191:46/ac, 192:1c/84, 193:8b/c0, 194:56/74, 195:1e/17, 196:b9/3c
  , 197:03/ff, 198:00/74, 199:49/09, 200:40/b4, 201:75/0e, 202:01/bb
  , 203:42/07, 204:bb/00, 205:00/cd, 206:7e/10, 207:e8/eb, 208:5f/ee
  , 209:00/a0, 210:73/fb, 211:26/7d, 212:b0/eb, 213:f8/e5, 214:4f/a0
  , 215:74/f9, 216:1d/7d, 217:8b/eb, 218:46/e0, 219:32/98, 220:33/cd
  , 221:d2/16, 222:b9/cd, 223:03/19, 224:00/66, 225:3b/60, 226:c8/66
  , 227:77/3b, 228:1e/46, 229:8b/f8, 230:76/0f, 231:0e/82, 232:3b/4a
  , 233:ce/00, 234:73/66, 235:17/6a, 236:2b/00, 237:f1/66, 238:03/50
  , 239:46/06, 240:1c/53, 241:13/66, 242:56/68, 243:1e/10, 244:eb/00
  , 245:d1/01, 246:73/00, 247:0b/80, 248:eb/7e, 249:27/02, 250:83/00
  , 251:7e/0f, 252:2a/85, 253:00/20, 254:77/00, 255:03/b4, 256:e9/41
  , 257:fd/bb, 258:02/aa, 259:be/55, 260:7e/8a, 261:7d/56, 262:ac/40
  , 263:98/cd, 264:03/13, 265:f0/0f, 266:ac/82, 267:84/1c, 268:c0/00
  , 269:74/81, 270:17/fb, 271:3c/55, 272:ff/aa, 273:74/0f, 274:09/85
  , 275:b4/14, 276:0e/00, 277:bb/f6, 278:07/c1, 279:00/01, 280:cd/0f
  , 281:10/84, 282:eb/0d, 283:ee/00, 284:be/fe, 285:81/46, 286:7d/02
  , 287:eb/b4, 288:e5/42, 289:be/8a, 290:7f/56, 291:7d/40, 292:eb/8b
  , 293:e0/f4, 294:98/cd, 295:cd/13, 296:16/b0, 297:5e/f9, 298:1f/66
  , 299:66/58, 300:8f/66, 301:04/58, 302:cd/66, 303:19/58, 304:41/66
  , 305:56/58, 306:66/eb, 307:6a/2a, 308:00/66, 309:52/33, 310:50/d2
  , 311:06/66, 312:53/0f, 313:6a/b7, 314:01/4e, 315:6a/18, 316:10/66
  , 317:8b/f7, 318:f4/f1, 319:60/fe, 320:80/c2, 321:7e/8a, 322:02/ca
  , 323:0e/66, 324:75/8b, 325:04/d0, 326:b4/66, 327:42/c1, 328:eb/ea
  , 329:1d/10, 330:91/f7, 331:92/76, 332:33/1a, 333:d2/86, 334:f7/d6
  , 335:76/8a, 336:18/56, 337:91/40, 338:f7/8a, 339:76/e8, 340:18/c0
  , 341:42/e4, 342:87/06, 343:ca/0a, 344:f7/cc, 345:76/b8, 346:1a/01
  , 347:8a/02, 348:f2/cd, 349:8a/13, 350:e8/66, 351:c0/61, 352:cc/0f
  , 353:02/82, 354:0a/54, 355:cc/ff, 356:b8/81, 357:01/c3, 358:02/00
  , 359:8a/02, 360:56/66, 362:cd/49, 363:13/0f, 364:61/85, 365:8d/71
  , 366:64/ff, 367:10/c3, 368:5e/4e, 369:72/54, 370:0a/4c, 371:40/44
  , 372:75/52, 373:01/20, 374:42/20, 375:03/20, 376:5e/20, 377:0b/20
  , 378:49/20, 379:75/00, 380:b4/00, 381:c3/00, 382:03/00, 383:18/00
  , 384:01/00, 385:27/00, 386:0d/00, 387:0a/00, 388:49/00, 389:6e/00
  , 390:76/00, 391:61/00, 392:6c/00, 393:69/00, 394:64/00, 395:20/00
  , 396:73/00, 397:79/00, 398:73/00, 399:74/00, 400:65/00, 401:6d/00
  , 402:20/00, 403:64/00, 404:69/00, 405:73/00, 406:6b/00, 407:ff/00
  , 408:0d/00, 409:0a/00, 410:44/00, 411:69/00, 412:73/00, 413:6b/00
  , 414:20/00, 415:49/00, 416:2f/00, 417:4f/00, 418:20/00, 419:65/00
  , 420:72/00, 421:72/00, 422:6f/00, 423:72/00, 424:ff/00, 425:0d/00
  , 426:0a/00, 427:52/00, 428:65/0d, 429:70/0a, 430:6c/4e, 431:61/54
  , 432:63/4c, 433:65/44, 434:20/52, 435:74/20, 436:68/69, 437:65/73
  , 439:64/6d, 442:6b/73, 443:2c/69, 444:20/6e, 445:61/67, 446:6e/ff
  , 447:64/0d, 448:20/0a, 449:74/44, 450:68/69, 451:65/73, 452:6e/6b
  , 454:70/65, 456:65/72, 457:73/6f, 458:73/72, 459:20/ff, 460:61/0d
  , 461:6e/0a, 462:79/50, 463:20/72, 464:6b/65, 465:65/73, 466:79/73
  , 467:0d/20, 468:0a/61, 469:00/6e, 470:00/79, 471:00/20, 472:49/6b
  , 473:4f/65, 474:20/79, 476:20/74, 477:20/6f, 479:20/72, 480:53/65
  , 481:59/73, 482:53/74, 483:4d/61, 484:53/72, 485:44/74, 486:4f/0d
  , 487:53/0a, 488:20/00, 489:20/00, 490:20/00, 491:53/00, 492:59/00
  , 493:53/00, 494:7e/00, 495:01/00, 497:57/00, 498:49/00, 499:4e/00
  , 500:42/00, 501:4f/00, 502:4f/00, 503:54/00, 504:20/00, 505:53/ac
  , 506:59/bf, 507:53/cc

1) Copy original to backup
2) Copy backup to original
3) No action
? 2


You will be offered a choice of the following actions,
1) Copy original to backup
2) Copy backup to original
3) No action
?
You type the answer after the '?' prompt.

You should be careful here. Most of the time I think it would be the original (the bootsector that is in use) that would be corrupted. In that case 99% of the time I would suggest typing a '2' so the bootsector will be restored from the backup copy.
However, there was a thread recently in Ubuntu Web Forums where it was the backup that was found to be corrupt for some reason, and the user fixed it by typing '1' instead.
Most of the time it should be '2', but be careful.

Then, it will ask you to confirm,
   Perform changes  ?  (y/n)
I suggest typing 'Y' here.
That's it, it should be fixed!

Another way to fix it would be to run 'FIXBOOT' from a Windows recovery console.

If it was a Windows virus that corrupted the boot sector, you would be best advised to re-install Windows and try to put your data back in again without any viruses this time.





NTFS and FAT32 File System Repair and Maintenance 
The NTFS file system is the preferred file system from Microsoft for most Windows XP and Vista users since it's supposed to add more security for the Windows Operating System.
The NTFS file system needs a file system check every once in a while the same as any other file system and it's a good idea to do so.  
It is also recommended to run CHKDSK after the file system had been resized.
Often that will clear up problems or at least keep things running well.
In Windows XP, the program to use for running a file system check on a FAT32 or NTFS file system is CHKDSK.

CHKDSK on bootup
To schedule CHKDSK to run next time you reboot Windows XP, you can go 'My Computer',-->'Local Disk (C:), and right-click on 'Properties'.
Open the 'Tools' tab, and in the 'Error Checking' box, click the 'Check Now' button.
A 'Check Disk' window will open.
  1. Place a check mark in the square for 'automatically fix file system errors', and also a check mark in the square for 'Scan for and attempt recovery of bad sectors'.
  2. Click the 'Start' button
  3. A window will open advising you it can't do it right now but you can schedule a disk check for next time you boot up. Click Yes.
  4. Reboot your computer and choose Windows XP from your GRUB menu. Don't be alarmed when it blue-screens in the middle of starting Windows XP and runs your disk check.
Just to make sure you understand, or in case I missed anything, here's a Symantec link about how to do that, How to Run Microsoft CHKDSK from the command line.

CHKDSK from Windows Recovery Console

If an NTFS file system needs repair or maintenance, and Windows won't even boot, you may need to use a Windows XP Recovery Console, available from your Windows XP Installation disk (CD-ROM).
If your  computers came with a 'Recovery' CD or worse, a 'Recovery Partition' instead of a real Windows 'Installation' disc, you will need to go borrow a Windows XP 'Installation' CD from a friend, just to use the Recovery Console.

The CKDSK has 'switches' (Windows language for 'options'), for specifying what you want the command to do.
Here are a few links to explain what 'switches' you can use and what they do,
Chkdsk - Microsoft, and An explanation of CHKDSK and the new /C and /I switches - Microsoft, and Sample Chapter from Microsoft® Windows® 2000 Professional Resource Kit.
CHKDSK - ss64.com

NTFS File System Checking from Linux
If you want to you can induce Windows to run a file system check next time it boots on an NTFS file system from Linux, 
You'll need to install ntfsprogs.
herman@bookpc:~$ sudo apt-get install ntfsprogs

Run 'man ntfsprogs' for a list of all the things you can do with ntfsprogs,
herman@bookpc:~$ man ntfsprogs

As you will see, the command for inducing a file system check on an NTFS file system from Linux is 'ntfsfix'.
herman@bookpc:~$ sudo ntfsfix /dev/hda1
Where: hda1 is the partition containing the NTFS file system to be checked and repaired. If you're not sure you can check first with Gnome Partition Editor or by running 'sudo fdisk -lu'.
Restore an NTFS boot sector with it's backup

Method 1
You may need to restore the backup for the NTFS boot sector if you have damaged it, for example by installing the wrong boot loader to it by mistake.

If you have your Windows Installation CD or can get a Windows XP Recovery Console somehow, if you run the command FIXBOOT, it will fix your Windows boot sector for you.
Lots of people are not given a Windows Installations disk, but a 'Recovery' disk, or a recovery partition and no CD at all.


Method 2
In an NTFS partition, the backup of boot sector is stored in the last sector of the partition.
If you run 'sudo fdisk -lu', it will tell you what sectors are the start sectors and end sectors  of your partitions,
herman@amd64hh:~$ sudo fdisk -lu
[sudo] password for herman:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x000ba675

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   312578047   156288000    7  HPFS/NTFS
This tells me that my NTFS boot sector is in sector number 2048 and the backup of the boot sector is in sector number 312578047.

sudo dd if=/dev/sda of=/home/herman/bootsecbak2048.img skip=312578047  bs=512 count=1
I'll copy the backup bootsector to my /home/herman/ folder.

sudo dd if=/home/herman/bootsecbak2048.img of=/dev/sda1 bs=512 count=1
Now I'll copy the backup to the boot sector.

Method 3
TestDisk is a program you can install in Ubuntu, and TestDisk can easily restore the boot sector in an NTFS partition from the backup, or even rebuild an NTFS boot sector.
TestDisk has their own page with illustrations, here is a link, TestDisk Step by Step.
And here is the specific link, 12 NTFS Boot sector recovery.

If you want to install TestDisk in Ubuntu, use a command like this,
herman@bookpc:~$ sudo apt-get install testdisk

To run TestDisk, you start it with the testdisk command,
herman@bookpc:~$ sudo testdisk





genisoimage commands for making .iso file to make CDs and DVDs

CDs and DVDs use special file systems that are very different from the file systems we use for hard disks and floppy disks.
The genisoimage command is used for making file systems that can be written to a CD.

To use the genisoimage command you should type 'man genisoimage' into a terminal and read the man page about it first. Unfortunately the man page for the genisoimage command is almost impossible for beginners to understand. We need to begin with some understanding of the lingo and terminology peculiar to the world of CD/DVD making.

CD and DVD file systems
CD and DVD file systems include High Sierra, ISO 9660, Rock Ridge, UDF, and HFS.
The genisoimage command can be used to make an .iso file with any of these file systems in it depending on what command options you use.

High Sierra
High Sierra, made up way back in 1986, was the first file system for CDs that was widely recognised and enabled CDs to be made that would be readable in different operating systems.
By agreeing on certian standard rules, suitable drivers that match those rules could be made for various operating systems so that any CD can be made or played in any operating system. 

ISO 9660
ISO 9660 is a newer version of the High Sierra format, and was developed in 1988 with a few improvements by the International Organization for Standardization, (I.S.O.).

There are three 'levels' of ISO 9660,

level 1 is the simplest and safest, (you can be sure it will be readable by almost any operating system), while levels 2 and 3 add useful enhancements.

ISO 9660 level 1 rules contain the following restrictions,
  1. Filenames can only include upper case letters (A to Z), numbers (1 to 9), and the underscore _
  2. Filenames are limited to a maximum of eight characters long plus a three character filename extension, for example: FILENAME.COM
  3. Directory names are restricted to be eight characters long and no filename extension is allowed.
  4. Directories are limited to eight levels deep.
  5. Files must be contiguous.

ISO 9660 level 2 CD file systems mostly conform to the rules listed for ISO 9660 level 1 (above), but the filenames can be longer,
  1. Filenames can only include upper case letters (A to Z), numbers (1 to 9), and the underscore _
  2. Filenames are limited to a maximum of thirty characters long including the filename extension, for example: FILENAME_IS_NOW_TWENTYSEVEN.COM
  3. Directory names are restricted to be eight characters long and no filename extension is allowed.
  4. Directories are limited to eight levels deep.
  5. Files must be contiguous.

ISO 9660 level 3 CD file systems mostly conform to the rules listed for ISO 9660 level 2 (above), but the files don't have to be contiguous,
  1. Filenames can only include upper case letters (A to Z), numbers (1 to 9), and the underscore _
  2. Filenames are limited to a maximum of thirty characters long including the filename extension, for example: FILENAME_IS_NOW_TWENTYSEVEN.COM
  3. Directory names are restricted to be eight characters long and no filename extension is allowed.
  4. Directories are limited to eight levels deep.
See also: ISO 9660 - Wikipedia, the free encyclopedia

Joliet
The Joliet file system for CDs is recognized by Windows 95 and later operating systems, it is based on ISO 9660, but even longer file names are allowed, and directory names can have extensions.
  1. Filenames can consist of any Unicode characters you like, including spaces, and be up to 64 characters long.
  2. Directory names are restricted to be eight characters long and filename extensions are allowed.
  3. Directories can be more than eight levels deep.
  4. multisession recording is supported.

Rock Ridge
RRIP (Rock Ridge Interchange Protocol) is yet another extension of ISO 9660 made up in 1994 for support for Unix filesystem features like file permissions and things like that.
Windows computers can still read a disc with Rock Ridge attibutes because it's based on ISO 9660, but the RRIP extensions are ignored when viewed in Windows.
See also: Rock Ridge - Wikipedia, the free encyclopedia

UDF

Universal Disk Format-  Packet writing is supported, enabling the writing of small amounts of data to a CD-ROM or DVD, just like you can to a regular hard disk.
Filenames up to 255 characters long are supported.
Computers with old CD-ROM drives, or old operating systems like DOS can't read these CDs unless the drive conforms to the 'multiread' specification.
Most computers now have at least a CD burner or DVD/CD-RW optical drive and operating systems newer than Windows 95 or later.  http://www.osat.org/specs/index

HFS
HFS is the file system for CDs used by Macintosh computers. Pure HFS can't be read in a PC based computer, but it is possible to burn a 'hybrid' HFS/ISO 9660 or HFS/Joliet CD that can be read by both kinds of computer. Either system will only be able to see the part of the disc that is compatible with it though.

Aliases: If a file with a name that is too long is included in a CD, the file name will be automatically truncated at the filename limit by the operating system that is trying to read the disk. 

man genisoimage for more information.

Presentation CD - How to Make An 'Autoplay' CD-ROM

NOTE: These commands were working in Ubuntu Feisty Fawn, but the .iso file I made with the genisoimage command in Ubuntu Gutsy Gibbon was invisible in Windows, and didn't open in a web browser.
I haven't tested these commands in later versions of Ubuntu yet.
Updates to the genisoimage program may have already fixed the problem.
The genisoimage program is an open source replacement for mkisofs. Mkisofs worked okay but we don't use it anymore because of issues regarding its free software status since it's developer made a deal with a proprietary software company.

To make a cool presentation CD, you just need to make a directory (folder), in your /home/username directory.
For example I made a new empty directory called: windmill-cd

Then inside that directory I pasted a series of 30 photos showing how my friends and I helped  dismantle one of the largest windmills in Australia and load it onto a tractor-trailer to take it home.


MAKING A WEBSITE INSIDE A DIRECTORY

I used Kompozer (installable in Ubuntu under 'Applications'-->'Add/Remove programs'), to make an .html file in my windmill-cd directory.
Using Kompozer, I began with the first web page named 'index.html', and added the first three photos to it and wrote the story under the photos.
I also included internet links to web sites about windmills and about underground water in my .html page. Windmills are used mainly for raising water from bores (wells), here in the dry Australian Outback.
Then, I made another .html page and named it 'p_2.html', and made a link to it from the index page. That page had three photos in it along with whatever text was required, and so on, until the whole series of photos was presented and explained.
I found I needed to do it that way because during testing, I found that 30 full size photos loaded in one single web page will bog down some computers, especially those that are low on RAM.

It is also possible to create links to whatever else you might want to present on the disk besides the next web page.
I haven't tried making it link to videos, but I imagine that would be worth a try, it should be possible.
All you need to remember is to make sure all the files you link to are placed in your presentation project's directory, the same as if you are making an ordinary website.
 
Internet links will work if the computer used for displaying the CD will be connected to the internet.


MAKING THE DIRECTORY INTO AN .ISO

Many people you might want to give a presentation CD to still use Windows computers, and to make a CD that will instantly open in Internet Explorer as soon as it's inserted in the drive of a Windows computer (autoplay) I just added a couple of plain text files like this,
[autorun]
open=autorun.bat
autorun.inf

@echo Loading CD...
@start index.html
@cls
@exit
autorun.bat
You can make those two files with gedit, they need to be named: autorun.inf and autorun.bat

...and if you named your first .html file: index.html it will automatically open that file when used in Windows computers. That really impresses most people!

In Linux computers, you just need to look for the index.html file and click on it to open it.

When I was finished making my WirillaWindmill presentation directory I used the following genisoimage command to make it into an .iso file,
herman@work:~$ genisoimage    \
-r    \
-V "WINDMILL_CD"    \
-J    \
-l    \
-o
windmill.iso windmill-cd
The -o option in this command will make an .iso file named windmill.iso. from a directory named 'windmill-cd'.

The -V option is for giving the CD a title, so it will show up with an icon titled "WINDMILL_CD" when it appears on someone's desktop.

You will probably want to name your own directory that you will make some different name than 'windmill-cd, so you must alter your own command accordingly. Same with the name for the .iso file you will make and the title for your CD.

Type man genisoimage in a terminal for more information if you want to see all the options and learn everything you can do with the genisoimage command.

TIP: The genisoimage command has a habit of running by itself before I press 'Enter'.
To avoid any inconvenience I use a text editor page to type my genisoimage command out completely and then check it before copying and pasting it into a terminal. 

If you can manage to make even an average presentation CD in this fashion you will probably impress the heck out of most employers or whoever it is you want to impress.
They probably won't have the software, (in their Windows computers), or the know-how to be able to do anything like this.  Just act cool and say something like, "Oh, well I use Ubuntu Linux, you know."

Mine might be used as part of a tourist promotion. The windmill we moved will be re-erected in out town as an item of interest for tourists and the story of how we moved it there will add interest to the history of the windmill.

The idea of making an self running CD can be used for business (sales) presentations and would be great for Linux advocacy too.



Here's an example of the genisoimage command in action, this one is for making a bootable LiveCD out of a directory full of  files,
Code:
herman@work:~$ genisoimage    \
-input-charset iso8859-1  \
-r    \
-V "Ubuntu Live CD"    \
-cache-inodes    \
-J    \
-l    \
-b isolinux/isolinux.bin    \
-c isolinux/boot.cat    \
-no-emul-boot    \
-boot-load-size 4    \
-boot-info-table    \
-o ubuntu-7.04-desktop-i386.iso 
ubuntu-7.04-desktop-i386
Refer to thread: Create an .iso from the ubuntu files.
I still haven't got this one perfect yet, it doesn't have the correct md5sum, but it does make a bootable and usable Live CD out of the right files.



Here's another one.
Code:
herman@work:~$ genisoimage -R -b boot/grub/stage2_eltorito  \
-input-charset iso8859-1  \
-V "SUPERGPARTPUPPY"  \
-no-emul-boot \
-boot-load-size 4 -boot-info-table -o 
supergpartpuppy.iso supergpartpuppy
Refer to this site's:
How To Build a Super GRUB Disk/GParted CD / DVD.
and
How to make your own personalized GRUB CD-RW

man genisoimage for more information.

That's how to make a folder full of files into an .iso file.

Copy a CD or DVD to an .iso file
To do things the other way around and copy a CD or DVD to an .iso file, we use the dd command,
dd if=/dev/cdrom0 of=/home/username/filename.iso bs=2048 conv=sync,notrunc
Where: cdrom0 (cdrom zero) is your optical drive, it could be a different number than 0, (so please check).
Where: 'username' is replaced with your own particular user name.
Where: 'filename' is replaced with anything you want.








Running a check for bad blocks on your hard disk
Here's a great link from 'Tips For Linux Explorers', about this: Bad Blocks

The command 'sudo badblocks -sv /dev/sda2' or whatever partition number you have, is for checking your hard disk for bad blocks. It can take quite some time, especially if have a big hard disk and you decide to check the entire hard disk at once.  
herman@gutsy:~$ sudo badblocks -sv /dev/sda2
Where: /dev/sda2 is the partition to be checked. Replace this number with your own partition number which you should know from reading the output from 'sudo fdisk -lu', or by looking with Gnome Partition Editor.

herman@gutsy:~$ sudo badblocks -sv /dev/sda2
Checking blocks 0 to 12908226
Checking for bad blocks (read-only test):done
Pass completed, 0 bad blocks found.
Here's what you should see when it's finished if your hard disk has passed.
If your hard disk has bad blocks, you will be given lots of numbers. Your hard disk probably should be replaced very soon!!!
A 'bad block' is an area of your hard disk where the material is losing it's ability to retain a magnetic field and thus store data reliably. There are spare sectors in your hard disk when it is new, which the hard disc will swap out silently when badblocks develop due to imperfections and deterioration of the materials. It's only after those spare sectors have been all used up that bad blocks start to become apparent to the file system. When that starts to happen, your hard disk is getting close to the end of its useful life.



Smartmontools
If you're having an excessive amount of file system problems, a sophisticated way to check on the health of your hard disk is to use smartmontools, if your hard disk supports S.M.A.R.T.
Smartmontools is installable in Ubuntu through apt-get or Synaptic Package Manager.

To install smartmontools,
herman@gutsy:~$ sudo apt-get install smartmontools

To make sure it's enabled in the hard disk you want to check,
herman@gutsy:~$ sudo smartctl -s on /dev/sda

This command will run smartmontools and if not file named 'harddiskreport' exists yet, it will make one and print the output to that file.
If a file by that name already exists, it will append the output to the 'harddisk report' file,
herman@gutsy:~$ sudo smartctl -a /dev/sda >> harddiskreport
Now you can go and find the file 'harddiskreport' and study it.
Installing smartmontools and running the command are the easy parts, making sense of the output is for the learned.
These links should be helpful to most people: Self-Monitoring, Analysis, and Reporting Technology,
and, Self-Monitoring Analysis and Reporting Technology (SMART) - Storage Review.com






Avoiding filesystem damage

There only a few ways you can cause damage to a Linux filesystem.

Improper (sudden) shutdown due to user error or panic
See proper emergency shutdown procedures below here, (what to do if your operating system freezes up).
This includes unplugging an external USB hard drive or USBdisk, mp3 player, etc, without clicking 'eject' first or 'unmount'.

Improper (sudden) shutdown due to a power failure
You should use a good UPS (Unlimited Power Supply) unit that will beep if the power is cut and give you time to shut your computer down if it's a serious outage.

User abuse or error
Running the wrong apps or commands on it, or running commands on it when it is still mounted when it should be unmounted first.

Bad blocks in your hard disk it could be that your hard disk is just getting old.
It might be running hot. It could be about to have a bearing failure. Or  maybe the computer has been dropped  or bumped a little too hard while the hard disks were spinning. (Especially if your computer is a laptop).
Refer to this link, Check On Your Hard Disks With Smartmontools.

* If any of the above things happen to a filesystem and you know about it, it is a good idea to run a filesystem check on it as soon as possible (A.S.A.P.), and preferably before writing any more data to the device.
Proper techniques (in the event of a frozen system) to prevent filesystem damage
If your mouse or keyboard stops working on you, try unplugging them at the usb or ps/2 port  and wait a second, then plug them back in again. Often that does the trick.

If it's just your mouse that won't work, but your keyboard is still functioning, press 'Alt + F1', for the menus and then use your arrow keys to navigate through the menus. Use 'Alt + F4' to close a Window. Use 'Esc' to quit.

Two ways to find and 'kill' a runaway process:
(don't do a 'hard reboot', which is dangerous to your filesystem).

1. xkill
You need to be able to use your mouse if you want to use xkill.
  1. Open a terminal and enter the command 'xkill'.
  2. Move the 'x' shaped cursor over the window of the program you want to kill
  3. click on it to kill it.
2. Using the top command:
  1. Press alt+ctrl+F1 for a console.
  2. Log in with your username and password as prompted.
  3. Use your 'top' command and then take a look at your 'top' output for the PID number of the offending process.
  4. Press 'k'
  5. Type the PID number of the process you want to kill.
  6. You will be asked if you want to kill PID 'xxxxx' with signal [15], type 'y', and press 'enter'.
  7. If a signal 15 doesn't work, use signal 9 only if you have to, it is more rough and forceful.
  8. Press 'q' quit the top program
  9. type 'exit' to exit the console
  10. Press alt+ctrl+F7 to return to GUI.
3. Another way: (from the command line)
To 'background' a process: Press 'Ctrl' + 'Z' keys.
To 'foreground' the process: press 'f' and then 'g' keys.
To see what jobs are running: use the 'ps' command (type: ps for a list of jobs, including their job numbers.
To kill a process: type: kill <job number>
Proper Emergency Shutdown Procedures for Linux
If none of the above is any help and your desktop or mouse is still frozen but your keyboard still works you may be able to switch to a 'tty' by pressing 'ctrl'+'alt'+'F1' (or any 'F' key from 1 to 6.
That takes you to a black screen where you can log in at the prompt with you username and password. (Pressing 'F7' returns you to your Desktop again).

Log in at the prompt and then issue the following command, `sudo shutdown -h now', or, 'sudo reboot -i'.

Starting up...

Ubuntu 6.10 outback tty1
Password:
Last login: Mon May 7 10:46:10 2007 on :0
Linux outback 2.6.17-11-generic #2 SMP Tue Mar 13 23:32:38 UTC 2007 i686

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /urs/share/doc/*/copywrite,

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
herman@outback:~$ sudo shutdown -h now


That should shut your computer down, if it takes a while just be patient and wait a few minutes.
Your computer might need time to close all your running processes and write any cached data to disk.
Try not to ever just turn it off, that can damage your file systems. The amount of damage depends on how much data is held in memory waiting to be written to your hard disk.

If your keyboard will work, you can use the 'Raising Skinney Elephants' keyboard sequence, that trick always works.
Read this great link from 'Tips For Linux Explorers' links: Skinny Elephants ( if all else fails )

It is rare, but I have had times when I lose the use of my keyboard too, when my computer freezes. First I try unplugging it and plugging it back in again. That often works for both keyboards and mice.

Another idea some people can use if the computer is part of a network is to log in from a nearby computer on the same network and shut it down remotely. See also SSH Network.
This might work even if the frozen computer has lost the use of it's keyboard and mouse.
If the computer that is frozen has ssh server software installed and you know the IP address, users account details and password, (especially if it's your own computer), you can just ssh into it and shut it down, use the same commands already mentioned.

herman@work:~$ ssh herman@192.168.0.234
In the above  example I am logging into the frozen machine by SSH from a networked machine nearby.

herman@bookpc:~$ sudo reboot -i
I have made the connection successfully, so I am in control of the frozen computer's terminal.
I type in the command to reboot it.

The resulting feedback:  
[sudo] password for herman:

Broadcast message from herman@bookpc
    (/dev/pts/0) at 7:48 ...

The system is going down for reboot NOW!
herman@bookpc:~$ Connection to 192.168.0.234 closed by remote host.
Connection to 192.168.0.234 closed.
herman@work:~$ 
...and the frozen computer reboots.


If none of these ideas help, then sometimes you have no choice but to use the big ol'  OFF switch.
If you do, be sure to run a file system check from a Live CD or different operating system right away as soon as you can. Running a filesystem check on an ext3  filesystem.





Links About Linux Filesystems

Tips For Linux Explorers

5.10.- Linux System Administrators Guide

Filesystems - Linux System Administrators Guide

The Linux filesystem explained - FreeOS.com




Back to Top