LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 08-31-2008, 12:03 PM   #1
ChairmanMeoww
LQ Newbie
 
Registered: Jul 2008
Posts: 5

Rep: Reputation: 0
LVM Partition Resizing


Hi guys...an old question I'm sure but having spent the last few hours searching the net and ending up no closer than when I started to achieving this I need help..

How do I go about resizing my Fedora 9 partition? Gparted, etc are out the window as it's a LVM partition and any other suggestions would be gratefully received.....

I've got 50 gb of free space I want to expand it into without losing my current data and no access to an external HDD to store the stuff on temporarily....anything else you want to know then just ask

Thanks for taking the time to read
 
Old 08-31-2008, 02:22 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Never used LVM because of things I never liked about it. But what would be easiest is create the remaining as a new LVM partition and then create the partitions within that and then you can merge the new partitions with existing partitions in the orginal LVM partition and increase size that way. I only know there is commands to do all this. As for thier names not sure. Search here for LVM commands.

Brian
 
Old 08-31-2008, 04:45 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,234

Rep: Reputation: 1019Reputation: 1019Reputation: 1019Reputation: 1019Reputation: 1019Reputation: 1019Reputation: 1019Reputation: 1019
I don't think there is a pvextend type command yet. Add the new space as a pv, add it to the vg, extend the lv, then resize the filesystem within the lv.
Seems sensible - but I don't use LVM either, so ... have a look at the LVM howto on tldp.org. Redhat used to have doco on things like this too.
 
Old 09-15-2008, 10:25 PM   #4
mpdavig
Member
 
Registered: May 2004
Location: Boston, MA
Distribution: Fedora
Posts: 30

Rep: Reputation: 19
Increase an existing LV

Taken from my LVM management notes. I had first used this when I imaged an 80GB drive to a 120GB drive and wanted to make use of the 40GB of free space.

1. fdisk /dev/sda then press p

Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1188     9438187+  8e  Linux LVM
2. Press d then 2 to remove the partition
3. Press n then primary p start cylinder 14 last cylinder 4865 to add the newly re-sized partition. WARNING: Make sure the old and new partition start at the same cylinder position, not doing so will destroy your data.
4. Press t partition 2 Hex code 8e
5. Press p

Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4865    38973690   8e  Linux LVM
6. Finally press w write table to disk and exit and reboot
7. Use vgdisplay, pvdisplay, or lvdisplay to show the current and later ending size of your LV
8. Run pvresize /dev/sda2 to expand the PV on /dev/sda2 after enlarging the partition with fdisk
9. You could also extend the volume group across disks and partitions: pvcreate /dev/hdb1; vgextend videovg /dev/hdb1; vgdisplay videovg. With this method use fdisk to create a new partition instead of recreating the original one. This is certainly safer since there is less risk to your existing data and it makes it easier to break up volume groups in the future.
10. Use vgdisplay to find the Free PE / Size

Code:
  --- Volume group ---
  VG Name               SystemVG
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               37.17 GB
  PE Size               4.00 MB
  Total PE              9515
  Alloc PE / Size       2176 / 8.50 GB
  Free  PE / Size       7339 / 28.67 GB
  VG UUID               Bl4LEQ-R70i-3Qse-9z1p-BRcK-ibd7-2aelYx
11. Use lvdisplay to display current logical volumes

Code:
  --- Logical volume ---
  LV Name                /dev/SystemVG/RootLV
  VG Name                SystemVG
  LV UUID                dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                8.00 GB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/SystemVG/SwapLV
  VG Name                SystemVG
  LV UUID                vSRWGx-zy8N-FrXK-3HP5-7pwW-F6SQ-IRJNeA
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                512.00 MB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1
12. lvextend -l +7339 /dev/SystemVG/RootLV (you can use the following to reduce again lvreduce -l -7339 /dev/SystemVG/RootLV)
13. lvdisplay /dev/SystemVG/RootLV to see the result

