Linux File Systems

Rob

Administrator
Staff member
Joined
Oct 27, 2011
Messages
1,210
Reaction score
2,240
Credits
3,485
This is a beginner's course and one of the concepts that newcomers to Linux find different is the idea of a file system in Linux. That is to say, the way data is stored and managed in Linux. Most users are familiar with Files. In the simplest terms possible, one can say that files are just a collection of data items which are stored on a disk. However, the way that those files are stored on a disk can vary depending on several different factors. Speed, security, data redundancy etc...

Linux Supports lots of different types of File System formats. Here are just a few...

Ext2: This is like UNIX file system. It has the concepts of blocks, inodes and directories.

Ext3: It is backwards compatible with the ext2 file system, except that it has added journal ing capabilities. Journalling allows fast file system recovery. Includes support for Access Control Lists (ACL).

Isofs: Used by CDROM file system (iso9660).

Procfs: The proc file system acts as an interface to internal data structures in the kernel. It can be used to obtain information about the system and to change certain kernel parameters at runtime using sysctl command.

Mounting file systems

In this part of the lesson about file systems we'll learn how to use the commands mount and umount

We've mentioned previously that there's a different idea in Linux as to what constitutes a floppy disk drive, a CD-ROM drive and another partition of your hard disk (the Windows partition, for example). Though some windows managers for Linux have provisions for clicking on an icon to access a floppy drive, for example, the method behind this is quite different from other OSes. In Linux the floppy drive or other device must be "mounted". That means basically, incorporating it temporarily into your Linux file system or, in other words, telling Linux that it is a file to be written to or copied from.

You can use the mount command to copy to and from other devices.

If you would like to get some files from a CD-ROM, the standard command to do this is:

Code:
mount -t iso9660 /dev/hdb /cdrom

The type, iso9660 is the standard file system for a CD. The device (/dev/hdb) is the non-SCSI type of CD-ROM and the mount point (/cdrom) should exist. If it doesn't, you should create it in the root directory with 'mkdir', just as you may have done with the /floppy directory.

Remember that the concept of CD-ROM is read only. You won't be able to write to this type of CD-ROM drive. A message will tell you that when you mount this type of device.

Mounting another partition of the hard disk.

Many people may have preferred to install Linux along with another operating system. You may have Linux and Windows installed in the same computer. If you would like to access files on the Windows partition you would type the following command:

Code:
mount -t vfat /dev/hda1 /mnt

Windows is always in the primary partition, so that's why we've used the device /hda1 (hard disk partition 1). The choice for /mnt is the standard mount point in this case. You may use the /mnt directory to mount the other devices (floppies, CDs) as well. I use the different empty directories (/floppy /cdrom /mnt) to avoid confusion.

If you change to the mount directory (cd /mnt) and then type: ls and you'll see something interesting. The directories are blue but the files are green (or red - depending on your distribution of Linux). You won't have the various color combinations as you do in Linux. That's because Windows' file system doesn't distinguish file types. Everything looks like it's a program (binary) instead of a regular file.

When you copy files from the Windows partition to the Linux partition you should bear this in mind. For example, if you wanted to copy an mp3 file from the Windows partition to the Linux partition to test out your sound configuration, it would show up as a executable program and not just a standard file under Linux. This doesn't effect your playing it, but for a more accurate accounting of what you have on your system, you may want to change the permissions of the file so that it shows up as a regular file in your color scheme. We'll talk about file permissions and and making changes to them shortly.

Unmounting

Mounting file systems that aren't part of the standard Linux system is considered a temporary condition in Linux. Now that we know how to mount these outside file systems in Linux, the important thing now is to learn how to unmount it when we're finished using it.

In the early days of Linux, you could do serious damage to your system if you didn't unmount manually after you were finished. Nowadays if you have mounted a system and you shut down the computer without unmounting, the chances are pretty slim that you're going to trash a file system. Slim, however, isn't good enough for me. I'd rather not take a chance. I always take the time to unmount these external file systems when I'm finished with them.

The command for this is:

Code:
umount [/mount point]

In the examples I used in this lesson, the mount points were:

Code:
floppy:        /floppy    - therefore umount /floppy
CD:            /cdrom        - umount /cdrom
Windows partition            - umount /mnt

Remember also to NOT be accessing the disk. when you use umount or it will give you a drive busymessage. If you get this, you may have left a terminal open where you were using to copy or write to the particular drive. Check your terminals if you get this error.

I just wanted to point out another thing too. You are 'unmounting' but the command is umount (that is, without theN of un) Being u(n)familiar with the mount concept when I started with Linux, I typed unmount instead of umountand much to my surprise, I got the message: command not found. U(n)deniably, I had done something wrong. It took me a while to figure out that the command didn't include an N. I haven't really done a survey on how many people have actually done this. For all I know, I may be the only person who has, but I just thought it best to warn you.

Well, now you can use the standard devices that most PC users need. Later in our advanced class we'll talk about installing and using other devices like scanners, CD writers, Zip drives and matter/anti-matter flow inducers. (well, maybe we'll save that last one for the super-advanced classes!)
 


Dear Robert,

Sorry if I come accross exasparated. I just installed Ubuntu and just can not do thing I could in Windows.

Like copying my data files to Ubuntu. Now I find I need a code to mount and unmount. It sounds like the 1980's.

1.
Where do I enter that code on the UBUNTU desktop?

2.
What are the codes for USB stick and for External hard drive?

3.
Do I mount onece a day, or every time I want to copy a file externally?

4.
Where will I get your reply? Best for me would be E-Mail [removed by moderator for privacy]

J. Richner
 
4.
Where will I get your reply?

Hi @Richner, and welcome to the forums. Rather than add to this thread (which is an educational "tutorial")... please open a new thread in either the General Linux or Getting Started forum and ask your questions again there. Having your own thread helps to focus exactly on your problems. Use a title/subject so that people will easily recognize the issue, such as "Problem copying files in Ubuntu" or something like that. I will be glad to help you, and I'm sure others will also join in and help too.

Cheers
 
Dear @Richner Welcome
Is not exactly as it shows.
I'm not the most suitable person to explain but I use Linux Mint and mount command it was a very rare necessity.
Umount of course is necessary as a preventing action.
What I want to say is that Linux Mint is so modern as Windows and not stuck on '80s.
 
However, the way that those files are stored on a disk can vary depending on several different factors. Speed, security, data redundancy etc...

Didn't get this part? How come speed & data redundancy be affected by storing location? I believe I'll learn that later after reading more tutorials.

Remember also to NOT be accessing the disk. when you use umount or it will give you a drive busymessage. If you get this, you may have left a terminal open where you were using to copy or write to the particular drive. Check your terminals if you get this error.

I just wanted to point out another thing too. You are 'unmounting' but the command is umount (that is, without theN of un) Being u(n)familiar with the mount concept when I started with Linux, I typed unmount instead of umountand much to my surprise, I got the message: command not found. U(n)deniably, I had done something wrong. It took me a while to figure out that the command didn't include an N. I haven't really done a survey on how many people have actually done this. For all I know, I may be the only person who has, but I just thought it best to warn you.

Thanks for this beginner Warning. I might have done the same mistake and might have pressed blue lit Power button on my laptop after screaming hard on linux! That 'n' is horrible.

Rest of the article is easily understandable !!
Thanks for the article.
 
Last edited:


Top