How To Extend LVM Disk For Linux Virtual Machine On VMware
HTML-код
- Опубликовано: 19 окт 2024
- In this video I explain how to increase disk space in Linux with LVM by first expanding the hard disk, creating a new partition, expanding the volume group and logical volume and then resizing the file system.
This video guide covers an existing (and more detailed) blog post I created which can be found here: www.rootusers.c...
Alternatively, you can also instead add a new disk rather than expand the existing disk as shown in this video by following these steps: www.rootusers.c...
-- Follow me here --
Twitter - / jarrodstech
Google+ - plus.google.co...
I know you created this in 2015 but I have used this today and am very grateful for your contribution to the world.
Checking in in 2024 - our Linux guy left so I got signed up to be the new Linux person. One of our RHEL 7 boxes had TWO 100% full volumes and these steps were exactly what I needed! Thanks!
Very well presented. There are a lot of partial threads on this topic with very poor explanations. Your discussion during the video presents the material in a way that is logical and easy to understand. Thank you for taking the time to produce this.
Thanks! Glad to hear it.
Concur 100%. I am subscribing to this channel.
Nobody else on the internet has been able to explain this as clearly as you have done. Worked in 2022 for my Ubuntu vm. Thanks!
Good to know!
Wow, I'm learning RHEL 8 on vmware workstation and while doing a lab today I run out of space as I started with 20 GB and wanted to expand to 30 GB. This video is exactly what I needed. Grateful for your great explanation & detailed steps.
Thanks, Jarrod! Such a great video. I'm not good at all to remember all the steps, so I always return to this video when I have to extend an LV.
You rock man!
This is a really good tutorial. I've been using LVM for some time and never had any issues until this weekend and whilst your tutorial doesn't touch on the error presented it did help me identify a way around doing what I wanted to do. Thank you.
Thanks, glad to hear it helped :)
well done. For anyone who ran into issue with last step. if you used xfs_growfs /dev/xx/root and got an error "root is not a mounted XFS filesystem". use "xfs_growfs /" and it works for my case.
That was a very clear and concise explanation on how to increase disk space, excellent tutorial, well done!
Pure gold here! This was precisely what I needed to resize a RHEL YUM server /var. I owe you a pint, mate!
Happy to help!
Life saver !! Thank you very much! I'm a beginner to CentOS and had to recover a Zimbra server that crashed due to insufficient disk space. Your guide saved me from hours of downtime!
Glad to hear it!
Awesome. Let me share one thing that helped me. First your instructions were perfectly clear, I followed it step by step... When I got to the final step of resizing the filespace with resize2fs I got this error "Bad magic number in super-block..." My heart sank, then I listened to your last few sentences, "if you have a XFS filesystem use xfs_growfs", that did the trick. It made me appreciate hearing these tutorials to the very end. FYI: tip to others: to verify filesystem Type use "df -Th".
Thanks again Jarrod.
No problem at all, cheers!
You literally saved my life. One of my projects required a specific OVA to be used, but its free space was too small for my use. Subscribed.
Very helpful. Thank you for not playing any crappy music in the background and speaking clearly as you presented.
Haha thanks, yeah it's really annoying when tutorial videos do that!
Worked like a charme. The system I used this on only had version 1.2.5 of fstab available. This version is not using sectors but cylinders instead. It also does not give you default values for the new partition and where it starts or ends. There was some trial and error involved but once I got it figured out the rest of your tutorial worked. Thanks for putting this up.
Oh interesting, good to hear you got it working in the end 👍 cheers!
This is a great video, I am using CentOS 7 and I had some issues expanding the logical volume; however, this video got me on the right track and would highly recommend.
Note: Love that you specified the different CentOS versions using different expanding commands "2fs vs xfs".
Update, I had an issue with the lvextend -L command, but once I got that squared away I was able to expand my drive.
Hey thanks, that's really good to hear!
I cheked so many online doc and videos, and this was by far the simpliest step by step video to follow. Ive never resized the hard drive and like many its a very stressful task to try to accomplish, especially when all the data is at risk. This guide was the best way since it created a new disk outside of the currently used one. Even with the ending of the two options for a newer system, Great video very much appreciated i only had 1% space left in a 5K daily visted website....
Super helpful video. I did an Arch install recently and needed more space on my home partition. Worked like a charm.
I have had this video saved on my browser since 2019 , this is the best explanation I found out of 20 different videos I searched online kudo mate for creating this
5 years ago and still the best video regarding this topic
in the lvextend command, if you add a -r parameter in the line, it will automatically resize the filesystem. for example $lvextend -L+5G -r /dev/centos/root. this way you skip the last step of your video. Thank you so much, your video saved me some good research time. +1
Cheers! Yeah that works too :) I figured it'd be better to explain it separately rather than the the option and potentially confuse the two things that are happening.
2024, still works. Thank you Jarrod.
i tried to find your first video, it is really good, and your presentation skills are improving super a lot nowaday, I love to learn the way you presenting somthing. Really awesome
👍
The video is super dope, the explaination is very clear. Way better than those half written instruction online.
Thank you. Very much appreciated seeing this done, especially the extra notes you made on CentOS 7.
No problem, glad it helped!
This tutorial was a lifesaver, thanks so much. Nice and clear.
Can't thank you enough. Still a great and comprehensive video after 7 years. It worked like a charm wrt proxmox VM.
Thank you very much ! Spent a couple of hours trying to figure it out till I found this video. Awesome. Please make more!
+Joe Kim No problem happy to help! Do you have any specific examples of things you'd like me to cover? If so let me know and I can take a look!
Thanks for the video man! Very helpful. In case anyone has any issues at the pvcreate with "Device /dev/sdxx not found" (xx is the letter and number of your partition) , run
partprobe
partprobe /dev/sdxx before doing the pvcreate and that will help. So actually you are making a manual kernel update.
Cheers!
I've been trying to do this for weeks. If only I found your video at the start
Thank you so much.
+Aaron Kinchen No problem, good to hear :)
Outstanding!!! I checked and got amazed and saddened to see only one linux video on your channel.
Just to add users can run df -Th to see the file system type to check xfs or ext4 :)
I used to be a system administrator, so originally planned on doing more Linux videos early on but I seem to have diverted towards laptop reviews 😛
Ive done this about 5-6 times now. I have to watch this video every time I do it. You think I would learn.
I always refer to it when I need it too, to make sure I'm doing it right.
Great job on explaining things, hands down a life saver video found after 3 days of searching for this info!
Thank you! Still relevant and helpful! Your blog post also helped me be sure to get all the steps just right. I did run it against a test server first just for confidence but it worked as advertised!
We all know this video is 8 Years Old but helped me today
Thanks Friend
Great to hear!
0:00 A legend was born!
Come on man! you just made the best video about partition extending. congrats! all my respect to your content.
Thanks, I got sick of there being no good guides every time I had to do it haha
thanks for the video, you clearly explained the differences between vg lg etcs and actually going thru in details. very educational video, thanks for the effort
Thanks!
Very useful video, with clear explanation and good examples. I've tried multiple articles before but they were quite confusing. This is super easy to follow ! Thanks a lot
Glad it was helpful!
1 year later and I still find myself going back to this video each time I have to resize a virtual drive !
8 years ago. Used this today on RHEL 8 and worked fine!
Really great video tutorial on extending root volume group, MUCH APPRECIATED!!!
No problem, cheers!
Thank you. Very much appreciated seeing this done, especially the extra notes you made on the latest CentOS.
Glad it was helpful!
Thank you 🙏 I’ve been trying to find a video of this today and this is very helpful since I’m taking class and it just happened today.
Glad it was helpful!
Awesome tutorial. Clear and concise! Thank you for taking the time to post this.
No problem, cheers!
That was exactly what I was looking for. You made me save a lot of time! Thanks Jarrod'sTech!
+Neutro No problem, happy to hear that it helped you out!
Thank you for creating this video. It was exactly what I needed!
DUDE. THIS IS THE BEST VIDEO I'VE SEEN ON THIS! THANKS SO MUCH. YOU ARE THE MAN! You've earned a SUB!
Glad it helped!
The First masterpiece video by Jarrod'sTech 😝👍👍👍
Clear, concise and to the point.
Appreciate this video, came across a few others but yours was the best!
Very well done video, explains everything perfectly. You should do more of these. /subscribes
It's nice to see how far you have come!
Haha yeah this is an old video I made for my website
Thank you very much for this video. Saved me heaps of time and was very easy to understand and follow.
No problem, good to hear it was useful :)
This has been very helpful to this day. Thank you!
Great video just used this to resize a Debian 12 template on XCP-ng
Are you flipping kidding me??? Thank you for this guide. I'm NOT a linux expert and had to expand a disk. My gosh, I LOVE WINDOWS SERVER. Expanding a disk takes freaking seconds.
No problem!
So during my work I use a laptop like 90% of the time, but now I can work from home which is awesome, can use a normal workstation. To be frank the machine was running nothing, had inside 6HDD 2x500GB and 4x320GB. Was using only one to run Fedora22 the rest is so empty it doesn't even have file system... UNTIL NOW. Was just goofing around and ran into your vid and you explain so well and it is so easy I had to do this finally!
Now the df -h:
[apinter@AuroraFedora~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 8.5M 3.9G 1% /dev/shm
tmpfs 3.9G 1.9M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/fedora_aurorafedora-root 168G 10G 150G 7% /
tmpfs 3.9G 424K 3.9G 1% /tmp
/dev/sda1 477M 161M 287M 36% /boot
/dev/mapper/fedora_aurorafedora-home 1.9T 45G 1.8T 3% /home
tmpfs 795M 80K 795M 1% /run/user/1000
tmpfs 795M 12K 795M 1% /run/user/42
Curious to see how this will affect the performance.
Keep it up mate!
Subscribed!
Attila Pintér Hey that's really great to hear! I'd be interested in the performance too let me know!
+Jarrod'sTech Oh wow, forgot to get back, sorry mate. It's actually not bad, not bad at all, will do something similar out of SSDs next time. Here, check the bonnie++ output: echo "1.97,1.97,LasNoches,1,1450165176,23832M,,,,69899,26,28360,18,,,73159,17,45.6,4,,,,,,,,,,,,,,,,,,,1511ms,5072ms,,271ms,2533ms,,,,,," | bon_csv2html > ~/bonnie_out.html
EDIT
Actually next time I reinstall this system will create a striped LVM instead of a linear one, that should be better.
+Attila Pintér Cool, haven't noticed any issues myself on servers that I've done this on.
Thank you so much.. I was doing this on ubuntu, so had to make a few changes to some of the default container numbers. but what a solid tutorial. cudos sir.
No problem, good to hear that it helped.
why this program question to wipe data while add another phisical volume to existent volume group?
Great video! Helped in expanding all my disks!
Glad to hear!
This video was very helpful, thank you for the easy to follow/logical steps
Glad it was helpful!
Awesome, concise, perfect tutorial! Thank you❤
Thank you man! This really helped out!
Two notices:
1. When I tried to lvextend to 10G at once it failed with message that 1 block is missing. So I extended to 9G and then extended again to 1020M more.
2. extend2fs failed (as you predicted) but xfs_growfs worked ok
Thanks again!
No problem!
8 years old and still teaching clowns like me! Thank you sir!
Super, after a lot struggle I am able to complete it, thanks for the video, it was really really helpfull
pradeep nayak Thanks for the feed back, glad it helped!
Great Video - You saved me a ton of time. Thank you very much!
Hi Jarrod - First, let me say thank you. You got me out of a snafu today where I had to do this on a snowflake VM that didn't like our resize scripts. As others have said, it works right the first time, follow your steps. Many thanks! So if I wanted to increase by full amount available, or "Use all free space available," as you mention at 11:40 in the vid.. Can you purty-please supply the command for that? I think you put it below in a comment, "lvextend /dev/centos/root -l+100%FREE" - is that it, all inside my quotes? Thanks again, Sir. +1 subscriber :)
No problem, yes that lvextend with the -l +100%FREE will use all of the remaining extents in the volume group for the logical volume that you specify.
Thank you Jarrod! This video explain all that I needed. Congratulation!!!!
No problem, happy to help!
Thank you, you have saved my life.
Thank you so much. Such a clear straight-forward tutorial and explanation!
No problem at all!
Thank you! Very nice video. I decided to use -l instead of -L, and did: lvresize -l +100%FREE /dev/test-disk/root worked like a charm.
No problem!
Thank you for the tutorial, very clear and well explained!
Perfect video. Thx from Brazil.
Thank you..! Worked perfectly on CentOS 7.
Awesome :)
and so a legend was born....
thank you so much finally all makes sense to me now thanks to your tutorial, clear and very simple to understand. Legend!
doofdoof doof Hey thanks for the feedback, great to hear!
Sir! You have saved my life with this video. Thank you very mutch! :-)
No problem! Cheers.
Good guide, nice and clear on the instructions.
I would recommend to resize the lvm volume by deleting the partition and recreating it with the new size (you will not loose your data). After this step you can resize the physical volume and the last step is to extend the logical volume. This way you can do this as often as you like because there will always be only one primary partition
Awesome video. I followed it step by step, worked perfectly. Many thanks!
Thanks! No problem :)
xfs_growfs instead of resize2fs in the end for centos 7 users. Great tutorial!
Thanks, yeah I updated the written post for that in the description, not sure if it made it into this video though if I used 6.
This is a great video, very well detailed. Question, I've already run through this video a few times over the last few months. Unfortunately I now have 4 SDA partitions and now need to add more space. If I delete the last SDA in order to make an extended partition won't I lose data? What's the best way to handle it. I've got similar setup as your VM with Centos 7, expanded outside of the OS, now I just need to make use of the additional space.
Yeah you can only have 4 primary partitions with MBR, if I recall you can have more if you format with GPT. As for fixing this though, yes I believe you'd need to make the last partition extended, I think doing this the normal way will result in data loss, so definitely worth taking a copy of the data before removing the partition. I have done it before without data loss, but it is very risky. Basically if you use fdisk on the partition and delete it with 'd' you only delete the partition, the raw data should still be intact, if you create a new partition on the same space the data should still be there. I did this once about 5 years ago, and wrote a blog post on it but never published it because decided it was too risky and I didn't fully understand it, really is a last resort kind of deal I think.
First ever vid from our boi Jarrod
Very nice and detailed video, but I got a question - instead of adding a new partition to /dev/sda, why not just resize /dev/sda2.
In my case, when I extend the hard drive in VMWare, I resize my /dev/sda2 partition and then resize the logical volumes as necessary, like so:
# fdisk /dev/sda
> d
(delete a partition)
> 2
(deleting partition #2, ie /dev/sda2)
> n
(create new partition)
> p
(creating primary partition)
> 2
(creating partition #2, ie. /dev/sda2)
> (default first sector)
> (default last sector, taking all the available space)
> w (save)
# reboot (to load new partition table)
# pvresize /dev/sda2 (to get free space available)
# lvextend -L +2g /dev/centos/root (resize root volume)
# lvextend -L +5g /dev/centos/home (resize home volume)
# xfs_growfs /dev/mapper/centos-root
(growing root volume filesystem)
# xfs_growfs /dev/mapper/centos-home
(growing home volume filesystem)
Done! Now I got +2Gb in my root volume, and +5Gb in my home volume and no extra primary partitions.
You can do it that way, I think the goal of this method (hard to remember this is an old video) was to be able to do it without needing to reboot/remove the existing stuff, no down time basically.
concept explained, task executed wonderful ..
Hi, Jarrod, thanks for your video!
Thank you for your well presented and guided tutorial! Worked perfectly!
No problem at all, good to hear!
0:00 a legend of a laptop reviewer was born
haha
Many thanks - exceptionally helpful video!
+Robin Walker Cheers, good to hear it helped you out :)
thank you so much , this has been exactly what i was looking for , and it was of great help .
+elhass toress Great to hear!
Thank you! Still current and very helpful.
Glad it helped!
Thanks for this detailed explanation. This helped me to.
YOU MY GOOD SIR ARE A LEGEND!!! THANK YOU VERY MUCH FOR THIS VIDEO. MUCH APPRECIATED
It's fantastic guide for Server machines and CLI but for GUI look no further than Gparted.
I agree, I use gparted if I'm dealing with Linux native partitions rather than LVM.
Fantastic, I have followed and succeeded.
Fantastic!
Great work!!! Very helpful/thorough
Thanks for the feedback!
Wonderful Guide, much appreciated
Hey dude tnx for telling me that guy stole your video.
I subbed to your channel now :)
Thanks!
Thank you so much ... you saved me a lot of time :) worked perfectly for me ...
+muhammad tayyab shahzad No problem, good to hear it helped you out!
Thanks man, this video helped me a lot.
Man, Thank You for the tutorial.
+Ken Harvey you're welcome!