| 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. ![]() 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. ![]() 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. ![]() 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,
As you can see, my usbdisk is called '/dev/sde1', by the Linux kernel. I need to use that for the next command.
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. |
| 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,
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
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:
A different command you can use is 'blkid'. The 'blkid' command is slightly more informative. Code:
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:
Example:
If there isn't one use the mkdir command to make a new directory in /media as your mount point
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
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
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
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
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
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:
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.
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:
=================================================== 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:
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:
5) Mount your disabled Ubuntu operating system in the Live CD, Code:
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 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:
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.
/etc/X11/xorg.conf
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/*
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.
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.
Here is some general information about what commands or info goes in each column in /etc/fstab and what it is supposed to mean.
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:
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:
I'll need this because I'm going to copy some of these UUID numbers into my /ect/fstab file soon.
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:
Example:
(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:
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:
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:
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:
Here is the line for mounting my reiserf data partition which is my number 9 partition on hard disk, or /dev/sda9,
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
|
|
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:
To get the partitions to mount now we just have to enter this command in terminal,
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,
If that one doesn't work, try this one,
Example output:
Open your /etc/fstab file with this command,
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.
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 |