Filesystems and Mounting

Edited Saturday, August 09 2008

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

Click-Icon Mounting  -  The new easy way to mount file systems in Hardy Heron 

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

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

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

Mounting an .iso file

Mount a floppy disk

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 

Filesystems and filesystem checking

Automatic filesystem checks on bootup

'Forcing' (an early) filesystem check

How to look at the log of your boot-up file system check

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

Running a filesystem check with GParted  a user freindly GUI method

Running a filesystem check on an ext3  filesystem - from a Live CD - command line

Running a check for bad blocks on your hard disk

What to do if you have a bad ext3 superblock

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

How to take a look at your ext3 superblock

Recovering files from lost+found - with advice from confused57

Running a filesystem check on a reiserfs filesystem

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 and FAT32 file system repair and maintenance - Windows CHDSK - Linux ntfsfix

Restore an NTFS boot sector with it's backup 

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


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



Click-Icon Mounting

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

The easy new way to mount a file system in Ubuntu Hardy Heron 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 or ext3 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 the Hardy Heron live CD.
If you're working in a hard disk installed Hardy Heron, you will be asked for your password.
Once the partition is open you can do what you like, (read/write, copy/paste) subject to file ownership and permissions rules.
If it's just a data partition and it belongs to you, you should be able to do whatever you like with the files in it.
If it contains an operating system, you can access your own data files with it, in your /home/username directory. You can easily make a backup or restore all your own files.
That's about all most people probably need to know.

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





Using e2label to set a filesystem label an ext3 filesystem
Here's a really cool customization that'll make your day-to-day computing chores easier and more fun!

Set labels for your ex2 or ext3 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 or ext3 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 and ext3 file systems can be labeled as easily as that and having them labeled is very convenient if you have several ext2 or ext3 partitions in your hard disk(s) and USB flash memory sticks.
I have a multiple boot computer so I have one hard disk containing one big partition called 'DATA' and another called 'BACKUPS'. My operating system partitions are labeled 'FEISTY', 'GUTSY', 'HARDY', 'DEBIAN' and 'OpenSUSE'.

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.




Filesystem Mounting Basics

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 and used to record the location of a real feature or object on the ground.
A hard disk is similarly divided up, but a hard disk is divided into cylinders, tracks, blocks and sectors. Data is stored in sectors. One sector can hold up to 512 bytes of data.

It is possible to use 'dd' commands to write data to a hard disk without having any file system, but we would need to be able to remember exactly what the sector numbers were where we stored certain files or 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 slow and manual way of doing things.
We'd probably need a filing cabinet to store all the paperwork.
Why not make the computer do the work for us?

Well that's pretty much what happens. The kind of file system I'm talking about is basically just a set of rules an operating system's kernel uses for writing files to a disk and automatically recording where it left them so they can be automatically found again.
To remember exactly where all our files are stored, there are special sectors that the operating system's kernel writes to for recording data about where the files were left. These special sectors contain data about data, so they are called 'metadata' blocks. (A 'block' is usually two sectors).
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. If you want to learn more, here is a good place to start, Understanding UNIX / Linux file system - Nixcraft

Linux operating systems can work with many different kinds of file systems, FAT16, FAT32, NTFS, ext2, ext3, reiserfs and jfs, xfs and so on.

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.

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'. A new Window will open titled 'root - File Browser'.

4) Click the Up arrow to go to the top of the file system tree.

5) Open the /media directory.
You'll see any mounted file systems in there as directories. (Mount points).
If your file system has a label, the mount point directory will have it's own name.
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 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 you 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