Code:
  --- Logical volume ---
  LV Name                /dev/SystemVG/RootLV
  VG Name                SystemVG
  LV UUID                dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                36.67 GB
  Current LE             9387
  Segments               2
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0
14. ext2online /dev/SystemVG/RootLV while the filesystem is mounted or to be safe use resize2fs /dev/SystemVG/RootLV while the filesystem is unmounted. Note: resize2fs may require running e2fsck -f /dev/SystemVG/RootLV first.
Note: I did not have much luck with this on SLES 10 x86_64 (ext2online) however with Fedora Core 5 x86 this worked first try without errors.
 
Old 09-19-2008, 08:59 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,000

Rep: Reputation: 302Reputation: 302Reputation: 302Reputation: 302
Quote:
Originally Posted by mpdavig View Post
1. fdisk /dev/sda
It is safer to use fdisk -u /dev/sda, or use the u command from within fdisk, to set the units to sectors instead of cylinders. If your partitions do not currently begin and end on cylinder boundaries telling fdisk that your resized partition needs to start at "cylinder 14" could be quite disastrous for your data! To help avoid potential problems, use fdisk with the smallest unit of measure it supports - a "sector". i.e., the -u option.
 
Old 09-28-2010, 12:06 AM   #6
RottenMutt
Member
 
Registered: Jul 2003
Location: dfw
Distribution: Latest Fedora Release
Posts: 186

Rep: Reputation: 30
Quote:
Originally Posted by mpdavig View Post
Taken from my LVM management notes. I had first used this when I imaged an 80GB drive to a 120GB drive and wanted to make use of the 40GB of free space.

1. fdisk /dev/sda then press p

Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1188     9438187+  8e  Linux LVM
2. Press d then 2 to remove the partition
3. Press n then primary p start cylinder 14 last cylinder 4865 to add the newly re-sized partition. WARNING: Make sure the old and new partition start at the same cylinder position, not doing so will destroy your data.
4. Press t partition 2 Hex code 8e
5. Press p

Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4865    38973690   8e  Linux LVM
6. Finally press w write table to disk and exit and reboot
7. Use vgdisplay, pvdisplay, or lvdisplay to show the current and later ending size of your LV
8. Run pvresize /dev/sda2 to expand the PV on /dev/sda2 after enlarging the partition with fdisk
9. You could also extend the volume group across disks and partitions: pvcreate /dev/hdb1; vgextend videovg /dev/hdb1; vgdisplay videovg. With this method use fdisk to create a new partition instead of recreating the original one. This is certainly safer since there is less risk to your existing data and it makes it easier to break up volume groups in the future.
10. Use vgdisplay to find the Free PE / Size

Code:
  --- Volume group ---
  VG Name               SystemVG
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               37.17 GB
  PE Size               4.00 MB
  Total PE              9515
  Alloc PE / Size       2176 / 8.50 GB
  Free  PE / Size       7339 / 28.67 GB
  VG UUID               Bl4LEQ-R70i-3Qse-9z1p-BRcK-ibd7-2aelYx
11. Use lvdisplay to display current logical volumes

Code:
  --- Logical volume ---
  LV Name                /dev/SystemVG/RootLV
  VG Name                SystemVG
  LV UUID                dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                8.00 GB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/SystemVG/SwapLV
  VG Name                SystemVG
  LV UUID                vSRWGx-zy8N-FrXK-3HP5-7pwW-F6SQ-IRJNeA
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                512.00 MB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1
12. lvextend -l +7339 /dev/SystemVG/RootLV (you can use the following to reduce again lvreduce -l -7339 /dev/SystemVG/RootLV)
13. lvdisplay /dev/SystemVG/RootLV to see the result

Code:
  --- Logical volume ---
  LV Name                /dev/SystemVG/RootLV
  VG Name                SystemVG
  LV UUID                dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                36.67 GB
  Current LE             9387
  Segments               2
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0
14. ext2online /dev/SystemVG/RootLV while the filesystem is mounted or to be safe use resize2fs /dev/SystemVG/RootLV while the filesystem is unmounted. Note: resize2fs may require running e2fsck -f /dev/SystemVG/RootLV first.
Note: I did not have much luck with this on SLES 10 x86_64 (ext2online) however with Fedora Core 5 x86 this worked first try without errors.
Wow, thanks mpdavig. i did one thru eight, with the exception on step 3 i had to enter a partition number (2 in my case) when creating the new larger partition. instead of 9 and on, i used the graphical LVM manager, and in volume groups i selected my root Logical Volume and selected edit at the bottom. in edit i selected "use remaining" and hit ok. done.
FC13
 
