Click to See Complete Forum and Search --> : F'd Up fstab


halo1942
04-12-2002, 01:21 PM
I just rebuilt my system and created swap with fdisk. My distro is Slack and it located the swap partition and formatted it, however when I look at my fstab I see this:

/dev/hdb2 / ext2 defaults 1 1
/dev/hda1 / hpfs ro 1 0
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0

The swap is on /dev/hdb1 and that isn't listed. WTF?

2thumbs
04-12-2002, 01:33 PM
Just because you make and format a partition does not mean that it gets automagically added to fstab. Unless you use something like DiskDrake, which will modify fstab for you if you want it to. Anyways, just add it to /etc/fstab:

/dev/hdb1 swap swap defaults 0 0

halo1942
04-12-2002, 01:40 PM
Cool, is there a way to verify that its actually using swap space? Like a command to show the percentage of swap used or something like that? Also if I enter it into fstab wrong, how will I know if I did?

bdl
04-12-2002, 01:48 PM
You can use the command 'free' to check how much physical memory and swap your system currently recognizes. I normally use 'free -mo for some easily readable output.

Once you enter the swap fstab entry, use the command 'swapon /dev/hdb1' for the system to start using it. Now that it's in your fstab, it will come up automatically on boot each time after that. Normally you'll get some sort of error when entering an fstab entry incorrectly, if you enter one and try to mount that particular partition, you'll know.

I'm interested more in your second fstab entry, '/dev/hda1 / hpfs ro 1 0'. Unless this was a typo, it looks like you may have NT or W2K on the first partition on your primary disk, and you have it trying to mount under '/' (root). Please verify and change this to a suitable mountpoint, like '/mnt/windows' or something.

halo1942
04-12-2002, 02:00 PM
Ya hehe that 2000 on hda1, I'm a newbie so take it easy. I had slackware automatically mount it so thanks for the input, one more retarded question. How do I save the fstab file using vi? To quit I hit ctrl-q the type q and hit enter. Thanks again. :)

scanez
04-12-2002, 02:12 PM
Originally posted by halo1942:
<STRONG>How do I save the fstab file using vi? To quit I hit ctrl-q the type q and hit enter. </STRONG>
Hit &lt;esc&gt;, then :wq, then enter.

And FYI, using free with the -o flag will not show buffers/cache, which is really the true measure of how much free space you have available ;)

halo1942
04-12-2002, 02:58 PM
sorry...

No dice, Im SSH'd in now. I cant even type. I know jack about vi...

bdl
04-12-2002, 03:17 PM
Originally posted by halo1942:
<STRONG>sorry...

No dice, Im SSH'd in now. I cant even type. I know jack about vi...</STRONG>

Huh? You're doing this remotely?

You don't necessarily have to use VI, you might be better off at this stage of the game using PICO (which if memory serves comes in the standard Slack install). I'd recommend learning VI/VIM because they're basically the standard on every UNIX system, or maybe learning *shudder* EMACS. ;-)

Quick VI primer to get you going:

prompt# vi /etc/fstab

Once you're in the file,find a blank line and hit 'i' to get into input mode, then type the entry you want to add. Hit 'ESC' and then you can write to the file and exit with ':wq' &lt;enter&gt;. If you decide to try PICO, all the file read/write options are shown on the bottom of the screen, so it's a little easier on neophytes that just want to get things done.

halo1942
04-12-2002, 04:29 PM
Ok so thats working, but where do I mount the swap? /? Im hitting

bdl
04-12-2002, 04:33 PM
Originally posted by halo1942:
<STRONG>Ok so thats working, but where do I mount the swap? /? Im hitting</STRONG>

Huh? You don't mount SWAP. Use the 'swapon' command as I mentioned above.

prompt# man swapon
prompt# swapon /dev/hdb1

That's it. ;)


BTW, what are you hitting?

[ 12 April 2002: Message edited by: bdl ]

camelrider
04-12-2002, 04:53 PM
If you can run top on the remote system it will show if you have swap available. "q" to exit top.

mdwatts
04-12-2002, 05:44 PM
As suggested, add the swap partition line to /etc/fstab.

If you want to immediately use the swap partition now without rebooting, then use the swapon command.

If not, then just reboot.