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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-24-2012, 09:39 AM
|
#1
|
Member
Registered: Mar 2006
Posts: 58
Rep:
|
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
|
|
|
04-24-2012, 09:52 AM
|
#2
|
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983
|
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.
|
|
|
04-24-2012, 10:24 AM
|
#3
|
Member
Registered: Oct 2010
Distribution: Red Hat
Posts: 228
Rep:
|
Quote:
Originally Posted by steinz
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
|
|
|
04-24-2012, 10:40 AM
|
#4
|
Member
Registered: Mar 2006
Posts: 58
Original Poster
Rep:
|
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
|
|
|
04-24-2012, 11:05 AM
|
#5
|
Member
Registered: Oct 2010
Distribution: Red Hat
Posts: 228
Rep:
|
Quote:
Originally Posted by steinz
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.
|
|
|
04-24-2012, 11:17 AM
|
#6
|
Moderator
Registered: Aug 2002
Posts: 26,453
|
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 11:19 AM.
|
|
|
04-24-2012, 11:18 AM
|
#7
|
Member
Registered: Mar 2006
Posts: 58
Original Poster
Rep:
|
Rohit,
You have been very helpful.
Thanks
Randy
|
|
1 members found this post helpful.
|
04-24-2012, 12:01 PM
|
#8
|
Member
Registered: Oct 2010
Distribution: Red Hat
Posts: 228
Rep:
|
Quote:
Originally Posted by steinz
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
|
|
|
04-24-2012, 12:06 PM
|
#9
|
Member
Registered: Mar 2006
Posts: 58
Original Poster
Rep:
|
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
|
|
|
04-24-2012, 12:15 PM
|
#10
|
Member
Registered: Oct 2010
Distribution: Red Hat
Posts: 228
Rep:
|
Quote:
Originally Posted by steinz
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.
|
|
|
04-24-2012, 12:34 PM
|
#11
|
Member
Registered: Mar 2006
Posts: 58
Original Poster
Rep:
|
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
|
|
|
04-24-2012, 01:10 PM
|
#12
|
Member
Registered: Oct 2010
Distribution: Red Hat
Posts: 228
Rep:
|
Quote:
Originally Posted by steinz
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>
|
|
|
04-24-2012, 01:38 PM
|
#13
|
Moderator
Registered: Aug 2002
Posts: 26,453
|
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.
|
|
|
All times are GMT -5. The time now is 08:11 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|