Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a VM with only 10GB of disk size avaliable.
I have expanded the disk size to 120GB from the VM tools, however, I only see 10GB of space from within Linux.
I have everything already installed on this VM as I need it and would like ot expand the logical volume to the entire 120GB that's now avaliable to it without losing everything on the disk.
Do I need to use the 'lvextend' tool as described on this page?
Your good to go, you will need to create a new partition, /dev/sda3, use pvcreate to make it a physical volume, use vgextend to extend your volume group, then use lvextend to extend your logical volume.
Before I dive off into this, I'm getting the following notification:
Code:
[root@system~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help):
Not a big deal on that warning, just follow the steps.
Code:
fdisk /dev/sda
p
t
3
8e
w
As seems to be the case just about any time I touch Linux, it's never straight forward.
Code:
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024a62
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 1306 10382336 8e Linux LVM
Command (m for help): t
Partition number (1-4): 3
Partition 3 does not exist yet!
1) Do I need to be worried about the note: Partition 1 does not end on cylinder boundary.
2) No Partition 3...I don't think I missed a step, did I?
Yes, I usually use cfdisk so the commands were a bit out of order. The cylinder boundary error you can ignore as well. Plenty of info on google about it that explains why that happens.
So fdisk /dev/sda
n -- Create new partition
p -- make it a primary partition(you would want to make it an extended one if this was your 4th partition so you don't limit yourself)
3 - Set the partition number
Enter through to get the default sizes which should take up all the free space.
t - modify type
3 - select partition three
8e - make it a linux lvm type partition
w - write the partition
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
I rebooted the machine and was able to do everything else without error, until I reached resizing the filesystem:
Code:
[root@system ~]# resize2fs /dev/VolGroup00/LogVol01
resize2fs 1.41.12 (17-May-2010)
resize2fs: Bad magic number in super-block while trying to open /dev/VolGroup00/LogVol01
Couldn't find valid filesystem superblock.
I'm not sure where to go at this point. A quick search tells me it might be a different file system type?
Code:
[root@system ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 9.90 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 2534
Free PE 0
Allocated PE 2534
PV UUID RVurOl-tESz-BgZd-M3g1-6ny4-UQaL-L7Hc0s
--- Physical volume ---
PV Name /dev/sda3
VG Name VolGroup00
PV Size 110.00 GiB / not usable 3.99 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 28159
Free PE 2559
Allocated PE 25600
PV UUID mhwHl3-8Ni2-RCYT-TefS-1GU3-GYA1-5ctfjK
[root@system ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 119.89 GiB
PE Size 4.00 MiB
Total PE 30693
Alloc PE / Size 28134 / 109.90 GiB
Free PE / Size 2559 / 10.00 GiB
VG UUID ehy4a2-1hOw-VBqL-0TNL-i9JN-BJEh-ErOhwH
[root@system ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID x3ddq2-pUcu-u3JS-vUPQ-bNIj-XlzG-EhbT0Y
LV Write Access read/write
LV Status available
# open 1
LV Size 100.25 GiB
Current LE 25664
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID gD7mVs-PygF-XxPy-MM6m-zncd-g2nw-MxtQiM
LV Write Access read/write
LV Status available
# open 1
LV Size 9.65 GiB
Current LE 2470
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@system ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
ext4 9958240 9947624 0 100% /
tmpfs tmpfs 384396 0 384396 0% /dev/shm
/dev/sda1 ext2 99150 83574 10456 89% /boot
Thanks so much for your continued help. If you were local, I would buy you a beer...or two.
If that gives you an error then you will need to resize the filesystem off of a rescue CD, as you may get an error that you can't resize a file system that is mounted.
I think this was my fault as I told you do the lvextend on your 01 lv and not the 00 lv which doesnt appear to be in use or have a filesystem on it, it's was only 256MB before you added the other 100GB.
If that gives you an error then you will need to resize the filesystem off of a rescue CD, as you may get an error that you can't resize a file system that is mounted.
Do I just need to follow the same methods as you listed above?
Try running lvremove with the -f option, you're not going to break anything here..
Code:
lvremove -f /dev/VolGroup00/LogVol01
I did this and it returned the following
Code:
Can't remove open logical volume "LogVol01"
Quote:
If that doesn't work, add the -vvvv option and give us the output.
I ran the following:
Code:
lvremove -f /dev/VolGroup00/LogVol01 -vvvv
and a whole bunch of text populated the screen. Unfortunately, this is on a VM and I can't copy the text over (since i'm not able to putty in while it's running from the rescue cd).
Is there a particular part that you are looking for?
See if there are any processes that have a lock on it. You don't have it mounted, so it shouldn't be giving you this error. Did you see anything in the verbose output in regards to the cause of the error? I know the -vvvv gives you alot of output but it should tell us at what point it errors.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.