Archive

Articles taggués ‘fstab’

How to edit and understand /etc/fstab

28/01/2014 Comments off

Source: How to edit and understand /etc/fstab

There’s a file called /etc/fstab in your Linux system. Learn what its contents mean and how it’s used in conjunction with the mount command. When you learn to understand the fstab file, you’ll be able to edit its contents yourself, too.

In this tuXfile I assume you already know how to mount filesystems and partitions with the mount command. If you don’t, I suggest reading the Mounting tuXfile before reading this one.

Author: Nana Långstedt < nana.langstedt at gmail.com >
tuXfile created: 12 October 2003
Last updated: 5 September 2009

What is fstab and why it’s useful

fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The file is located under /etc, so the full path to this file is /etc/fstab.

/etc/fstab contains information of where your partitions and storage devices should be mounted and how. If you can’t access your Windows partition from Linux, aren’t able to mount your CD or write to your floppy as a normal user, or have problems with your CD-RW, you probably have a misconfigured /etc/fstab file. So, you can usually fix your mounting problems by editing yourfstab file.

/etc/fstab is just a plain text file, so you can open and edit it with any text editor you’re familiar with. However, note that you must have the root privileges before editing fstab. So, in order to edit the file, you must either log in as root or use the su command to become root.

Overview of the file

Of course everybody has a bit different /etc/fstab file because the partitions, devices and their properties are different on different systems. But the basic structure of fstab is always the same. Here’s an example of the contents of /etc/fstab:

/dev/hda2 / ext2 defaults 1 1
/dev/hdb1 /home ext2 defaults 1 2
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0
/dev/fd0 /media/floppy auto rw,noauto,user,sync 0 0
proc /proc proc defaults 0 0
/dev/hda1 swap swap pri=42 0 0

What does all this gibberish mean? As you see, every line (or row) contains the information of one device or partition. The first column contains the device name, the second one its mount point, third its filesystem type, fourth the mount options, fifth (a number) dump options, and sixth (another number) filesystem check options. Let’s take a closer look at this stuff.

1st and 2nd columns: Device and default mount point

The first and second columns should be pretty straightforward. They tell the mount command exactly the same things that you tell mount when you mount stuff manually: what is the device or partition, and what is the mount point. The mount point specified for a device in /etc/fstab is its default mount point. That is the directory where the device will be mounted if you don’t specify any other mount point when mounting the device.

Like you already learned from the Mounting tuXfile, most Linux distros create special directories for mount points. Most distros create them under /mnt, but some (at least SuSE) under /media. As you probably noticed when looking at the example fstab, I use SuSE’s mount points as an example.

What does all this mean? If I type the following command:

$ mount /dev/fd0… my floppy will be mounted in /media/floppy, because that’s the default mount point specified in /etc/fstab. If there is no entry for /dev/fd0 in my fstab when I issue the command above,mount gets very confused because it doesn’t know where to mount the floppy.

You can freely change the default mount points listed in /etc/fstab if you’re not satisfied with the defaults your distro has given you. Just make sure the mount point is a directory that already exists on your system. If it doesn’t, simply create it.

Some partitions and devices are also automatically mounted when your Linux system boots up. For example, have a look at the example fstab above. There are lines that look like this:

/dev/hda2 / ext2 defaults 1 1
/dev/hdb1 /home ext2 defaults 1 2

As you’ve learned, these lines mean that /dev/hda2 will be mounted to / and /dev/hdb1 to /home. This is done automatically when your Linux system boots up… if it wouldn’t, you’d have a hard time using your cool Linux system because all the programs you use are in / and you wouldn’t be able to run them if / wasn’t mounted! But how does the system know where you want to mount/dev/hda2 and /dev/hdb1? By looking at the /etc/fstab file of course.

Lire la suite…

Categories: Système Tags: , ,

How to mount ext2/ext3 Linux Volumes in Mac OS X (Snow Leopard) with Read/Write access

28/01/2014 Comments off

Source: The WireFrame

I was actually surprised to find out that there is no native support for popular ext2/ext3 Linux Volumes in mac OS X. So if you are like me and have ext2/ext3 drives lying around and want to access them using OS X then here is a compact guide to sort things out in Snow Leopard.

1. Install MacFUSE

If you haven’t already installed it download and install MacFUSE from http://code.google.com/p/macfuse/downloads/list.

2. Install FUSE – Ext2

Once you have MacFUSE download and install fuse-ext2 from http://sourceforge.net/projects/fuse-ext2/. Even though it says fuse-ext2, this one package gives both ext2 and ext3 read-write support.

After installation you should see both MacFUSE and fuse-ext2 icons in System Preferences.

 

fuse_ext2

That’s it. You now have support for ext2 and ext3 file systems. When you plug in an external ext2/ext3 partition it should automatically show up in Finder, mounted and ready to use. You can also use the following commands if you prefer the shell.

$ fuse-ext2 <device|image> <mountpoint> [-o option[,...]] $ mount -t fuse-ext2 <device|image> <mountpoint>

 

Note: If auto-mount is not giving you read/write access to ext2/ext3 partitions then you will have to edit the auto-mount script for fuse-ext2 which can be found at /System/Library/Filesystems/fuse-ext2.fs/fuse-ext2.util.

$ sudo nano -c /System/Library/Filesystems/fuse-ext2.fs/fuse-ext2.util

Around line 207 (in function Mount ()) you will find the line OPTIONS="auto_xattr,defer_permissions". Change that line to read asOPTIONS="auto_xattr,defer_permissions,rw+".

...
function Mount ()
{
LogDebug "[Mount] Entering function Mount..."
# Setting both defer_auth and defer_permissions. The option was renamed
# starting with MacFUSE 1.0.0, and there seems to be no backward
# compatibility on the options.
# OPTIONS="auto_xattr,defer_permissions"
OPTIONS="auto_xattr,defer_permissions,rw+"
# The local option is only enabled on Leopard. It causes strange


Categories: Système Tags: , ,