LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-22-2010, 09:56 AM   #1
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Rep: Reputation: 15
convert free space from lvm2 to ordinary partion


Hi!
I have read a couple of threads that deals with resize partion and then create new lvm partion
That is not what I want to do! I have resized my partion from 275 GB to 150 GB. the reason for this was hoping for more space to be able to create a normal partion with cfdisk but that does not seem to work.
I have free space, but how can I use it to create room for a new ordinary partion
when the default partion layout for fedora/centos is to fill the whole space up whether you use it or not?


Here is some data from my Centos mounted from ubuntu cd:

root@ubuntu:/home/ubuntu# df -h
Filesystem Size Used Avail Use% Mounted on
aufs 502M 41M 461M 9% /
udev 502M 260K 502M 1% /dev
/dev/sr1 690M 690M 0 100% /cdrom
/dev/loop0 668M 668M 0 100% /rofs
none 502M 100K 502M 1% /dev/shm
tmpfs 502M 20K 502M 1% /tmp
none 502M 104K 502M 1% /var/run
none 502M 0 502M 0% /var/lock
none 502M 0 502M 0% /lib/init/rw
/dev/mapper/VolGroup00-LogVol00
146G 104G 35G 76% /home/ubuntu/centos



Disk Drive: /dev/sda
Size: 320072933376 bytes, 320.0 GB
Heads: 255 Sectors per Track: 63 Cylinders: 38913

Name Flags Part Type FS Type [Label] Size (MB)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
sda1 Boot Primary Linux ext3 [/boot] 106.93
sda2 Primary Linux LVM 319963.40


root@ubuntu:/home/ubuntu# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 150.00G
LogVol01 VolGroup00 -wi-a- 1.94G
root@ubuntu:/home/ubuntu# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 297.97G 146.03G
root@ubuntu:/home/ubuntu# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 297.97G 146.03G
root@ubuntu:/home/ubuntu#

root@ubuntu:/home/ubuntu# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID heB7kX-ce3I-8SdE-dcmd-mH7q-CVtY-xFPnf9
LV Write Access read/write
LV Status available
# open 1
LV Size 150.00 GB
Current LE 4800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID b2qDT3-dw2w-8tCF-06YP-D9fv-YrSz-5DwbXv
LV Write Access read/write
LV Status available
# open 0
LV Size 1.94 GB
Current LE 62
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1


root@ubuntu:/home/ubuntu# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 297.99 GB / not usable 20.87 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 9535
Free PE 4673
Allocated PE 4862
PV UUID ZH1clJ-pqce-pCuc-x3Gi-his2-y61i-nHeNJ0

root@ubuntu:/home/ubuntu# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 297.97 GB
PE Size 32.00 MB
Total PE 9535
Alloc PE / Size 4862 / 151.94 GB
Free PE / Size 4673 / 146.03 GB
VG UUID vQUB9T-bnJH-Mcy9-0l7A-8DQZ-3LIL-3sxasj
 
Old 04-22-2010, 10:51 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
What is it you need to put on "an ordinary partition" that you couldn't put on a new Logical Volume (LV)?

Partitions have hard boundaries so once you do your original layout it is difficult to resize things because essentially you have to adjust all the partitions beyond the one you're changing to reflect the new setup then add your new partition beyond those.

LVs on the other hand can be resized, added or deleted without needing to worry about what other LVs are there already.

Default for RHEL and CentOS is to put /boot on a partition then allocate all the other space on first drive to VolGroup00 in another partition. However, during the install you have the opportunity to change that to anything you want.

Last edited by MensaWater; 04-22-2010 at 10:52 AM.
 
1 members found this post helpful.
Old 04-22-2010, 01:41 PM   #3
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Original Poster
Rep: Reputation: 15
thank You I know that basic stuff!
I forgot to mention the reason I want a normal partion is I want to install another linux distro and my disc space was 320 GB from start after fresh install from Centos it was 279 GB
Where did that about 40 GB space go?
I thought mayby LVM eat a lot of extra space!

Last edited by sysslack; 04-22-2010 at 01:43 PM.
 
Old 04-22-2010, 08:52 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
The cmds you need are pvmove, vgreduce eg
Code:
pvmove /dev/sda3         -- moves data off this partition to rest of LVM
vgreduce vg0 /dev/sda3   -- removes partition from VG
I recommend you read the relevant manpages first though.
 
1 members found this post helpful.
Old 05-06-2010, 02:17 AM   #5
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Thank You for your reply. Now I have made some trial and error in my test/lab environment and come to the conclusion
if I understood from everything I have read, that there is no way to convert a file system from a normal partion to an lvm partion without losing any data and the reverse also would be true!
Correct?
Well then my next question. How copy all the data from one normal root
partion to another LVM partion without losing data.
Would you prefer dd or tar or something else ?
 
Old 05-06-2010, 02:53 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by sysslack View Post
Well then my next question. How copy all the data from one normal root
partion to another LVM partion without losing data.
Would you prefer dd or tar or something else ?
Good answers on these pages http://linuxdevcenter.com/pub/a/linux/lpt/18_16.html http://linuxmafia.com/faq/VALinux-kb...ory-trees.html http://blog.bfccomputing.com/article...nix-filesystem. rsync has advantages over tar but tar is good enough unless the system is high availability.
 
1 members found this post helpful.
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM2 volume size / free space ,mismatch Grismar Linux - Newbie 4 09-28-2009 03:47 AM
Free space shown for VG is wrong LVM2 bug devkpict Linux - Newbie 10 06-11-2009 02:17 AM
how to partion free space in ubundu. venkatiitkgp Ubuntu 2 12-08-2005 02:05 AM
Formating free space: WinXP pro and RH9 dualboot with free space on 3rd drive Vermicious Linux - General 2 03-22-2004 05:10 AM
is windows extended partion free space visible to linux fdisk purplesky Linux - General 1 11-12-2002 07:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:54 AM.

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