LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Which editor for fstab? (https://www.linuxquestions.org/questions/fedora-35/which-editor-for-fstab-602268/)

9nine9 11-25-2007 11:53 AM

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.

rhbegin 11-25-2007 12:12 PM

Quote:

Originally Posted by 9nine9 (Post 2970270)
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.

rhbegin 11-25-2007 12:22 PM

/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.

pixellany 11-25-2007 12:28 PM

Quote:

Originally Posted by rhbegin (Post 2970294)
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.

9nine9 11-25-2007 02:28 PM

Quote:

Originally Posted by pixellany (Post 2970302)
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.

9nine9 11-25-2007 02:36 PM

etc/fstab
 
Quote:

Originally Posted by pixellany (Post 2970302)
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?

pixellany 11-25-2007 03:57 PM

Quote:

Originally Posted by 9nine9 (Post 2970372)
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.

rhbegin 11-25-2007 05:55 PM

Quote:

Originally Posted by pixellany (Post 2970423)
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.

SilentSam 11-25-2007 10:28 PM

Quote:

Originally Posted by 9nine9 (Post 2970372)
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.

chrism01 11-26-2007 01:28 AM

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.

rhbegin 11-26-2007 03:46 AM

Quote:

Originally Posted by chrism01 (Post 2970807)
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

9nine9 11-26-2007 02:32 PM

Quote:

Originally Posted by SilentSam (Post 2970680)
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


9nine9 11-26-2007 02:34 PM

Quote:

Originally Posted by chrism01 (Post 2970807)
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.

SilentSam 11-26-2007 02:56 PM

vi won't be in the menu. It's a terminal editor. Same with anything that is strictly run from the CLI.

9nine9 11-26-2007 03:09 PM

Quote:

Originally Posted by rhbegin (Post 2970910)
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.


All times are GMT -5. The time now is 05:44 PM.