LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 03-23-2008, 11:36 PM   #1
cghcgh
Member
 
Registered: Mar 2008
Posts: 69

Rep: Reputation: 15
Create a partition on existing lvm


Hi, i'm new to linux system
Recently i have just staged a linux server which was pushed from satellite server.

I want to create a new 'partition' which i will name it as software under /software. How do i do it? I do not know the terms well enough though. will appreciate any help
 
Old 03-23-2008, 11:58 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Do you want to add a new hard drive and add it to the lvm volume? Or do you want to repartition the partitions inside the LVM?

New software is usually installed under /usr e.g. /usr/bin/, /usr/lib/. There isn't the equivalent to "Program Files" in Linux which seems to be what you are trying to do.

Last edited by jschiwal; 03-24-2008 at 12:25 AM.
 
Old 03-25-2008, 04:15 AM   #3
cghcgh
Member
 
Registered: Mar 2008
Posts: 69

Original Poster
Rep: Reputation: 15
i have a hardisk of 144GB. how do i make use of the remaining hardisk. info from below in df -k shows that i only have a GB here and there. i want to take out about 50 GB to mount as /software. Hope u can help me..
[root@xxxxxxx local]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p3 2.0G 514M 1.4G 27% /
/dev/cciss/c0d0p1 99M 21M 74M 22% /boot
none 2.0G 0 2.0G 0% /dev/shm
/dev/mapper/Volume00-home
2.0G 36M 1.9G 2% /home
/dev/mapper/Volume00-opt
2.0G 36M 1.9G 2% /opt
/dev/mapper/Volume00-usr
6.0G 823M 4.9G 15% /usr
/dev/mapper/Volume00-var
4.0G 69M 3.7G 2% /var


[root@xxxxxxx local]# lvmdiskscan
/dev/ramdisk [ 16.00 MB]
/dev/dm-0 [ 2.00 GB]
/dev/ram [ 16.00 MB]
/dev/cciss/c0d0p1 [ 101.94 MB]
/dev/dm-1 [ 2.00 GB]
/dev/ram2 [ 16.00 MB]
/dev/cciss/c0d0p2 [ 2.00 GB]
/dev/dm-2 [ 6.00 GB]
/dev/ram3 [ 16.00 MB]
/dev/root [ 2.00 GB]
/dev/dm-3 [ 4.00 GB]
/dev/ram4 [ 16.00 MB]
/dev/ram5 [ 16.00 MB]
/dev/cciss/c0d0p5 [ 132.59 GB] LVM physical volume
/dev/ram6 [ 16.00 MB]
/dev/ram7 [ 16.00 MB]
/dev/ram8 [ 16.00 MB]
/dev/ram9 [ 16.00 MB]
/dev/ram10 [ 16.00 MB]
/dev/ram11 [ 16.00 MB]
/dev/ram12 [ 16.00 MB]
/dev/ram13 [ 16.00 MB]
/dev/ram14 [ 16.00 MB]
/dev/ram15 [ 16.00 MB]
3 disks
20 partitions
0 LVM physical volume whole disks
1 LVM physical volume
 
Old 03-25-2008, 04:35 AM   #4
sridhar_dct3
Member
 
Registered: May 2007
Location: india,chennai
Distribution: debian,ubuntu linux
Posts: 30

Rep: Reputation: 15
You need to use fdisk command in order to create new partition and create filesystem in it.

fdisk - you can choose the free blocks and specify the size to be created.

fdisk /dev/ccis/...

be careful while running fdisk - if you use it wrongly you will lose your partition.
 
Old 03-25-2008, 11:10 PM   #5
cghcgh
Member
 
Registered: Mar 2008
Posts: 69

Original Poster
Rep: Reputation: 15
i managed to create a logical volume 'testing'in lvm.

lvm> lvscan
ACTIVE '/dev/Volume00/home' [2.00 GB] inherit
ACTIVE '/dev/Volume00/opt' [2.00 GB] inherit
ACTIVE '/dev/Volume00/usr' [6.00 GB] inherit
ACTIVE '/dev/Volume00/var' [4.00 GB] inherit
ACTIVE '/dev/Volume00/testing' [128.00 MB] inherit

but how do i mount it and use it? thanks.
 
Old 03-26-2008, 12:43 AM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Why do you want to do that? The whole point of LVM is to add physical drives to what looks like an existing partition, not to partition a drive into smaller "bits". If you really want separate partitions for /home, etc., create them with a partitoning tool (fdisk, parted, gparted, etc.). The other thing you could do is delete the partitions you don't need, and use something like gparted (again) to move the other partitions around so you have one decent sized free block, create a partition with that and mount it.

It may be better to show your starting point and desired end point, then someone can suggest the best way to get there.

Edit - I re-read your post, and I think you are more talking about my final suggestion

Last edited by billymayday; 03-26-2008 at 12:52 AM.
 
Old 03-26-2008, 12:55 AM   #7
cghcgh
Member
 
Registered: Mar 2008
Posts: 69

Original Poster
Rep: Reputation: 15
i dun really understand the terms like volume group.

let me illustrate with my understanding on my situation.

I have 2 x physcial hardisk 144GB. i did a mirror on it. so it's considered 1 x hardisk that can be used.
this hardisk is made into 1 Volume Group.
out of this volume group, i have
ACTIVE '/dev/Volume00/home' [2.00 GB] inherit
ACTIVE '/dev/Volume00/opt' [2.00 GB] inherit
ACTIVE '/dev/Volume00/usr' [6.00 GB] inherit
ACTIVE '/dev/Volume00/var' [4.00 GB] inherit

the size is only about 14gb.

therefore i want to create another 'partition', is this term correct? that i will make use of some of the remaining drive.
 
Old 03-26-2008, 01:15 AM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I think you need to give yourself some basic background first. Do some googling, but here's a start on LVM

In very short form, we divide disks into partitions, so they appear to be separate disks. We might do this to separate critical parts of the system such as programs and data (/ and /home partitions for example) or we might want separate environments, such as having a partition to boot Windows and another with Linux.

