Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: FSTAB - Editing Manually

  1. #1
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    37,109
    Blog Entries
    16

    Post FSTAB - Editing Manually

    FSTAB and all That?!


    The purpose of this documentation is just to provide a little insight into manually editing /etc/fstab. It is not a comprehensive document and it is intend to address the issue with the help of screenshots/pictures. Fstab requires you have root privileges to edit it. CAUTION – NOT TO BE UNDERTAKEN LIGHTLY. Editing is possible by opening a terminal and doing:
    In KDE: kdesu kwrite /etc/fstab
    In Gnome: gnomesu gedit /etc/fstab

    You can also use super user file managers as available with kde. And the yast partitioner also can be used.


    /etc/fstab is the location of a config file which controls mount information for drives/partitions and is used as your system boots. Your Linux file system (swap, / and /home) will automatically be added in here during installation and it's unlikely you will need to alter the defaults used there. However, it's possible you may need to edit this file to either add partitions not already included from the initial installation OR to edit the detail of a particular entry. In this document we will look at.



    1. An existing entry for a Vista partition.
    2. The Mount Point
    3. Commenting Out
    4. Manually adding an entry



    1. Here is an example of a typical fstab file:
    ImageBam - Fast, Free Image Hosting and Photo Sharing
    It shows a highlighted entry of a Vista partition added during installation but it has been modified for read/write access. Originally it would have looked a little like the entry above it but now it is simplified with “defaults 0 0”. We'll cover that later.
    Notice the mount point ( /Vista ).
    The line above shows ( /STORE ). ImageBam - Fast, Free Image Hosting and Photo Sharing Both these entries were created during installation by setting the mount points of the partitions in the Custom Partitioner.

    2. A mount Point as mentioned in point 1 is a folder in the Linux Installation file system tree. Here is a screen of a typical tree. I have highlighted the two points we have refered to already /Vista and /STORE

    Therefore, if you fail to add/mount a partition, such as a windows installation, during the initial installation of Linux, you will need to manually add an entry to fstab – But you must provide a mount point. If I hadn't added Vista during installation, no folder of that name would exist and if I wanted to mount the Vista partition to that location, I would have to create the folder /Vista first.


    3. A mention of 'Commenting Out'. The process of placing a # at the start of a configuration line. Is considered a better practice than say deleting the entire line, as commenting out preserves the text for future reference but disables the configuration line. Here is an example:
    ImageBam - Fast, Free Image Hosting and Photo Sharing
    After reboot, with these lines commented out, the partitions Vista and STORE would no longer be available.


    4. Manually adding an entry to fstab. Let's say we fail to set this up during installation, how can we do it later? Well first you need the 'Mount Point'. You can create this. In my examples the folders Vista and STORE are directly on /
    ( A note However, even if you fail to set up mount points for partitions, usually the installer will automatically pick up other partitions such as XP or Vista and add an entry in fstab but use a mount point like: /media/windows_c – In this case, all that would be required is to edit the entry in fstab to give 'read' or 'read/write' permissions)
    If nothing exists just create a folder with the name you require in whatever location you desire. You may need to do this with root permissions.
    Let's assume though that nothing exists. How do you know what to add? Well let's find the Vista partition in my installation. We need to open a terminal, type su and then the root password to have root privileges. And then type: fdisk -l



    Here you see the output. I highlighted the first line sda1 which is the Vista installation. Now to add that to fstab.

    This assumes we had no entry for Vista and are adding it from the fdisk output. Notice the method of using /dev/sda1


    You can find more information here: HowTo Mount NTFS Filesystem Partition Read Write Access in openSUSE 10, 11
    @swerdna provides a valuable source of information not just on this subject but whole range of topics. You can go to his homepage from the link above.



    • You should exercise extreme caution when giving access to NTFS partitions of windows installations. The best policy is to only provide 'read' access and NOT 'write'. My example using 'defaults 0 0' gives read/write access.



    Lastly – You must leave an empty line at the end of fstab:
    ImageBam - Fast, Free Image Hosting and Photo Sharing


    Other sources of information:
    NTFS - openSUSE


    Access Your Windows Files - openSUSE
    Last edited by caf4926; 18-Nov-2009 at 11:21. Reason: detail
    My openSUSE 13.1 KDE Box
    My Articles
    Was I any help? If yes: Click the star below

  2. #2
    Join Date
    Jan 2009
    Location
    USA Pennsylvania
    Posts
    1,321

    Default Re: FSTAB - Editing Manually

    This is a very comprehensive tutorial that I think many will find as an easy step-by-step solution to a lot of problems. Also the links you provide contain a lot of useful information as well.

    Excellent work!

    I have a question though. What's the significance of leaving an empty line at the end of fstab?

    Ian
    Laptop: Dell Inspiron E1505 | OpenSUSE 12.1/Windows Vista | KDE | Intel CPU T2050 1.6 GHz | Intel 945GM | 3.2GB RAM
    Box: OpenSUSE 12.1/Windows 7 | KDE | Intel Core 2 Quad 8300 2.5GHz/core | nVidia Geforce 9500GT 1GB| 4 GB RAM

  3. #3
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    37,109
    Blog Entries
    16

    Default Re: FSTAB - Editing Manually

    I have a question though. What's the significance of leaving an empty line at the end of fstab?
    Hopefully someone more knowledgeable than me will be able to answer that.
    My openSUSE 13.1 KDE Box
    My Articles
    Was I any help? If yes: Click the star below

  4. #4
    Join Date
    Mar 2008
    Location
    Vsters, Sweden ex. Highbury London UK
    Posts
    1,282

    Default Re: FSTAB - Editing Manually

    AFAIK it is to indicate that there are no more entries.
    Found a good fstab guide here How to edit and understand /etc/fstab

    Geoff
    Quote Originally Posted by caf4926 View Post
    Hopefully someone more knowledgeable than me will be able to answer that.
    Core 2 Duo 3.16GHz, 8GB DDR2, 3.5TB, GeForce 9600 GT, Amilo LCD 26", OS 11.1 x86_64, KDE4.2.4 (2)
    My wine tips & tricks

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: FSTAB - Editing Manually

    Quote Originally Posted by ijbreakey View Post
    I have a question though. What's the significance of leaving an empty line at the end of fstab?
    I think this protection against broken editors (both software and human) not ending the last line with the newline character and that line getting ignored by the utilities: typical message when editing with vim, no EOL at end. By putting in a blank line, it doesn't matter if the last line is not terminated by newline.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    16,098

    Default Re: FSTAB - Editing Manually

    I manage five systems here. None of them has an empty line at the end of /etc/fstab. Some of them were generated at installation, some of them were changed by YaST later, some of them edited using vi. When even installation does not add an empty line I think there is no reason whatsoever to promote this behaviour as a sort of black magic

    As ken_yap posts, the only reason may be that there is no CR at the end of the last characters. But you do not add a new line then, you just add the CR (and may be two, which will give you an empty line).

    In any case, when this phenomenon of not having a CR at the end of a text file would happen often, much more tools would be affected by this.
    Henk van Velden

  7. #7
    Join Date
    Jun 2008
    Location
    UK
    Posts
    5,335

    Default Re: FSTAB - Editing Manually

    I multiboot (x6) and have had errors/warnings in the past caused by missing the blank line. Maybe it's no longer an issue, but until the distros say that, I take the precaution of leaving one there after any edit. Better safe than sorry, for newbies anyway.

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: FSTAB - Editing Manually

    I've never had to insert blank lines at the end of fstab but then I use an editor that terminates all lines. I believe it is possible in an editor like emacs to leave out the final newline because emacs just treats the file as a bunch of bytes. Maybe nano too. So there is a bit of cargo-cult mentality here, but the alternative is to educate all users which might be a bigger job than stating a rule that works. Then again, after a while the original reason for the rule is forgotten.

    Bit like the story about the family that always prepared a certain food by folding it over before baking. When the mother was asked, she said, it must be our people's tradition, I've always seen grandma do it that way. When grandma was asked she said, oh it's just because I didn't have a baking tray large enough when I first made this dish so I folded it.

  9. #9
    Join Date
    Jun 2008
    Location
    UK
    Posts
    5,335

    Default Re: FSTAB - Editing Manually

    So fstab actually stands for "fold sides to assist baking". The things you learn in this forum...

  10. #10
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: FSTAB - Editing Manually

    I'd better not tell you stories about SuSE then.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •