LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-24-2012, 08:39 AM   #1
steinz
Member
 
Registered: Mar 2006
Posts: 49

Rep: Reputation: 16
lvm, what do I have here


Hi,

I did a clean install of redhat 6, taking all defaults.
I will need to use lvm to create separate partitions for /tmp and /home. Below is my /etc/fstab. Did the install create logical volumes for /home, / and /swap without asking? do I have enough space to create more logical volumes.

/dev/mapper/vg_server1-lv_root / ext4 defaults 1 1
UUID=04bc18c4-2df9-32b1-89d1-0f8dd035b3 /boot ext4 defaults 1 2
/dev/mapper/vg_server1-lv_home /home ext4 defaults 1 2
/dev/mapper/vg_server1-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
 
Old 04-24-2012, 08:52 AM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,539

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
you can start with pvscan and lvscan to find your physical volumes and logical volumes. a df -h will show you the sizes. its a start. sorry im very new to LVM's as well.

IIRC RHE by default will use LVM for everything.
 
Old 04-24-2012, 09:24 AM   #3
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 224

Rep: Reputation: 7
Quote:
Originally Posted by steinz View Post
Hi,

I did a clean install of redhat 6, taking all defaults.
I will need to use lvm to create separate partitions for /tmp and /home. Below is my /etc/fstab. Did the install create logical volumes for /home, / and /swap without asking? do I have enough space to create more logical volumes.

/dev/mapper/vg_server1-lv_root / ext4 defaults 1 1
UUID=04bc18c4-2df9-32b1-89d1-0f8dd035b3 /boot ext4 defaults 1 2
/dev/mapper/vg_server1-lv_home /home ext4 defaults 1 2
/dev/mapper/vg_server1-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
Hi Steinz,

Yes default installation of RHEL6 goes with LVM if you do not manually create the partition schema during installation. Looking at your fstab file shows that /root, /home and swap are on Volume Group named vg_server1 with three logical volumes lv_root, lv_home and lv_swap for /root, /home and swap respectively.


Use "df -h" to see how much space each filesystem is occupying and how much space you are left with. If you have enough space follow the steps below mentioned below to create Logical volume.

1. Use fdisk <hard-drive name>
2. Create a new partition and set the system id to Linux LVM
3. Now use pvcreate to create a Physical volume from that raw partition.
4. use vgcreate to create a volume group.
5. Finally create logical volume using lvcreate
6. Now create filesystem on this logical volume using mkfs.ext4 command.
7. Now mount the logical volume on /tmp directory and place an entry in fstab file if you want it to be mounted at boot.

I would suggest to look at man pages of each of these commands if you are not very familiar with them for details. Also take a look at the below article.

http://www.aboutlinux.info/2005/04/c...-in-linux.html

Rohit
 
Old 04-24-2012, 09:40 AM   #4
steinz
Member
 
Registered: Mar 2006
Posts: 49

Original Poster
Rep: Reputation: 16
thanks. so if I am reading this df -h output correctly, I have 72gig hard drive and should have about 10gigs left to partition /tmp and /var/log with.

So would I do the fdisk on /dev/sda2 ?????


Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_server1-lv_root
32G 3.2G 28G 11% /
/dev/mapper/vg_server1-lv_home
22G 173M 21G 1% /home

tmpfs 5.9G 0 5.9G 0% /dev/shm
/dev/sda1 485M 52M 409M 12% /boot
 
Old 04-24-2012, 10:05 AM   #5
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 224

Rep: Reputation: 7
Quote:
Originally Posted by steinz View Post
thanks. so if I am reading this df -h output correctly, I have 72gig hard drive and should have about 10gigs left to partition /tmp and /var/log with.

So would I do the fdisk on /dev/sda2 ?????


Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_server1-lv_root
32G 3.2G 28G 11% /
/dev/mapper/vg_server1-lv_home
22G 173M 21G 1% /home

tmpfs 5.9G 0 5.9G 0% /dev/shm
/dev/sda1 485M 52M 409M 12% /boot

Yes 72-(32+22+6+0.5) gives you almost 10.5G. Fdisk runs on disk (not partition), so you would use fdisk /dev/sda. Use exactly the following steps:

1. Choose "n" to create a new partition.
2. select "p" for primary partition.
3. Then give the partition number as 3
4. Then it will ask you starting cylinder- choose default
5. Then give the size as +10G
6. Then press t to change the partition Id and change it to 8e.
7. Now press w to write the changes.

Now use pvcreate, vgcreate and lvcreate to create logical volume and then finally make filesystem and mount it.
 
Old 04-24-2012, 10:17 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,890

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
No. df only looks at the available space within the file system not what is unallocated or free space on the disk or within the LVM partiton. In this case it would provide some information on what space can be freed by resizing the existing logical volumes.

Look at the output of the command:
fdisk -l (must be root to run command and that is a small L)
You should see 2 partitions sda1 which is your /boot and sda2 which is the LVM that contains / and /home. All the space inside the LVM should be allocated. I also assume there isn't any free space on the disk either.

There is a GUI utility to manage LVMs.
http://docs.redhat.com/docs/en-US/Re...onfig-lvm.html

Last edited by michaelk; 04-24-2012 at 10:19 AM.
 
Old 04-24-2012, 10:18 AM   #7
steinz
Member
 
Registered: Mar 2006
Posts: 49

Original Poster
Rep: Reputation: 16
Rohit,

You have been very helpful.

Thanks
Randy
 
1 members found this post helpful.
Old 04-24-2012, 11:01 AM   #8
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 224

Rep: Reputation: 7
Quote:
Originally Posted by steinz View Post
Rohit,

You have been very helpful.

Thanks
Randy
Hi Randy,

Not a problem, i am glad it the information i provided was helpful for you.

Rohit
 
Old 04-24-2012, 11:06 AM   #9
steinz
Member
 
Registered: Mar 2006
Posts: 49

Original Poster
Rep: Reputation: 16
so I have no free space then?
What happened to the other 10gigs then?
root is 32g
home is 22g
boot is 6


Disk /dev/sda: 73.4 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00081620

Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 8921 71139328 8e Linux LVM
 
Old 04-24-2012, 11:15 AM   #10
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 224

Rep: Reputation: 7
Quote:
Originally Posted by steinz View Post
so I have no free space then?
What happened to the other 10gigs then?
root is 32g
home is 22g
boot is 6


Disk /dev/sda: 73.4 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00081620

Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 8921 71139328 8e Linux LVM
Steinz,

The remaining 10G is available in your /dev/sda2 which has a volume group on it. If you can look at the fdisk output you have a total of 8920 cylinders, out of which 63 cylinders were used by /dev/sad1 and remaining by /dev/sda2. So it would not be possible to create lvm now considering your scenario since all the cylinders have been used up and there is no unallocated space on your hard drive and you need to have unallocated space to create a raw partition.
 
Old 04-24-2012, 11:34 AM   #11
steinz
Member
 
Registered: Mar 2006
Posts: 49

Original Poster
Rep: Reputation: 16
6 g to sda1 - all used
67 g to sda2 - 54g in lvm
and 10g in sda2, but unallocated to anything.

so to use the 10 g, could I fdisk and create a third partition and then use it in lvm
or extend sda2 by 10 g and use lvm
or just format the third partition (sda3) and use that for /home and /var/log
 
Old 04-24-2012, 12:10 PM   #12
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 224

Rep: Reputation: 7
Quote:
Originally Posted by steinz View Post
6 g to sda1 - all used
67 g to sda2 - 54g in lvm
and 10g in sda2, but unallocated to anything.

so to use the 10 g, could I fdisk and create a third partition and then use it in lvm
or extend sda2 by 10 g and use lvm
or just format the third partition (sda3) and use that for /home and /var/log
Hey Steinz,

Once some space is allocated to a partition then it no longer remains unallocated to create a new partition. On your system you have sda2 of 67G but i suspect that all 67G is already assigned to Volume group though you have only 54G used as logical volumes. Run vgdisplay command and it would show you the volume group details or you can use vgs command it will show total Volume group size and free size for each volume group you have on your system.

Now if there is any free space on the volume group then just create a new logical volume in the same volume group using the lvcreate command, here is an example of that.

lvcreate -L 10G -n tmp_lv <name of the volume group>
 
Old 04-24-2012, 12:38 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,890

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Oops... I didn't mention swap in my first post which is also part of the LVM is some of that missing space. The output of the pvscan will display the information of all physical volumes and their sizes including free space. The output of the lvscan command will display all of the logical volumes and their sizes. Post the output.

You can not create a third partition or extend an existing partition since all of the disk space is allocated. The output from the commands. will show if there is free space available inside the LVM. However, you can re-size existing LVs to create some free space for another LV. I posted a link that documents the GUI LVM tool. Backup any and all important data first.
 
  


Reply

Tags
lvm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with LVM mirror and failed PV, can't recover -- Debian Squeeze lvm 2.02.66-5 Linux Ninja Linux - Server 0 08-14-2011 11:43 PM
LVM REDUCE HOW TO UNMOUNT /dev/volumegroup/lvm crahuldba@gmail.com Linux - Newbie 3 10-29-2010 07:49 AM
Adding an LVM hard disk to a system already running/using LVM firewiz87 Linux - Hardware 5 08-15-2010 12:59 AM
LVM and multiple iSCSI disks performance of LVM xxx_anuj_xxx Linux - Server 4 05-01-2008 12:26 PM
LXer: Back Up (And Restore) LVM Partitions With LVM Snapshots LXer Syndicated Linux News 0 04-17-2007 11:16 AM


All times are GMT -5. The time now is 06:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration