VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: How to install swap partition after VL installation?  (Read 2411 times)

Sivatheja

  • Vectorite
  • ***
  • Posts: 156
    • Banthigaadu
How to install swap partition after VL installation?
« on: January 30, 2008, 04:26:26 pm »

Hi,

During VL installation, I've created three partitions in my 40GB HDD. 15GB + 1GB + 24GB. I've installed linux in 15GB, but could not install 1GB as swap space during installation (I did not format the other two partitions then).

Now VL is fine, but without any swap. I've formatted the other two partitions with ext2 file system through VSAM. Is there a way to install swap now?

Best Regards,
Sivatheja.
Logged
Full Linux Machine - Vector Linux 5.9 STD Gold, Intel - 1.79 GHz, 1Gb RAM, 60GB HDD

lagagnon

  • Global Moderator
  • Vectorian
  • *****
  • Posts: 1922
Re: How to install swap partition after VL installation?
« Reply #1 on: January 30, 2008, 10:49:52 pm »

Is there a way to install swap now?
Yes. Let me assume your newly created swap partition is /dev/hdb2. Login as root (su) in a terminal. Then type:

mkswap /dev/hdb2

To enable the swap partition immediately, then type the following command:

 swapon /dev/hdb2

To enable swap every boot time, edit /etc/fstab to include:

/dev/hdb2               swap                    swap    defaults        0 0
Logged
"As people become more intelligent they care less for preachers and more for teachers". Robert G. Ingersoll

Sivatheja

  • Vectorite
  • ***
  • Posts: 156
    • Banthigaadu
Re: How to install swap partition after VL installation?
« Reply #2 on: January 31, 2008, 08:50:21 am »

The following are the partition names that I find in [system]->[VSAM]->[FILESYSTEM]->[MOUNT]->[ADD]

/dev/hda1 Linux size=999904+ MB
/dev/hda3 Linux size=23082696 MB

I've only formatted these two partitions in ext2 file system, and did nothing else. Mine is a full VL machine and is not a dual boot one, and want to make  hda1 as swap space. Is there any sequence in which these partitions are to be mounted before making hda1 as swap space?

Thanks in advance,
Sivatheja.
Logged
Full Linux Machine - Vector Linux 5.9 STD Gold, Intel - 1.79 GHz, 1Gb RAM, 60GB HDD

caitlyn

  • Packager
  • Vectorian
  • ****
  • Posts: 2878
    • The Linux Works
Re: How to install swap partition after VL installation?
« Reply #3 on: January 31, 2008, 09:00:51 am »

You do not want to mount /dev/hda1 to make it swap.  Just make sure it's unmounted and then follow the instructions above substituting hda1 for hdb2.  That's all there is to it.

Also, ext2 is a poor choice for a 15GB partition.  An fsck if there is ever filesystem corruption will take forever.  Journaling filesystems (ext3, xfs, reiserfs, jfs) are far more reliable.
Logged
eMachines EL-1300G desktop, 1.6GHz AMD Athlon 2650e CPU, 4GB RAM, nVidia GeForce 6150 SE video
CentOS 6.5 (will try VL64-7.1 soon)

Toshiba Satellite A135-S4727,  Intel Pentium T2080 / 1.73 GHz, 2GB RAM, Intel GMA 950

HP Mini 110 netbook, 1.6GHz Intel Atom CPU, 2GB RAM, Intel 950 video, VL 7.1

Sivatheja

  • Vectorite
  • ***
  • Posts: 156
    • Banthigaadu
Re: How to install swap partition after VL installation?
« Reply #4 on: January 31, 2008, 09:27:51 am »

So the commands I'd go with are (can you please confirm on this?)

mkswap /dev/hda1 (hda1 would not be mounted at this point, or you mean it should never be mounted?)
swapon /dev/hda1

then I edit /etc/fstab.

I did not want to take chances, so I went with the recommended options during the installation (ext2). I think we cannot change the file system now. Any suggestions on this?

Thanks in advance,
Sivatheja.
Logged
Full Linux Machine - Vector Linux 5.9 STD Gold, Intel - 1.79 GHz, 1Gb RAM, 60GB HDD

caitlyn

  • Packager
  • Vectorian
  • ****
  • Posts: 2878
    • The Linux Works
Re: How to install swap partition after VL installation?
« Reply #5 on: January 31, 2008, 09:41:13 am »

Yes, the commands you have are correct.  swapon actually does mount the partition as swap and the /etc/fstab entry makes sure swap is mounted and started at each reboot.

ext2 is not recommended in the installer except for older, slow systems if memory serves.  It's the original Linux filesystem but it is really showing it's age nowadays.  If you don't have any data on hda3 you can still reformat it to any filesystem you like.  Reformatting erases all data so don't do this if you haven't moved the contents of the filesystem to somewhere else.  Unmount the filesystem and then use one of the following commands:

To create an ext3 filesystem, as root:

mke2fs -j /dev/hda3

To create an xfs filesystem:

mkfs -t xfs /dev/hda3

To create a reiserfs filesystem:

mkfs -t reiserfs /dev/hda3

I personally prefer xfs -- very good performance and small temp files are held in memory if available and are often never written to disk.  xfs is rock solid reliable as well.

Logged
eMachines EL-1300G desktop, 1.6GHz AMD Athlon 2650e CPU, 4GB RAM, nVidia GeForce 6150 SE video
CentOS 6.5 (will try VL64-7.1 soon)

Toshiba Satellite A135-S4727,  Intel Pentium T2080 / 1.73 GHz, 2GB RAM, Intel GMA 950

HP Mini 110 netbook, 1.6GHz Intel Atom CPU, 2GB RAM, Intel 950 video, VL 7.1

Sivatheja

  • Vectorite
  • ***
  • Posts: 156
    • Banthigaadu
Re: How to install swap partition after VL installation?
« Reply #6 on: January 31, 2008, 09:46:52 am »

Thanks for the help, but after rebooting, how do to know whether VL is using swap space or not?
Logged
Full Linux Machine - Vector Linux 5.9 STD Gold, Intel - 1.79 GHz, 1Gb RAM, 60GB HDD

nightflier

  • Administrator
  • Vectorian
  • *****
  • Posts: 4108
Re: How to install swap partition after VL installation?
« Reply #7 on: January 31, 2008, 09:54:45 am »

In a terminal, enter command:
htop
It should give you a graphical representation of your available and used memory and swap.
Logged

Sivatheja

  • Vectorite
  • ***
  • Posts: 156
    • Banthigaadu
Re: How to install swap partition after VL installation?
« Reply #8 on: January 31, 2008, 01:07:23 pm »

Thanks for all your inputs! VL now has swap installed :)
Logged
Full Linux Machine - Vector Linux 5.9 STD Gold, Intel - 1.79 GHz, 1Gb RAM, 60GB HDD