lvm
Renaming a Logical Volume (how to rename)
Today I was asked to rename a logical volume (something I hadn’t done before, but figured it was quite easy). Here’s what I ran:
lvm help
Which showed me the option of:
lvrename Rename a logical volume
Ah.. I thought to myself, this should be easy enough. So I did a quick poke at the man pages of lvmrename which netted me
lvrename [-A|--autobackup {y|n}] [-d|--debug] [-f|--force] [-h|--help] [-t|--test] [-v|--verbose] [--version]
VolumeGroupName OldLogicalVolumeName NewLogicalVolumeName
note: ugggg sorry for the formatting.. thank you wordpress.
So off I went, and here’s what I did:
sudo umount /mountpoint
sudo lvrename /dev/volgroupname/lgvold /dev/volgroupname/lgvnew
sudo vi /etc/fstab
fixed the required fstab settings
sudo mount -a (or you can mount each one individually, but in my situation I was able to just run umouna -a).
That’s it. Simple as that.
If you do happen to rename while mounted you’ll not be able to unmount. In that case just change to the new location in fstab and bounce the box (yes, that’s the easiest way.. sinec the device will keep showing busy, even though lsof and everything reports it shouldn’t be).
That’s it.. hope someone finds this helpful.
Resizing Logical Volume (LVM) on ext3
I’ve recieved a few emails from people asking “How can I resize an LVM (proper term would be resizing a Logical Volume) on their system”.
In this posting i’ll touch on only ext3 since that’s the default fs. Later, I’ll touch others if it’s requested.
There are a few steps you have to take to resize a partition. First, you have to resize the filesystem (be sure to do this before you reduce the lv, as that could cause data loss).
In this instance i’ll be resizing a mount location at /app. If you want to shrink the /home partition make sure you go into runlvl 3 (sudo init 3) and get out of the /home directory (cd /).
To resize the filesystem lets unmount it by running:
sudo umount /apps
First run a check on the file system:
sudo fs2chk -f /dev/volumegroup/logicalvolume
note: you can find the volume group name, or logical volume name you can use vgscan and lvscan (both are located in /sbin/)
Now lets resize the ext3 partition:
sudo resize2fs /dev/volumegroup/logicalvolume 10G
note: 10G is the NEW size that you want it to be
Once those are completed, you can finally resize the Logical Volume (isn’t this what we wanted in the first place?), to do this do:
sudo lvreduce -L 10G /dev/volumegroup/logicalvolume
note: Use the same output you defined in the resize2fs command.
Lets remount our partition and jump for joy:
sudo mount /dev/volumegroup/logicalvolume /app
note: If this mount point is defined in /etc/fstab, you can remount via sudo mount -a (this will mount everything in /etc/fstab).
Bonus:
If you wanted this space for an existing logical volume, you can run lvextend -L XXG /dev/volumegroup/logicalvolume.
Note: XX is the space you took away from the other reduced partition.
Search
Powered by
Tags
10.3 11.0 11.1 apache bash beta bootchart codeweavers compiz drivers emerald emulation esx fat ass tomato man filesystems flash fonts gnome grub ibm kde kde4 kernel knoppix linux lotus notes lvm Microsoft nomad nvidia openoffice opensuse performance repositories review scripting security tech tutorial ubuntu user management VMWare windows wine workstationArchives
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- February 2008
- January 2008
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
Ben Kevan's Blog
- Connecting to Linux via RDP using NOMAD on openSUSE 11.1
- Red Hat (RHT) Profits Soar, is Novell (NOVL) Next?
- Dropping KDE 3.5 for openSUSE 11.2 isn’t really a bad thing
- 5 Days on openSUSE 11.1 was an early X-Mas present
- Unexpected Downtime
- Amarok 2.0 Final Released - Shipping with openSUSE 11.1
- PCLinuxOS 2009 Beta 2 - Review, Thoughts and Screenshots
- Opera 10.0 Alpha 1 on openSUSE 11.1 - Review
- Ding Dong the Emeralds Back Compiz
- 11.1 Build Service Repositories being Built