Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
LVM Resizing Guide - Howto Resize Logical Volumes in Linux - Lvm, Resizing, Lvresize, Vgdisplay,
Username or e-mail Save Login Lost Login Information? | Need an account: Register
Home
My Profile
Knowledge Base
Downloads
Forums
About TCPDump
Linux Management
www.manageengine.com Monitor Linux Performance CPU, Disk Memory, Process. Download Now!
Home Knowledge Base Operating Systems Linux LVM Resizing Guide
search tcpdump... Search
New Additions
1. Configuring VMware vCenter with SQL Server 2. Red Hat Enterprise Linux Kernel Upgrade 3. How Do I: Import Text Files with SQL Server Integration Services? 4. How Do I: Using the HierarchyID Data Type in SQL Server 2008 to manage data hierarchies?
Article Index LVM Resizing Guide Grow File System Shrink File System All Pages
Forum Activity
cheap vogue cigare... Author: Cogterrit Dec.04.12 viceroy cigarettes... Author: Cogterrit Dec.04.12 silk cut online Author: Cogterrit Dec.03.12 buy silk cut Author: Cogterrit Dec.03.12 buy salem cigarett... Author: Cogterrit Dec.03.12 buy mild seven cig... Author: Cogterrit Dec.02.12
Online Stats
Guests Online: 77 Members Online: 0
Note: The disk free command shows that we have 65MB available on our file system and that its 98% use. If we don't take action soon, we risk filling the file system. 2. Let's find out which Volume Group contains the Logical Volume that holds /dev/mapper/TCPDumpVolGRPTCPDumpLV [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV
www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html
1/7
02/01/2013
LVM Resizing Guide - Howto Resize Logical Volumes in Linux - Lvm, Resizing, Lvresize, Vgdisplay,
[root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV --- Logical volume --LV Name VG Name LV UUID LV Write Access LV Status # open LV Size Current LE Segments Allocation Read ahead sectors - currently set to Block device /dev/TCPDumpVolGRP/TCPDumpLV TCPDumpVolGRP hYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF read/write available 1 3.12 GB 100 1 inherit auto 256 253:5
Note: You can see the volume group for this file system is TCPDumpVolGRP 3. Let's find out if the volume group TCPDumpVolGRP has available free space to allocate to the logical volume [root@Linux01 ~]# vgdisplay TCPDumpVolGRP --- Volume group --VG Name System ID Format Metadata Areas Metadata Sequence No VG Access VG Status MAX LV Cur LV Open LV Max PV Cur PV Act PV VG Size PE Size Total PE Alloc PE / Size Free PE / Size VG UUID lvm2 3 5 read/write resizable 0 2 2 0 3 3 11.91 GB 32.00 MB 381 228 / 7.12 GB 153 / 4.78 GB 9fWFIS-vDlg-xOW6-Xmb8-Tkrg-GPZw-ZnUZwh TCPDumpVolGRP
Note: This volume group has plenty of free space. If we were out of physical extents, we would have to add additional physical volumes to this volume group before continuing on. 4. We will now resize the logical volume TCPDumpLV by adding 3GB [root@Linux01 TCPDumpLV]# lvresize -L +3GB /dev/TCPDumpVolGRP/TCPDumpLV Extending logical volume TCPDumpLV to 6.12 GB Logical volume TCPDumpLV successfully resized [root@Linux01 TCPDumpLV]# 5. Confirm the new size of the logical volume [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV --- Logical volume --LV Name VG Name LV UUID LV Write Access LV Status # open LV Size Current LE Segments Allocation Read ahead sectors - currently set to Block device /dev/TCPDumpVolGRP/TCPDumpLV TCPDumpVolGRP hYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF read/write available 1 6.12 GB 196 2 inherit auto 256 253:5
www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html
2/7
02/01/2013
LVM Resizing Guide - Howto Resize Logical Volumes in Linux - Lvm, Resizing, Lvresize, Vgdisplay,
Block device 253:5
[root@Linux01 ~]# pwd /TCPDumpLV [root@Linux01 TCPDumpLV]# df -kh . Filesystem /dev/mapper/TCPDumpVolGRP-TCPDumpLV Size 3.1G Used 2.9G Avail 69M Use% 98% Mounted on /TCPDumpLV
Note: You will notice that although we have increased the size of the logical volume, the size of the file system has been unaffected. 6. We now need to resize the ext3 file system to utilize the remaining available space within the logical volume [root@Linux01 TCPDumpLV]# resize2fs -p /dev/mapper/TCPDumpVolGRP-TCPDumpLV
resize2fs 1.39 (29-May-2006) Filesystem at /dev/mapper/TCPDumpVolGRP-TCPDumpLV is mounted on /TCPDumpLV; on-line resizing required Performing an on-line resize of /dev/mapper/TCPDumpVolGRP-TCPDumpLV to 1605632 (4k) blocks. The filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV is now 1605632 blocks long.
[root@Linux01 TCPDumpLV]# df -kh . Filesystem /dev/mapper/TCPDumpVolGRP-TCPDumpLV Size 6.1G Used 2.9G Avail 2.9G Use% 50% Mounted on /TCPDumpLV
Nice work, you just resized your file system while it was online! Now lets take a look at reducing the size of a file system.
Note: The disk free command shows that we are using 922MB and have 4.9G available on our file system. Therefore, we can safely shrink the volume to 1.5G (leaving a little bit for overhead) without any issue. 2. Unmount the file system [root@Linux01 TCPDumpLV]# cd / [root@Linux01 /]# umount /TCPDumpLV 3. Check the file system for errors [root@Linux01 /]# e2fsck -f /dev/mapper/TCPDumpVolGRP-TCPDumpLV e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity
www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html
3/7
02/01/2013
LVM Resizing Guide - Howto Resize Logical Volumes in Linux - Lvm, Resizing, Lvresize, Vgdisplay,
Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/TCPDumpVolGRP-TCPDumpLV: 13/802816 files (7.7% non-contiguous), 261017/1605632 blocks [root@Linux01 /]# 4. Shrink the file system to 1.5GB [root@Linux01 /]# resize2fs /dev/mapper/TCPDumpVolGRP-TCPDumpLV 1500M resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV to 384000 (4k) blocks. The filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV is now 384000 blocks long. [root@Linux01 /]# 5. Shrink the logical file system to 1.5GB [root@Linux01 /]# lvresize -L 1.5G /dev/TCPDumpVolGRP/TCPDumpLV WARNING: Reducing active logical volume to 1.50 GB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce TCPDumpLV? [y/n]: y Reducing logical volume TCPDumpLV to 1.50 GB Logical volume TCPDumpLV successfully resized [root@Linux01 /]# Note: Special precaution should be taken with this step. It's possible to reduce the logical volume size by more than the size of the file system. If you do reduce the LV size by more than what you resized the file system to (from step #4), this will almost certainly end very badly for you. Ensure the LV is large enough for the file system and that you make a backup before hand! 6. Verify the new size of the logical volume [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV --- Logical volume --LV Name VG Name LV UUID LV Write Access LV Status # open LV Size Current LE Segments Allocation Read ahead sectors - currently set to Block device /dev/TCPDumpVolGRP/TCPDumpLV TCPDumpVolGRP hYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF read/write available 0 1.50 GB 48 1 inherit auto 256 253:5
7. Remount the file system and verify the new size [root@Linux01 /]# mount /dev/TCPDumpVolGRP/TCPDumpLV [root@Linux01 /]# cd /TCPDumpLV/ [root@Linux01 TCPDumpLV]# df -kh . Filesystem /dev/mapper/TCPDumpVolGRP-TCPDumpLV Size 1.5G Used Avail Use% 65% Mounted on /TCPDumpLV 920M 497M
Nice work, you've just resized your LV and it's file systems! Next up, LVM snapshots! Add this page to your favorite website
COMMENTS
<< Begin < Prev 1 2 3 Next > End >>
PAPI
A dd New
Search
28/11/2009 10:49:12
www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html
JAY
07/12/2009 00:57:36
4/7
02/01/2013
LVM Resizing Guide - Howto Resize Logical Volumes in Linux - Lvm, Resizing, Lvresize, Vgdisplay,
JAY
07/12/2009 00:57:36
great write up. Would also like to know if there's a way to grow the LV to the maximum available without counting it manually and leaving slack. Reply | Quote
THIRT
14/12/2009 03:20:22
That should use up all the remaining free space available in the volume group.
Hope that helps, Tom Reply | Quote JEAN RESIZE DYNAMIC DISK
14/07/2010 04:33:07
you can expand the dynamic volume. visit the web page to get more information.--http://www.dynamic-disk.com/resource/resize-dynamic-diskpartition-volume.html Reply | Quote SLIPPERY Many thanks indeed for helping out a Windows guru but Linux amateur. Steve Reply | Quote
NICOBO
21/01/2010 08:35:30
06/02/2010 11:20:52
Thanks for this 'quickstart' tutorial. I have two remarks : 1. I've found better to use 'lvresize -l' for growing the volume because 'lvresize -L' rounds the given size and therefore does not always end up in what you're expecting 2. In your example I find it a bit confusing to use a size in MB to resize the partition and then a (the same) size in GB to resize the volume. It probably worked for you but I'm not sure it will for everybody (?). Reply | Quote
LAZYMATHSTUDENT
18/05/2010 10:07:44
just look at how much space vgdisplay reports in "Free PE / Size". The correct size is A = PE*4MB, which gives lvresize -L +A /dev/mapper/cpool-bla Reply | Quote A LEX Thanks for this article it helped me a lot. Reply | Quote NARE Thnx for this tutorial Reply | Quote BRAVO Wow, what a great and straight forward step by step guide My gratitude for the writer Reply | Quote MXA |
21/01/2011 08:55:55
18/10/2010 15:16:45
24/11/2010 10:08:01
21/01/2011 07:37:01
www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html
5/7
02/01/2013
LVM Resizing Guide - Howto Resize Logical Volumes in Linux - Lvm, Resizing, Lvresize, Vgdisplay,
FOOBAR - 1000MB
VS
1024MB
06/04/2011 11:07:39
In steps 4 & 5, it looks like you reduce the file system more than you reduce the size of the logical volume. The file system is 1500MB vs 1536 MB (1.5GB) for the volume. Was this intentional to prevent resizing the volume too small? Or do either resize2fs or lvresize use mebibytes instead of megabytes? Thanks. Reply | Quote A NONYMOUS Great stuff buddy!! Reply | Quote BK - GREAT JOB! |
02/06/2011 18:43:24
29/04/2011 04:27:39
Thanks to your LVM refresher course in one URL, I was able to remember how LVM functionality actually works, and wrote some documentation for our staff. It's rough, but I felt I should give back given the excellent documentation you've written. EXPANDING LOGICAL VOLUMES ON A LINUX VM INSTANCE First, down the server you want to add space to. From the VM Console, add more virtual disk with more space than you need. You do NOT want to do this many times, as Logical Volumes (LVM2) have limits. Bring the VM Instance back online, and login as root. Next, we need to join the virtual disk free space to the virtual disk itself. #fdisk /dev/sda (dev/sda is pseudo-physical disk drive for the VM instance) M (to print whole list of options.) P (to print out the existing partitions) N (to create new partition, then choose a partition type p in this case.) Choose a partition # - one that is not in use, say 3 or 4. Let the system choose start points, and to end of disk. P (print it again, and see what you have created.) L (to label the partition) W (Write it to the disk) Q (Quit. Youve made space, now to join it to the Volume Group.) Connect to the website below. This is where the real work begins. Read through this section once, noting where the PINK/RED highlights are. They provide the information to use in the next instructional steps! (Your work above fixes problems in Item #3, when vgdisplay does not have free PE.) http://www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html Useful command: lvresize -l +100%FREE /dev/mapper/VolGroup00-LogVol00 Instead of just resizing by adding 3GB (in the instructions) this one says to use all free space in the volume group for this partition. This is a last step instruction to make the change. I highly recommend to reboot and confirm your new partition sizes actually worked. Reply | Quote A SKAR - NICE WORK For for the nice work, using these small ariticles i'm learning about LVM Reply | Quote JAKE T ORS |
13/07/2011 07:56:53
23/06/2011 06:44:09
just wondering where you came up with df -kh. You are asking to display in both kilobytes and human readable format at the same time. just use df -h my friend, df -h. same result. Reply | Quote GENE RYE - T RYING TO
UMOUNT THE DRIVE
20/07/2011 10:26:59
When I try to umount the drive to resize the partion smaller, I get a device busy message. root ~ puts me in my /root directory. When I df -kh the system, I get /dev/mapper/VolGroup00-LogVol00. Folloiwng Step 2, I cd /, and then umount /dev/VolGroup00/LogVol00. Get message device busy. What should I do? thanks Reply | Quote GENE RYE - MORE INFO |
20/07/2011 10:43:57
I was trying to do this through the desktop. Should this be done through the command line interface? Reply | Quote Write comment
www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html
6/7
02/01/2013
LVM Resizing Guide - Howto Resize Logical Volumes in Linux - Lvm, Resizing, Lvresize, Vgdisplay,
Write comment Name: Email: Website: Title: UBBCode:
-color-size-
Send
Please input the anti-spam code that you can read in the image.
2 Last Updated on Tuesday, 02 June 2009 10:19
www.tcpdump.com/kb/os/linux/lvm-resizing-guide/all-pages.html
7/7