5 - Editing /etc/fstab
If you've never edited /etc/fstab before, there's not much to
it. Let's take a look at it first. Use cat:
[ddipaolo@half-life ddipaolo]$ cat /etc/fstab
/dev/hdb8 / ext2 defaults 1 1
/dev/hda1 /dos/C auto defaults 0
0
/dev/hda5 /dos/D auto defaults 0
0
/dev/hda6 /dos/E auto defaults 0
0
/dev/hdb5 /home ext2 defaults 1
2
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0
0
/dev/hdb7 /tmp ext2 defaults 1
2
/dev/hdb11 /usr ext2 defaults 1
2
/dev/hdb12 /usr/local ext2 defaults 1
2
/dev/hdb6 /var ext2 defaults 1
2
/dev/hdb2 swap swap defaults 0
0
/dev/fd0 /mnt/floppy ext2 noauto,owner 0
0
none /proc proc defaults 0
0
none /dev/pts devpts gid=5,mode=620 0
0
Looks kinda hairy, huh? Well, it's not too bad, really. Just
notice that a lot of the things are the same from column to
column. Basically, you've got these five (well, six) columns:
Partition - this first one describes what partition is being
mounted (or is to be mounted at boot, more precisely)
Mount point - this shows where on the Linux filesystem this
partition will be mounted
Filesystem type - specifies what filesystem has been created
on that partition or 'auto' to use auto-detection
Options - I've had no use to use anything but defaults, though
I've heard of people having issues writing to their mounted
Windows partitions as normal users when using "defaults" for
their options. I simply never write to my Windows partition
except as root, and defaults works fine.
Dumps/Fscks (last two columns) - This has to do with filesystem
dumps, fscks, and priorities. For the most part, you can just use the
values "1 2" and you'll be fine.
So, like I said, nothing to it. It's basically a cut and
paste job. So, to put our new partition with filesystem at
/usr/src, let's run down what should go in each column:
Partition - /dev/hdb14 (in my case)
Mount point - /usr/src (again, my case)
Filesystem - ext2
Options - defaults
Dumps - 1 2
So, if you string them all together you get:
/dev/hdb14 /usr/src ext2 defaults 1 2
Heck you don't even have to use a text editor to add this one.
You can use echo:
echo "/dev/hdb14 /usr/src ext2 defaults 1 2" >> /etc/fstab
Make sure you use >> and not > though. Otherwise you are in
serious trouble unless you made a backup.
Now, you know how to do this when you have space to make the
partition. Let's look at what's different for when you
DON'T have the space to make the partition you want.
[- next page: don't have 1GB free -]
Would you like to have your article published online? Send them in to newfiles@linuxnewbie.org