LVM on the other hand aggregates disks (it probably aggregates partitions in fact, but I'm writing from my head), so if I needed a really big disk, I could have 2 in a logical volume that would look like one big disk to the system. Useful if I decide to add another disk to a system at some point. A bit like raid, but not the same.

Does that give a basic view? I leave the rest to you for now.

Bill
 
Old 03-26-2008, 04:12 AM   #9
cghcgh
Member
 
Registered: Mar 2008
Posts: 69

Original Poster
Rep: Reputation: 15
thanks very much bill. i think i under the concept but did not get the terms correct. Instead of partition, i should say it's logical volume. am i right to say that?
 
Old 04-13-2008, 11:14 AM   #10
zjem
LQ Newbie
 
Registered: Apr 2008
Location: The other Silicon Valley
Distribution: They're all pink on the inside
Posts: 8

Rep: Reputation: 0
LVM: How PVs make VGs for LVs

Hello cghcgh, I am new here myself.

It may help you to think of Logical Volume Management as it relates to disk-level partitioning. The closest thing in LVM to the traditional disk "partition" (BSD: "slice") is a physical volume (PV). In fact you must first create partitions on the disk to assign as PVs. A Volume Group (VG) is one or more Physical Volumes joined together. Keep in mind setting 3 disks next to each other and calling them a VG does not make it so, you must use your distributions disk manager or the vgcreate command to join PVs. Once you have established your Volume Group you can do what you earlier referred to as "partitioning" by creating Logical Volumes (LVs).

In your situation you already have your PVs joined as VG 'Volume00' and as you demonstrated you have plenty of unused capacity in that VG. I strongly encourage you to type 'man lvcreate' and 'man lvm' to check the documentation for further details, but.., If you have blind faith in total strangers, here is the command for what you want...

lvcreate -L 50g -n software Volume00

To have your new LV automount to a persistent directory on boot-up. Create the directory '/software' ('mkdir /software') and add a line to /etc/fstab using the path '/dev/mapper/Volume00-software'. Again, I strongly recommend typing man fstab for details.

I hope the LVM explanation helps, Joe

Last edited by zjem; 04-13-2008 at 04:16 PM.
 
Old 04-13-2008, 11:47 AM   #11
zjem
LQ Newbie
 
Registered: Apr 2008
Location: The other Silicon Valley
Distribution: They're all pink on the inside
Posts: 8

Rep: Reputation: 0
More LVM basics

In response to some of the posts above;

LVM is just an additional abstraction layer that makes administration and design changes easier once a system is in place. If you wish to add usable storage to an LVM system with no free space there are four steps.

Add physical drive and create one or more disk-level partitions.
Assign PVs to disk-level partitions.
Join PVs to existing VG or create new VG(s).
Create more LVs on available space.

The "whole point" of LVM is that Logical Volumes are abstracted from the physical disks and can be arranged somewhat independently from the underlying physical infrastructure.

Hope the above helps clarify, -Joe

Last edited by zjem; 04-13-2008 at 04:15 PM.
 
Old 04-13-2008, 11:33 PM   #12
cghcgh
Member
 
Registered: Mar 2008
Posts: 69

Original Poster
Rep: Reputation: 15
thanks very much for the reply guys. But what is the difference if i use the lvm or the fdisk? are they basically doing the same thing? or fdisk is the 1st layer and lvm is the 2nd layer administration? can i totally ignore fdisk command?
 
Old 04-14-2008, 01:34 AM   #13
zjem
LQ Newbie
 
Registered: Apr 2008
Location: The other Silicon Valley
Distribution: They're all pink on the inside
Posts: 8

Rep: Reputation: 0
fdisk vs LVM

cghcgh, as with several of your earlier posts you are ahead of the game by answering most of your own questions.

fdisk operates directly on the disk setting boundaries as to where the platters can be written to. LVM operates "above" that level but is still tied 1-to-1 via 'Physical Volumes' to the disk-level partitions. In practical terms that means that there are no changes you can make via LVM that will change the physical boundaries set by fdisk, however, any change made via fdisk to a partition in use by LVM will disrupt your LVM setup and most likely lead to an unbootable system and or data loss.

There is nothing wrong with foregoing LVM and just using old school hard partitioning schemes but the system you have described is already configured using LVM and you DO NOT want to go making changes to existing disk-level partitions with fdisk.

You have plenty of available space in your Volume Group and if you need more usable storage space you can either create new Logical Volumes using a variant of the command I supplied earlier or resize an existing LV using the 'lvresize' command. Expanding Logical Volumes is trivially easy, considerably easier than shrinking them, so only add what you need when you need it.

Just to make sure that I dispell some very misleading information provided earlier in this thread I will try to summarize LVM one more time...

LVM is built upon the disk-level partitions created by utilities like fdisk.

The foundation of Logical Volume Management is the "Physical Volume" and Physical Volumes are created by labeling disk-level partitions with the 'pvcreate' command. Just like "traditional" partitions a physical disk can have multiple Physical Volumes but Physical Volumes can not exceed the maximum size of the disk they occupy. Unlike a traditional partition a Physical Volume is not formatted with a file system, it is just there to support a Volume Group.

Volume Groups are composed of one or more Physical Volumes. Even if you have only one disk and create only one disk-level partition resulting in a single Physical Volume you still must create a Volume Group composed of that single volume. Physical Volumes can be added to and removed from Volume Groups but Volume Groups can not be resized arbitrarily, they are the sum of their underlying Physical Volumes. It is with Volume Groups that you get your first real layer of abstraction from the disk hardware, you can have multiple Volume Groups on a single physical disk or multiple physical disks in a single Volume Group.

Logical Volumes are the functional equivalent of traditional partitions, they are where the file system resides. For your purposes when you asked earlier about creating new partitions this is what you meant. Logical volumes reside within Volume Groups, there is nothing to say that a Logical Volume couldn't consume an entire Volume Group, and a file system can consist of Logical Volumes from multiple Volume Groups but a single Logical Volume can not span multiple Volume Groups.

As for the earlier comments about RAID, RAID operates on disk-level partitions and presents the resulting usable space as a single "device". That "RAID device" resides below LVM and can be labeled as a Physical Volume just like a disk-level partition.

-Joe

Last edited by zjem; 04-14-2008 at 01:51 AM.
 
  


Reply

Tags
logical, lv, lvm, management, partitioning, pv, raid, volume



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
How to extend an existing partition without LVM james.reid Linux - Software 14 06-02-2006 12:48 AM
Possible to create new partition by resizing existing? rollo SUSE / openSUSE 11 07-02-2005 08:31 AM
Create new partition from existing free space distortedstar Linux - General 4 06-07-2005 09:47 PM
Resize existing and add another partition with LVM donv2 Linux - Newbie 3 04-27-2005 04:23 AM
existing LVM partition won't mount anymore dehuszar Linux - Software 1 09-10-2004 01:26 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 02:46 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration