Go Back   openSUSE Forums > New User How To/FAQ (read only) > Unreviewed How To and FAQ
Forums FAQ Members List Search Today's Posts Mark Forums Read


Unreviewed How To and FAQ POST HERE: Tips and solutions for SUSE Linux from the community. (Please do not post questions)

Reply
Page 1 of 2 1 2
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 27-Apr-2009, 23:39
caf4926's Avatar
Global Moderator
 
Join Date: Jun 2008
Location: The English Lake District. UK - GMT/BST
Posts: 12,863
caf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputation
Send a message via MSN to caf4926
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
__________________
Box: Fedora 11 | (KDE4.3.2) | M2N4-SLI | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM
Lap: openSUSE 11.2 | Celeron 550 | (KDE4.3.3)"3" | Intel 965 GM | Lenovo R61e | 3GB RAM

Last edited by caf4926; 18-Nov-2009 at 12:21. Reason: detail
Reply With Quote
  #2 (permalink)  
Old 27-Apr-2009, 23:53
ijbreakey's Avatar
Parent Penguin
 
Join Date: Jan 2009
Location: USA Pennsylvania
Posts: 995
ijbreakey has great reputationijbreakey has great reputationijbreakey has great reputationijbreakey has great reputationijbreakey has great reputationijbreakey has great reputation
Send a message via ICQ to ijbreakey Send a message via AIM to ijbreakey Send a message via Skype™ to ijbreakey
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 11.2/Windows XP | KDE 4.3.3 "3" | Intel CPU T2050 1.6 GHZ | Intel 945GM | 3.2GB RAM
Box: OpenSUSE 11.2/Windows XP | KDE 4.3.3 "3" | Intel Celeron 2.53 GHz | Intel 915G | 1.2 GB RAM
Reply With Quote
  #3 (permalink)  
Old 28-Apr-2009, 00:04
caf4926's Avatar
Global Moderator
 
Join Date: Jun 2008
Location: The English Lake District. UK - GMT/BST
Posts: 12,863
caf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputationcaf4926 has a brilliant future with this reputation
Send a message via MSN to caf4926
Default Re: FSTAB - Editing Manually

Quote:
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.
__________________
Box: Fedora 11 | (KDE4.3.2) | M2N4-SLI | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM
Lap: openSUSE 11.2 | Celeron 550 | (KDE4.3.3)"3" | Intel 965 GM | Lenovo R61e | 3GB RAM
Reply With Quote
  #4 (permalink)  
Old 28-Apr-2009, 00:29
geoffro's Avatar
Wise Penguin
 
Join Date: Mar 2008
Location: Västerås, Sweden ex. Highbury London UK
Posts: 1,288
geoffro hasn't been rated much yet
Send a message via MSN to geoffro
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
Reply With Quote
  #5 (permalink)  
Old 28-Apr-2009, 00:37
Flux Capacitor Penguin
 
Join Date: Jun 2008
Location: GMT+10
Posts: 5,218
ken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud of
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.
Reply With Quote
  #6 (permalink)  
Old 28-Apr-2009, 07:11
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,898
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
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
Reply With Quote
  #7 (permalink)  
Old 28-Apr-2009, 08:21
Wise Penguin
 
Join Date: Jun 2008
Location: United Kingdom
Posts: 1,026
consused hasn't been rated much yet
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.
Reply With Quote
  #8 (permalink)  
Old 28-Apr-2009, 08:40
Flux Capacitor Penguin
 
Join Date: Jun 2008
Location: GMT+10
Posts: 5,218
ken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud of
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.
Reply With Quote
  #9 (permalink)  
Old 28-Apr-2009, 09:09
Wise Penguin
 
Join Date: Jun 2008
Location: United Kingdom
Posts: 1,026
consused hasn't been rated much yet
Default Re: FSTAB - Editing Manually

So fstab actually stands for "fold sides to assist baking". The things you learn in this forum...
Reply With Quote
  #10 (permalink)  
Old 28-Apr-2009, 09:12
Flux Capacitor Penguin
 
Join Date: Jun 2008
Location: GMT+10
Posts: 5,218
ken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud of
Default Re: FSTAB - Editing Manually

I'd better not tell you stories about SuSE then.
Reply With Quote
Reply
Page 1 of 2 1 2

Bookmarks

Tags
fstab, ntfs, windows


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2