Wednesday 22 February 2017

Yum and Fdisk, Increasing the Size of Swap Partition



Yum server uses for install all linux packages easily. Yum fine automatically all required library. Before use yum first install yum RMP.

Server Site :- 
Mount cdrom
#mount  /dev/cdrom  /mnt
#cd /mnt
#cd   Server

install first FTP package
#rpm  -ivh   vsft*   --aid  --force
#rpm –ivh createrpo* --aid –force
#cd
Copy all RPM in linux partitions
#cp  -var   Sevrer   /var/ftp/pub
#cd  /var/ftp/pub
#ll
#createrepo    Server
Now create repo file for server
#vim   /etc/yum.repos.d/anyfilename.repo
[any name]
name=abc
baseurl=file://var/ftp/pub/Server
enabled=1
gpgcheck=0
:wq
#yum clean all

Client Side:-- 
Create yum file in client side

[any name]
name=abc
baseurl=ftp://10.0.0.254/var/ftp/pub/Server
enabled=1
gpgcheck=0
:wq
#yum clean all
This command use for both side for install RPM package
#yum   install   rpmname*
#yum   remove   rpmname*
#yum   update  rpmname*
 
Fdisk:
Representation of Hard disk
/dev/hdx
/dev/hda       :           Primary Master
/dev/hdb       :           Primary Slave
/dev/hdc       :           Secondary Master
/dev/hdd       :           Secondary slave
Fdisk command is used to create a partition
#fdisk –l
Display the partition Listing
Creating Partition
#fdisk /dev/hda
Press(m for help): m
            Some important switches are
D         :           delete partition
N         :           New
L          :           listing
Q         :           quit
W        :           Save and Exit
T          :           changed type

Press    : n
l :         Logical (5 or above)
p:         Logical partition( 1-4)
Type l
First cylinder (Take as default): Press Enter
Last Cylinder or +size or +sizeM or +sizeK (….) : +100M
Command (m for help) : w
# partprobe
( to update the partition table without restarting the computer)

Now we need to format the partition
#mkfs.ext3 /dev/hdax
Where x is the number of partition that is newly created
Now we mount this partition
#mkdir /partx
#mount –t ext3 /dev/hdax /partx
Or
#mount /dev/hdax /partx
To mount this partition permanently makes the entry in fstab
#vi /etc/fstab
/dev/hdax     /partx ext3     defaults           1 2

Increasing the Size of Swap Partition:-
There are possibilities that any time we can increase the size of RAM, at that time we need to increase the size of swap partition as per the increased size of the RAM.
There are two method of doing so
a.      creating partition
b.      Creating file
  1. Creating Partition:
i.                    We have to create one partition of size say 200MB and change its type to 82 (swap type) . save and exit and then run the command “partprobe”
ii.                  Format the partition say /dev/hda9
#mkswap /dev/hda9
iii.                Make the swap partition active
#swapon /dev/hda9
iv.                to check the entry of swap partition
# cat /proc/swaps
If we want to make the permanent entry in fstab then
#vi /etc/fstab
/dev/hda9     swap   swap   defaults           0          0

  1. Creating file
i.                    first make an empty file
#touch /swp
ii.                  Now we customize the size of the swap
# dd if=/dev/zero of=/swp bs=1M count=200
iii.                Format the newly created swap file
#mkswap /swp
iv.                Active the swap file
#swapon /swp
To check the entry of swap file
#cat /proc/swaps
If we want that automatically this swap file activate , we need to make the entry in /etc/ec.local
# vi /etc/rc.local
Make the following entry
Swapon /swp
Save and exit


No comments: