lvm, what do I have here
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
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.
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.
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
32G 3.2G 28G 11% /
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.
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.
You have been very helpful.
Not a problem, i am glad it the information i provided was helpful for you.
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
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.
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
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>
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 01:59 AM.|