System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Partitioning After LINUX Install on ProLiant Server

LINUX_USER_001
Occasional Visitor

Partitioning After LINUX Install on ProLiant Server

Calling LINUX Experts! I am a telecom guy with some UNIX experience but limited LINUX experience, espeically at the server level. Please help! Thanks!

 

--

 

I have two 500 GB disks (mirrored, h/w raid 1, so I don't think that comes into play here as whatever I do should be copied to both disks, right?). The server was setup and LINUX installed for me. However, I need additional partitions. I don't think I can just use fdisk here as it looks like two paritions were already created and taking all of the disk space.

 

Here is what it looks like now:

 

 

12:35:07 # fdisk -l

Disk /dev/cciss/c0d0: 500.0 GB, 500074307584 bytes
255 heads, 32 sectors/track, 119694 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 129 526304 83 Linux
/dev/cciss/c0d0p2 130 119694 487825200 8e Linux LVM

 

Here is what I need:

 

 / (root fs) 20 GB

Swap 10 GB

/tmp 8 GB

/var/tmp 4 GB

/boot 100 MB

/export/home Remaining disk space


1 REPLY
Matti_Kurkela
Honored Contributor

Re: Partitioning After LINUX Install on ProLiant Server

The type of the second partition is "Linux LVM", which indicates LVM is used. One of the main advantages of LVM is that it is much more flexible than traditional partitions: for example, it allows you to move your data from one disk to another while the filesystem is mounted.

 

Because the BIOS does not understand LVM, on the system disk there must be at least one traditional partition. It might be the root filesystem, or /boot. Based on the size of your /dev/cciss/c0d0p1 (about 256 MB), I guess it's probably /boot.

 

First, you need to know your current LVM layout.

This command should output a nice summary of your LVM setup:

lvs

 This command is the easiest for seeing if you have unallocated space in your LVM Volume Groups (VGs):

vgs

 

 

Of course, someone might have set up some Logical Volumes (LVs, the LVM equivalent of partitions) but not mounted them. So it might be best to check what you have currently mounted, too:

df -h

 

The idea of LVM in a nutshell: physical disks or LVM partitions are known as LVM Physical Volumes (PVs). One or more PVs will form a Volume Group (VG). When you allocate disk space to filesystems (or other things that traditionally need a partition, like swap area or raw databases), you carve up a VG into one or more Logical Volumes (LVs).

 

At first this seems like just an extra layer of abstraction making things more complex. But the beauty of it is, the LVs will not be restricted by the physical limits of the PVs: you easily can have a LV that is bigger than any of your PVs: one part of the LV may be on one disk(PV) and the rest on other(s).

 

Traditional partitions must be contiguous: if you need to extend one partition that already has another partition after it, you must first move the other partition before you can perform the extension. With LVM, there is no such restriction. As long as there is free space in the VG, you can use it to extend the LVs within that VG, no matter where the free space is located physically.

 

You can even tell LVM to move data from one PV to another while it is in use: the LVM will keep track of what is where and the filesystem (or swap area, or database, or whatever) will remain accessible through the move operation (pvmove).

 

One bit about LVM device naming: you may see names like /dev/<VGname>/<LVname>, or /dev/mapper/<VGname>-<LVname>. For most purposes, these names are pretty much equivalent in most modern Linux distributions. But the bootloader and/or initrd configuration may require a particular form, usually the /dev/mapper/... format. However, this is usually relevant only when telling the kernel where to find the root filesystem. (As I originally learned LVM on HP-UX, I prefer the first format: it's more compact, too. But that's just personal preference...)

 

So, if the filesystems you need are already there, but are too small for your needs, you can on-line extend them. Let's say your "df -h" indicates /tmp is already a separate LV. Its name might be /dev/VolGrp00/LogVol2 (this is an example of RHEL installer's default naming scheme). But its size is only 2 GB, while you need it to be 8 GB. Assuming that the filesystem type is ext2, ext3 or ext4, these are the only commands you need to fix it:

 

lvextend -L 8G /dev/VolGrp00/LogVol2
resize2fs -p /dev/VolGrp00/LogVol2

 (If your filesystem type is something else, the second command would need to be different: for example, the command for ReiserFS is resize_reiserfs, if I recall correctly.)

 

Creating new LVs is also simple:

lvcreate -L 10G -n swap /dev/VolGrp00

 will create a new 10 GB LV named /dev/VolGrp00/swap. Note that you are not restricted to numerical names: you can use descripive names if you want. (A common HP-UXish convention is to have the VG names begin with letters "vg" and LV names with "lvol" or "lv". The CamelCase names used by the RHEL installer are just silly in my opinion.)

 

After creating the LV, it's immediately useable just like a partition. The next steps would be creating a filesystem on it (mkfs), creating a mount point for it (mkdir), editing /etc/fstab and then mounting it.

 

If your UNIX experience includes HP-UX or AIX, I may have just insulted your intelligence: it might be that the concept of LVM is an old hat for you.

MK