Old 06-16-2012, 06:00 AM   #7
Desert-Fox
LQ Newbie
 
Registered: Jun 2012
Location: Colombo
Posts: 1

Rep: Reputation: Disabled
Wink Excellent Steps. This works, I've tested

This is an excellent explanation to fulfill your requirement. I have tested this works fine. !caution! backup your data before proceed.

Quote:
Originally Posted by mpdavig View Post
Taken from my LVM management notes. I had first used this when I imaged an 80GB drive to a 120GB drive and wanted to make use of the 40GB of free space.

1. fdisk /dev/sda then press p

Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1188     9438187+  8e  Linux LVM
2. Press d then 2 to remove the partition
3. Press n then primary p start cylinder 14 last cylinder 4865 to add the newly re-sized partition. WARNING: Make sure the old and new partition start at the same cylinder position, not doing so will destroy your data.
4. Press t partition 2 Hex code 8e
5. Press p

Code:
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4865    38973690   8e  Linux LVM
6. Finally press w write table to disk and exit and reboot
7. Use vgdisplay, pvdisplay, or lvdisplay to show the current and later ending size of your LV
8. Run pvresize /dev/sda2 to expand the PV on /dev/sda2 after enlarging the partition with fdisk
9. You could also extend the volume group across disks and partitions: pvcreate /dev/hdb1; vgextend videovg /dev/hdb1; vgdisplay videovg. With this method use fdisk to create a new partition instead of recreating the original one. This is certainly safer since there is less risk to your existing data and it makes it easier to break up volume groups in the future.
10. Use vgdisplay to find the Free PE / Size

Code:
  --- Volume group ---
  VG Name               SystemVG
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               37.17 GB
  PE Size               4.00 MB
  Total PE              9515
  Alloc PE / Size       2176 / 8.50 GB
  Free  PE / Size       7339 / 28.67 GB
  VG UUID               Bl4LEQ-R70i-3Qse-9z1p-BRcK-ibd7-2aelYx
11. Use lvdisplay to display current logical volumes

Code:
  --- Logical volume ---
  LV Name                /dev/SystemVG/RootLV
  VG Name                SystemVG
  LV UUID                dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                8.00 GB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/SystemVG/SwapLV
  VG Name                SystemVG
  LV UUID                vSRWGx-zy8N-FrXK-3HP5-7pwW-F6SQ-IRJNeA
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                512.00 MB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1
12. lvextend -l +7339 /dev/SystemVG/RootLV (you can use the following to reduce again lvreduce -l -7339 /dev/SystemVG/RootLV)
13. lvdisplay /dev/SystemVG/RootLV to see the result

Code:
  --- Logical volume ---
  LV Name                /dev/SystemVG/RootLV
  VG Name                SystemVG
  LV UUID                dxB6Fs-6sQr-AaLg-1zQ6-Q1f9-AN6V-cbSovF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                36.67 GB
  Current LE             9387
  Segments               2
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0
14. ext2online /dev/SystemVG/RootLV while the filesystem is mounted or to be safe use resize2fs /dev/SystemVG/RootLV while the filesystem is unmounted. Note: resize2fs may require running e2fsck -f /dev/SystemVG/RootLV first.
Note: I did not have much luck with this on SLES 10 x86_64 (ext2online) however with Fedora Core 5 x86 this worked first try without errors.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LVM: Resizing the root partition fulat2k Linux - General 6 01-08-2012 04:35 PM
Resizing Centos (ext3/LVM) partition alexpacio Linux - Software 6 08-11-2007 01:39 AM
resizing non-LVM partition laggerific Linux - Software 1 11-09-2006 06:20 PM
Resizing / with LVM zivota Red Hat 2 07-12-2006 03:30 PM
Resizing an ext3 LVM Partition PenguinPwrdBox Linux - Software 1 09-04-2005 02:34 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration