LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 11-25-2007, 11:53 AM   #1
9nine9
Member
 
Registered: Nov 2001
Distribution: Debian, Fedora, Kubuntu, Puppy
Posts: 166

Rep: Reputation: 30
Which editor for fstab?


I installed Fedora 8 from a Live CD so it doesn't look like I have too many editors. Kate and KEdit.

Can I edit etc/fstab with either of these editors without worrying about them inserting characters I don't want?

And do the columns have to be lined up perfectly in fstab?

Do you separate each column with a tab, a space or what?

What I'm trying to do is make mount entries for my floppy drive and my CDROM. Neither of these entries was created during my installation.
 
Old 11-25-2007, 12:12 PM   #2
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
Post

Quote:
Originally Posted by 9nine9 View Post
I installed Fedora 8 from a Live CD so it doesn't look like I have too many editors. Kate and KEdit.

Can I edit etc/fstab with either of these editors without worrying about them inserting characters I don't want?

And do the columns have to be lined up perfectly in fstab?

Do you separate each column with a tab, a space or what?

What I'm trying to do is make mount entries for my floppy drive and my CDROM. Neither of these entries was created during my installation.
You can use 'vi' or I personally like 'vim' I had never used vim editor before I went to take my RHCT course in November of this year and PASSED!

I would try using 'vim' because it highlights the text color and you can find typo errors easier than just plain vi.

If vim is not installed yum install vim and it will find all of the dependencies for you.

The fstab was a difficult subject for me to, the spacing does not have to be perfect for example lets say if you wanted to use fdisk to create a new entry for /data. Remember you have to 'as root or sudo' mkdir /data in order for the ability to mount the actual partition on the system.

[scottg@DELLF8 ~]$ sudo vim /etc/fstab
then you can use the keyboard keys or arrows to go to the last line and type a 'o' alphabet and it will start you on a new line.

The columns do not have to line up perfectly it is more of a nicer way to view it, so if a column is not perfectly in line with the one above or vise versa it will not affect the system. Remember to try mounting this after you save your changes always or you may get into a machine that will not boot up.

mount /data (like the example I used about mounted the test /data partion I created that was 100M in size)...

[scottg@DELLF8 ~]$ sudo cat /etc/fstab
LABEL=/1 / ext3 defaults 1 1
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
LABEL=/home /home ext3 defaults 1 2
LABEL=/usr1 /usr ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda8 swap swap defaults 0 0
LABEL=/data /data ext3 defaults 0 0
[scottg@DELLF8 ~]$


The formatting is more for neatness just use tab and try to get it close to the original but it will not be affect it ability to mount the cd or a new parition/logical volume.

