Shrinking physical volumes in LVM on a Linux Guest in ESXi 5.0

  • The problem:

      Linux guest (OpenSuse 12.1), with multiple virtual disks attached.

      3 disks are in a logical volume, two of which are exactly 2TB.

      None of the disks are independent, and due to the backup software we use, cannot be independent.

      When the two 2TB virtual disks are "dependent", the snapshot fails stating that the file is too large for the datastore. When I put those two disks in independent mode, snapshots work fine (the other disk is 1.8TB).

      I have therefore concluded that even shrinking the two physical disks by 100GB should solve the problem, however I am having trouble conceptualizing how to go about getting those disks smaller without breaking the LVM entirely.

      The actual LV has 1.3TB free, so there is plenty of space to shrink with.

      What I need to accomplish:

      Deallocate 100GB from the two, 2TB virtual disks within the linux guest.

      Shrink the two virtual disks by 100GB within vsphere (not as complicated).

      Are there any vsphere/LVM gurus that can give me a clue?

        Edit:

        Fixing formatting:

        Something like this? e2fsk -f /dev/VGroup1

        resize2fs /dev/VGroup1 5922108040K (that is a 200GB shrink in KB)

        lvreduce -L 209715200K /dev/Vgroup1 pvresize /dev/sdb1(and sdc1) --

        setphysicalvolumesize 2042625023K Correct?

        Another thought occurred to me: Maybe to play on the safe side I should reduce 25G more than I plan on reducing the disks, to ensure that the physical volumes aren't smaller than the filesystem.

      Answers(98)

      • @Colyn1337 This user is a troll; he's not actually trying to be elected. – Doorknob 2 days ago

      • This isn't a VMWare issue really, the issue with the 2TB vmdk's is that there's no space left on the datastore to commit to a snapshot, as you say dropping the size of the vmdk will allow that to work.

        Now obviously you can use the usual chain of umount, e2fsck, resize2fs, lvreduce and pvresize then reduce the vmdk size within the vsclient, but there's another thought, if you have enough temporary space you could just convert them to thin disks. Obviously there can be a write penalty for this but it'd mean you'd not have to touch your guest filesystem.

      • yeah, you'd get my vote also. – Sirex Nov 20 at 22:56

      • While I am tempted to think this is nothing more than a periodic troll, let's give you the benefit of the doubt. Could you elaborate on what bearing this statement has on anything to do with moderation (or Server Fault) for that matter: "I'll push for a bloody revolution to oust the oppressive overlords who cower behind intellectual property and closed source.". I will politely point out that the vast majority of the internet is run by "closed source" embedded systems called routers and firewalls. Aside from that, a bloody revolution is hardly motivating for my vote. – Mike Pennington Nov 20 at 10:55

      • generating the levels of straight-up vitriol that y'all do. I don't think that's true any more. Over the past several months there have been fewer "you guys are mean" complaints on meta and in comments. I think we have been closing crappy posts w/out engaging, and if SE has any suggestions on what else to do, I'm sure we'd all like to hear them... – Ward Nov 20 at 19:56

      • 14 votes is less than 1 a month so I'd say 'sparingly' was a good description of your whole (voting) record. – Iain Nov 19 at 18:26

      • Oh it's multi-extent? hmmm, not a big fan of doing that but yeah, I can see how that changes things, still at least you'll be able to follow that tool chain I mentioned. – Chopper3 Apr 15 '12 at 12:40

      • You got my vote! – Hrvoje Špoljar Nov 19 at 20:33

      • @MarkHenderson If wanting to answer good, well researched questions without having to wade through a sea of crap to find them is elitist then yeah that's me. – Iain yesterday

        • @EEAA Re: the rest of your question; The most experience I have here is upvoting when something appears to contribute to the conversation, and sparingly downvoting. I am a stickler for technical detail, and do my best to adhere to policies and practices set-forth by the other moderators. In all honestly, I think you would make a decent Moderator. You've been here for half a decade, and obviously have benefited from the site. – Signal15 Nov 19 at 18:18

        • First thing you should probably get your head around is that SE sites are not "forums", and expectations on mods here are much different than on forums. Second thing: please account for your complete lack of involvement in the site thus far. What tangible things can you point to that can help convince us to vote for you? Your meta/review/flagging history are non-existent. – EEAA Nov 18 at 20:53

            • For those who don't get the joke, this is one. review history tells all. – Andrew B Nov 17 at 21:03

            • Please, go to chat for all the name-calling and mud-wrestling business. – the-wabbit 2 days ago

            • And don't mind Shog9. He's said before that every question has been asked before anyway, and the logical end of that is just shutting the place down and walking away anyway. N00b for Quality Questions, not just Eyeballs and Clicks! – Magellan Nov 20 at 19:29

            • @EEAA I am not under the mistaken impression that the SE family of sites are forums, I simply stated that I have experience moderating other forums in the past. The expectations here are not radically different from what I've experienced and read-up on. – Signal15 Nov 18 at 22:02

            • Your answers on SF are thoughtful and insightful. I should hope ServerFault can find its balance. You would have my vote. – jscott Nov 20 at 18:59

            • Would you still be interested in moderating under these guidelines ? – Shane Madden ♦ 2 days ago

            • You've retired as a moderator in the past, what's changed since then? – Mark Henderson ♦ Nov 20 at 21:21

              • @Sirex, Thank you for taking the time to actually read my nomination. It's a pity that so few appear to have done so. – Iain 9 hours ago

              • I removed the comment and added it to an edit on the original question, better formatting. – Stew Apr 15 '12 at 13:03

                • I think you may have otherwise been an excellent choice, but I think you've got a tough contender above. – Evan Carroll Nov 17 at 20:53

                • With no meta participation, no flags, no reviews, and seemly relatively low moderation-related activity in general, I don't think you'd make a very good moderator. Maybe next time, though! – Doorknob 2 days ago

                • Why, he can do smileys, and mod-hammer stupid posts while he does smileys... – MadHatter Nov 20 at 16:29

                • Well it is crash consistent, but can loose recently written data not yet committed to journal. Any application that can recover from powerloss can recover from non-coordinated snapshots as well. This is especially true for transactional databases like Mysql InnoDB, as opposed to Mysql MyISAM which will burn data in that case. IIRC Mysql MyISAM will burn data even with frozen filesystem snaps, but not as badly. To backup Mysql MyISAM requires FLUSH TABLES WITH READ LOCK as well. So it all comes down to how well your application recovery is designed. – korkman Sep 4 '11 at 12:00

                • You got my vote. – edvinas.me Nov 21 at 13:04

                • @Signal15 - I wish I had the time to devote to it. – EEAA Nov 19 at 20:29

                • For the record, last year's nomination . – EEAA Nov 18 at 13:20

                • @meagar that's not how an election works. You vote. You don't just remove someone from the running because you don't like them. Let's have a legitimate election, ok? This is not a sockpuppet. I've been phone verified by StackExchange minions already. I've proven myself. – Evan Carroll Nov 17 at 21:34

                • How are you a better choice than the other candidates, such as, say HopelessN00b, who has over 2000 helpful flags, 33,000 rep, lots of meta posts, and is completely awesome, not to mention, endorsed by HopelessN00b? – HopelessN00b 5 hours ago

                • It's "Stack Exchange", not "StackExchange". – Nathan Osman Nov 18 at 0:44

                • I wouldn't hesitate to accept Ward as a moderator at Server Fault. I'm only surprised it hasn't happened already. – Michael Hampton ♦ Nov 17 at 21:02

                • +1 for Calimero! – ring0 Nov 18 at 6:32

                • Wow, you're all crazy. I for one do not endorse Hopelessnoob as a mod for reasons that @Shog9 has mentioned. I put this nomination in the same bucket as Evan Carrols'. – Mark Henderson ♦ Nov 20 at 21:45

                • You've got one of my votes. – Chris S ♦ Nov 18 at 2:49

                • So, you haven't been active here for a long time. You don't participate in meta, cast flags, have many notable badges and your voting is appalling. How is this a good basis for being a moderator? – Iain 18 hours ago

                • Could you please speak a little about the low helpful flag's count? Thx! – Colyn1337 Nov 17 at 21:07

                • Someone else I can endorse without reservation. – Michael Hampton ♦ Nov 19 at 4:45

                • You've got my vote. – Glueon Nov 18 at 15:25

                • This is the type of voice we need on the mod-staff. – sysadmin1138 ♦ Nov 21 at 15:55

                • You have barely moderated with only 2 flags, so how have you lead by example until now? – Cristian Ciupitu yesterday

                • You have my vote +1 – Hrvoje Špoljar Nov 19 at 20:37

                • I think you are a very good candidate, and will get my vote too. – ThoriumBR Nov 18 at 11:54

                • Personally in times of adversity i tend to want to shy away from holders of extreme viewpoints. Like, isn't that how wars start ? – Sirex 17 hours ago

                • A thought: Perhaps the simplest way to achieve this would be: Add an additional 1.8TB disk, run pvmove on one of the 2TB disks, when all the data is moved off that disk to the new one, remove it from the vg and what virtual machine. Rinse repeat for the second disk. As a matter of fact I am going to try that today. – Stew Apr 15 '12 at 11:52

                  • @CristianCiupitu Did you read my post about rtfm – F. Hauri yesterday

                    • Back when I was UTC-8, going much past midnight gets into Europe-time very easily. – sysadmin1138 ♦ Nov 17 at 21:49

                    • Why is this a problem? What's wrong with taking time out and coming back? I think it's better to do that than to just do the bare minimum to hold on to a ♦ whilst not really moderating or being a community leader. even taking a back set I do more than you and several of the mods we currently have. Where are you on meta or main - nowhere to be seen - some community leader you are. – Iain Nov 20 at 21:52

                    • Oh, you don't have to tell me - I've been here before. Of course it's always someone else's fault. Keep digging, and good luck to ya... – Shog9 ♦ Nov 20 at 19:06

                      • A notably high quality contributor. +1 – BlueCompute Nov 18 at 10:40

                      • @EvanCarroll - as one of the first users to have been a moderator I'm genuinely interested in what new and different you'd aim bring to the moderation of the site. There's often a lot of intelligence behind humour, I'd like a glimpse of it. – Chopper3 Nov 18 at 8:34

                      • I don't even know what you mean by that comment. What I want to know is why you've decided to make a comeback given that you've retired in the past? What makes you think that you won't just retire again in a year or two? Nobody expects a moderatorship to be a lifelong commitment, but to have two sucks of the sav, it better be a good reason to vote for you over someone else. – Mark Henderson ♦ Nov 20 at 21:42

                      • @HopelessN00b Numbers are only numbers. I'm not addict, so I'm not connected every days (more active on other SE sites, but not intensively). I'm an old man, quiet and right. – F. Hauri 4 hours ago

                        • @Sven Yes, it's true that I don't have much (or any) experience with SF specifically. However, it's important to note that all Stack Exchange sites are moderated by their communities, and someone who doesn't make use of the moderation tools provided to "mortals" (non-♦s) probably isn't going to make a great moderator, either. (Not to imply that Signal15 here isn't ever going to become a moderator, just that to be a moderator, it would be beneficial for one to have had previous experience with the tools provided to them.) – Doorknob yesterday

                        • @Doorknob Thanks for the vote of confidence. There are many other far more qualified candidates than I thusfar. However, merely participating in this caucus (and reading the comments) has helped me better understand the expectations of a moderator. You're right, maybe next year! :) – Signal15 3 hours ago

                        • Just because you're not personally moved to vote for me doesn't mean that I have to reform my campaign platform. – Evan Carroll Nov 20 at 20:08

                        • See the second paragraph at the top of this page - be amazed. It's easy to see what active mods are doing, you see their actions all over meta and main. – Iain Nov 20 at 22:54

                        • You have my vote too thanks for nominating. – Iain Nov 18 at 6:03

                        • @CristianCiupitu I've only posted 30 answer, there on ServerFault. But please, have a look on some of them. If I'm convinced to not be helpful, I prefer to stay silently. – F. Hauri yesterday

                        • Evan Carroll is a parody account of himself , this is not a serious nomination, please don't engage him . Can we ban Evan during the election so he doesn't continually spam other nominations trying to get people to pay attention to him, as is already happening on the other nomination? – meagar Nov 17 at 21:06

                        • You haven't noticed? Perhaps you should spend some more time on the site Mark instead of hiding out in the backroom somewhere. @MarkHenderson – Iain Nov 20 at 21:27

                        • I wouldn't call 1 year and 3 months 'recent'. Based on that your activity is very low - how does this set you up to be a moderator? What sort of things need a 'fresh face' to look at them ? – Iain Nov 18 at 18:48

                        • +1 for brighter ServerFault tomorrow! – masegaloeh Nov 20 at 7:45

                          • @Ward Not to mention fewer of, and less participation from "us guys" that once made up the core of the community. So even there really was a problem with the Server Fault regulars being big meanies, it wouldn't be a problem, because there are less and less of them, and they're participating less and less too. – HopelessN00b Nov 20 at 20:08

                            • @Signal15 OK, what about the rest of my question? – EEAA Nov 18 at 22:23

                            • It kinda sounds like you've correctly identified the problem, and then... Arrived at the status quo as the solution. Let's face it: as a community, your reputation for cruelty, snark, and general unhelpfulness is unmatched - even Programmers, which attracts far fewer questions per day and rejects nearly all of them, doesn't come close to generating the levels of straight-up vitriol that y'all do. And so, upon observing that the only folks willing to still come here are utterly lost and desperate, your solution is... youtube.com/watch?v=0VjPNKc0VsU – Shog9 ♦ Nov 20 at 18:50

                            • I removed the comment and added it to an edit on the original question, better formatting. – Stew Apr 15 '12 at 13:03

                            • I think you'd do a good job. But I think your timezone is already oversaturated with mods. – TheCleaner Nov 19 at 14:44

                            • This isn't a VMWare issue really, the issue with the 2TB vmdk's is that there's no space left on the datastore to commit to a snapshot, as you say dropping the size of the vmdk will allow that to work.

                              Now obviously you can use the usual chain of umount, e2fsck, resize2fs, lvreduce and pvresize then reduce the vmdk size within the vsclient, but there's another thought, if you have enough temporary space you could just convert them to thin disks. Obviously there can be a write penalty for this but it'd mean you'd not have to touch your guest filesystem.

                            • @Shog9 That reputation comes from whiny illiterates who don't like that they get down voted for bashing their keyboards randomly and trying to pass the output off as a question on this site, so ServerFault's reputation for snarky helpfulness is unfair, and unwarranted. On the other hand, I actually am snarky, cruel and very good at offering profoundly unhelpful help. Either way, I'm hardly proposing status quo, as none of that has been practiced by our moderators, who have demurred to the official Stack Exchange policy of pink fluffy niceness to the hordes of jackasses shitting on the site. – HopelessN00b Nov 20 at 19:01

                            • This did not go well, however I am going to attempt it again when I can plan for a bit of downtime of that volume. Thanks for the answer, this is the route I am going to try and worse case scenario I can delete everything and recreate it from backup. Thanks! – Stew Apr 17 '12 at 7:02

                            • @Wars A vote for n00b is a vote for a winter of discontent! :) Now is the winter of our discontent / Made glorious summer by the HopelessN00b dork , to quote Shakespeare. – HopelessN00b Nov 20 at 15:58

                              • It seems like every time I'm in the review queues, you're in there, too. +1 – Katherine Villyard Nov 19 at 2:45

                              • I support moderation in moderation. – briantist 2 days ago

                                • @Shog9 True, we are just begging to be flooded by crap, what with all the statements about how this is a professional community... by simply existing on the internet... whatever makes the hordes of stupid our fault. But this is where I have a novel idea... deal with the stupid by not tolerating it. Crack down on it, rather than the SE policy of trying to change stupid by pink fluffy happiness and positive thought energy, or whatever, if anything, the strategy is. I know I don't have to tell you how the SF (and even SO and SE) communities are declining under the unabated load of inbound st00pid – HopelessN00b Nov 20 at 19:11

                                  • You'll get my vote (again) unless we get some geographically better positioned candidates. – Iain Nov 17 at 21:50

                                  • I think you'd be an excellent choice here. – TheCleaner Nov 17 at 20:40

                                  • I'm HopelessN00b, and I endorse this awesome post/nomination. – HopelessN00b Nov 20 at 8:44

                                  • Yeah, screw the "Summer of Love," we need a Harsh Winter! – Ward Nov 20 at 15:51

                                  • Half of the active moderators are in UTC-5, and -8 isn't much different. Our biggest need is around 0800-1200 UTC. I think you'd be a good moderator, interested in moving to Europe? – Chris S ♦ Nov 17 at 21:22

                                  • I notice that you have stood for almost every election, and generally not gotten past the nomination stage. What do you intend to do differently this time? – Journeyman Geek Nov 18 at 1:15

                                  • I've just read it and it's not bad. – Cristian Ciupitu 18 hours ago

                                  • That's good, but this role is for moderating, not answering. – Cristian Ciupitu yesterday

                                  • Oh it's multi-extent? hmmm, not a big fan of doing that but yeah, I can see how that changes things, still at least you'll be able to follow that tool chain I mentioned. – Chopper3 Apr 15 '12 at 12:40

                                  • There is 4TB free on the datastore, so I don't think that is the issue. – Stew Apr 15 '12 at 12:38

                                  • @TheCleaner Probably so. Doesn't hurt to go through the process anyway. :) – Nathan C Nov 19 at 15:01

                                  • There is 4TB free on the datastore, so I don't think that is the issue. – Stew Apr 15 '12 at 12:38

                                  • N00b for moderator! – Magellan Nov 20 at 19:25

                                    • blimey shog9. You nailed that one pretty spot on. – Sirex Nov 20 at 19:21

                                    • @Doorknob: I dont think that you, as someone with zero participation in this site, are in a position to make such recommendations. – Sven yesterday

                                    • +1 Falcon Momot – c4f4t0r Nov 18 at 7:23

                                    • Your moderate voice is a nice change from the calls of "GET OUT OF OUR SITE NOOBS". I've held the view for a long time that being exclusive is not always the right course. – Mark Henderson ♦ Nov 20 at 21:20

                                    • A thought: Perhaps the simplest way to achieve this would be: Add an additional 1.8TB disk, run pvmove on one of the 2TB disks, when all the data is moved off that disk to the new one, remove it from the vg and what virtual machine. Rinse repeat for the second disk. As a matter of fact I am going to try that today. – Stew Apr 15 '12 at 11:52

                                    • This did not go well, however I am going to attempt it again when I can plan for a bit of downtime of that volume. Thanks for the answer, this is the route I am going to try and worse case scenario I can delete everything and recreate it from backup. Thanks! – Stew Apr 17 '12 at 7:02

                                    • I'm not sure if you're being serious or not. I am no community leader, I have never claimed to be a community leader. I am on meta every day, but because virtually all meta activity happens outside my timezone, I come, I read, I vote. Everything is already answered. I don't just throw my voice out to create more noise. How would you know what mods are doing? This kind of elitist attitude is why I do not want you back as a moderator. – Mark Henderson ♦ Nov 20 at 22:47

                                    • It isn't consistent. Whether the dom0 LV contains a partition table, etc., or just a filesystem is irrelevant. The dom0 can only freeze those filesystems mounted in the dom0.

                                    • Always very sane and quality feedback, +1 from me – Hrvoje Špoljar Nov 21 at 9:40

                                    • @ChrisS I'm usually still up 'way past midnight local time, so I cover at least 0800-1000UTC – Ward Nov 17 at 21:40

                                    • Of course it's always someone else's fault. you're right @shog9. That Stack Exchange employee that moved a post here the other day despite knowing nothing about this site who got the hump when called on it? Totally our fault... Not sure how but I eagerly await an explanation as to why. Perhaps there should be a "stack exchange tv" movie about it. – RobM Nov 20 at 20:19