HOW TO CONFIGURE SWAP OVER LVM

In this tutorial we are going to learn how to create swap over lvm.

swap over lvm

Follow these steps:

  • Create partitions.
[root@localhost ~]# fdisk /dev/sdc
The number of cylinders for this disk is set to 1634.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)


Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1-1634, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1634, default 1634): +500M


Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (63-1634, default 63):
Using default value 63
Last cylinder or +size or +sizeM or +sizeK (63-1634, default 1634): +500M


Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (125-1634, default 125):
Using default value 125
Last cylinder or +size or +sizeM or +sizeK (125-1634, default 1634): +500M


Command (m for help): p
Disk /dev/sdc: 13.4 GB, 13445111808 bytes
255 heads, 63 sectors/track, 1634 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc4               1        1634    13125073+   5  Extended
/dev/sdc5               1          62      497952   83  Linux
/dev/sdc6              63         124      497983+  83  Linux
/dev/sdc7             125         186      497983+  83  Linux


Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
  • Change these partitions into physical volumes
[root@localhost ~]# pvcreate /dev/sdc5 /dev/sdc6 /dev/sdc7
  Physical volume "/dev/sdc5" successfully created
  Physical volume "/dev/sdc6" successfully created
  Physical volume "/dev/sdc7" successfully created
  •  Now change this physical volumes into volume group
[root@localhost ~]# vgcreate vg00 /dev/sdc5 /dev/sdc6 /dev/sdc7
  Volume group "vg00" successfully created
  • Next step is to create LVM
[root@localhost ~]# lvcreate -L +800M -n lv1 vg00
  Logical volume "lv1" created
  • Now creating SWAP OVER LVM
[root@localhost ~]# mkswap /dev/vg00/lv1


Setting up swapspace version 1, size = 838856 kB


[root@localhost ~]# swapon /dev/vg00/lv1


[root@localhost ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          1010        498        512          0         46        306
-/+ buffers/cache:        145        865
Swap:         2800          0       2800

You can check it by typing

[root@localhost ~]# cat /proc/swaps


Filename                                      Type                  Size                 Used    Priority
/dev/sda2                                      partition       2048276 0       -1
/dev/mapper/vg00-lv1              partition       819192  0         -2

WHAT IS LVM AND HOW TO CONFIGURE ?

HOW TO SEND A MESSAGE THAT WILL SELF-DESTRUCT IN RECIPIENT’S INBOX

RAID6 AND ITS COFIGURTION

33 thoughts on “HOW TO CONFIGURE SWAP OVER LVM

  1. Hey! Someone in my Facebook group shared this site with us so I came to check it
    out. I’m definitely loving the information. I’m bookmarking and will be tweeting
    this to my followers! Fantastic blog and
    fantastic style and design.

    Like

  2. This is really attentiongrabbing, You’re a very professional blogger. I have joined your rss feed and sit up for in search of extra of your fantastic post. Also, I have shared your site in my social networks!

    Like

  3. I like the valuable info you supply to your articles.
    I will bookmark your weblog and test again right
    here frequently. I am slightly sure I’ll be told lots
    of new stuff right right here! Best of luck for the next!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s