flyonok

统计

留言簿(7)

ACE

book

boost

bsd

c study

c++

code download

codeblock

computer clound

Eclipse

embed system

erlang

ET++

gtk

ic card

java

KDE

libevent

linux

linux--MM

mysql

network education

one card

oracle

pcap relation

php

powerbuilder

python

QT

software config

software test

SQL server

UML

wireless

wxwidgets

陈宾

阅读排行榜

评论排行榜

dd swap

dd if=/dev/zero of=/swaporacle bs=1M  count=3030
mkswap /swaporacle
swapon /swaporacle
swapon -s
vi /etc/fstab

Certain software's require minimum swap space for installation. I ran into the same problem when installing oracle on my Fedora machine. Does adding more swap space mean you have to install again from scratch? Luckily, no. In this article I will show you how to add some extra space to your existing tux. You could also reshuffle and resize your partitions and make increase swap space but that is a pretty severe change to the existing machine.

Step 1: Learn to use Swap commands

Swapon and SwapOff are two command provided with Linux to enable/disable devices and files for paging and swapping.

Lets first check how much swap space is there on my machine. At the CLI, we type "swapon -s" which displays swap usage summary by device.

The sizes mentioned in above screenshot are in Kb, and my system currently has only 490MB out of which 72MB has been already used. That's the reason why oracle rpm threw errors during installation.

Step 2: Available Disk Space

Before we go ahead and create swap file, lets see how much disk space we have. At the CLI, we would now run the command "df -h". `df` command reports file system disk space usage on a Linux system. We also included the option of "-h" which print sizes in human readable format (e.g., 1K 234M 2G).

Under the "Available" column I have approximately 22Gigs of free space on root partition, that’s where my new swap file will be.

Step 3: Create Swap File using DD command

In order to create an additional swap file, I am going to use the dd (data dump) command.

In the above dd command we used :

  • if=/dev/zero ; points to /dev/zero file which contains only zero's and will write those to the output file. In contrast to /dev/null, which only acts as a sink for data, /dev/zero also acts as a source. All reads on /dev/zero return as many NULL’s as characters requested.
  • of=/extraswap ; points to /extraswap file which we will use as swap
  • count=2048 ; is the file-size for /extraswap file which gets created.
  • bs=1M ; determines how many bytes should be read and written at a time

You can replace 2048 with the number of megabytes you want in your additional swap file.

Step 4: Setup Linux swap area using MKSWAP command

Once, extraswap file is generated; we will have to prepare it for use as a swap partition by using mkswap command. mkswap sets up a Linux swap area on a device or in a file. The device argument provided to mkswap is generally a disk partition (something like /dev/hda2 or /dev/sdb3) but it can also be a file (like in our case).

Step 5: SwapOn the new /extraswap file

To activate my new swap file, I run the command "swapon /extraswap" on the CLI. After that you can run "swapon -s" and view the addition made.

You can also use "free -m" command to verify addition of your new swap space.

Step 6: Make swap upgrade permanent through fstab file

To make these changes permanent and load the new /extraswap everytime system reboots, we will have to modify the fstab file in /etc/ folder.

Open /etc/fstab in your VI and add another line to include information regarding new swap file.

Done! Now you can reboot, do whatever and your system will have 2048Mb of more swap space (and hopefully my oracle installation wont be a PITA now).



posted on 2008-03-05 09:58 flyonok 阅读(576) 评论(0)  编辑 收藏 引用 所属分类: linux


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理