Also by the way you can sudo yum -y install autofs (it is the automounter and it i will automount cd's or other items as a NFS or anything else you can add to the /etc/fstab...

Hope this helps.
 
Old 11-25-2007, 12:22 PM   #3
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
/etc/fstab

Try mounting the new entry in fstab while the machine is running, also you can do a 'mount -a' to mount everything in the /etc/fstab but it is the safest to just sudo mount /new-entry you created so if you have a problem you can modify what you changed.
 
Old 11-25-2007, 12:28 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by rhbegin View Post
Try mounting the new entry in fstab while the machine is running, also you can do a 'mount -a' to mount everything in the /etc/fstab but it is the safest to just sudo mount /new-entry you created so if you have a problem you can modify what you changed.
OP wants to know what editor to use to edit fstab.

Answer: any text editor--not a word processor.

kate, kedit, gedit, nano, vim, emacs,....etc. etc. etc.
 
Old 11-25-2007, 02:28 PM   #5
9nine9
Member
 
Registered: Nov 2001
Distribution: Debian, Fedora, Kubuntu, Puppy
Posts: 166

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by pixellany View Post
Answer: any text editor--not a word processor.

kate, kedit, gedit, nano, vim, emacs,....etc. etc. etc.
The other answers were helpful but vim didn't even come with this distro and I really did need the simple answer. Thanks.

Also, thanks to whoever gave the tip to try out the new entry before I reboot to be sure everything is working ok.
 
Old 11-25-2007, 02:36 PM   #6
9nine9
Member
 
Registered: Nov 2001
Distribution: Debian, Fedora, Kubuntu, Puppy
Posts: 166

Original Poster
Rep: Reputation: 30
etc/fstab

Quote:
Originally Posted by pixellany View Post
any text editor
Does there have to be a new blank line at the end of fstab?

In other words, do I need to hit the Enter key after making an entry or does that matter?
 
Old 11-25-2007, 03:57 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by 9nine9 View Post
Does there have to be a new blank line at the end of fstab?

In other words, do I need to hit the Enter key after making an entry or does that matter?
I'm pretty sure it does not matter. (But you do need a newline (return) between entries). When you open the existing file in an editor the format is fairly obvious.
 
Old 11-25-2007, 05:55 PM   #8
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
Quote:
Originally Posted by pixellany View Post
I'm pretty sure it does not matter. (But you do need a newline (return) between entries). When you open the existing file in an editor the format is fairly obvious.
If you are adding a new entry (it will not affect it either way), I would do it at the bottom for ease of readability.

Just be sure to make the correct syntax so it will mount correctly.
 
Old 11-25-2007, 10:28 PM   #9
SilentSam
Member
 
Registered: Aug 2007
Location: Ottawa
Distribution: Arch Linux/Kubuntu/OpenSUSE
Posts: 300

Rep: Reputation: 37
Quote:
Originally Posted by 9nine9 View Post
Does there have to be a new blank line at the end of fstab?

In other words, do I need to hit the Enter key after making an entry or does that matter?
No there doesn't. fstab is very relaxed with regards to spacing. There just needs to be a newline for each entry, and at least a space between columns.

Edit: I find nano the easiest to edit from a terminal, and kwrite is good if you need to copy text from another file.

Last edited by SilentSam; 11-25-2007 at 10:29 PM.
 
Old 11-26-2007, 01:28 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Given that vi has been the default editor on Unix for yrs and is often symlinked to vim these days, I'd be surprised if it wasn't there. Usually is on RH anything.
 
Old 11-26-2007, 03:46 AM   #11
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
Quote:
Originally Posted by chrism01 View Post
Given that vi has been the default editor on Unix for yrs and is often symlinked to vim these days, I'd be surprised if it wasn't there. Usually is on RH anything.
In Red Hat RHEL5.1 Server/WorkStation it depends on the install that is performed. I installed Fedora8 on several machines using the 'LiveCD' and it does not install vim you have to yum install vim and it gets a few other packages.

I had never copied a 'livecd' to disk before and it turns out it is stripped down but you can customize your install leaving out a lot of unneeded items and get the latest packages without having to download 500M worth of updates.

scott
 
Old 11-26-2007, 02:32 PM   #12
9nine9
Member
 
Registered: Nov 2001
Distribution: Debian, Fedora, Kubuntu, Puppy
Posts: 166

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by SilentSam View Post
Edit: I find nano the easiest to edit from a terminal, and kwrite is good if you need to copy text from another file.
Ok, let me get this straight. Since I need to be root to edit fstab, is this what I would need to do from a terminal if I used nano (or some other editor)?

Code:
#su
Password:
nano /etc/fstab
 
Old 11-26-2007, 02:34 PM   #13
9nine9
Member
 
Registered: Nov 2001
Distribution: Debian, Fedora, Kubuntu, Puppy
Posts: 166

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by chrism01 View Post
Given that vi has been the default editor on Unix for yrs and is often symlinked to vim these days, I'd be surprised if it wasn't there. Usually is on RH anything.
The thing is, I installed Fedora from a Live CD, which doesn't include all the stuff that comes with a full distribution.

It's not on my Editors menu. All I see there are Kwrite, KEdit and Kate.
 
Old 11-26-2007, 02:56 PM   #14
SilentSam
Member
 
Registered: Aug 2007
Location: Ottawa
Distribution: Arch Linux/Kubuntu/OpenSUSE
Posts: 300

Rep: Reputation: 37
vi won't be in the menu. It's a terminal editor. Same with anything that is strictly run from the CLI.
 
Old 11-26-2007, 03:09 PM   #15
9nine9
Member
 
Registered: Nov 2001
Distribution: Debian, Fedora, Kubuntu, Puppy
Posts: 166

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by rhbegin View Post
I installed Fedora8 on several machines using the 'LiveCD' and it does not install vim
Yep, I think that's correct.

They probably figure that since vi(m) is such an advanced editor that if people want it, they can go get it after installing the Live CD.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Suse won't boot after fstab changes - fstab not editable baking-a-77 Linux - Newbie 10 06-02-2007 10:51 AM
fstab problem: mount: can't find dvd in /etc/fstab or /etc/mtab Nikon01 Slackware 5 11-17-2006 06:15 AM
newbie vs fstab. fstab wins :( blop Linux - Newbie 3 01-07-2005 05:54 AM
(version 5.1 chapter 08 fstab) vs (man fstab) rgiggs Linux From Scratch 2 06-03-2004 05:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 05:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration