From: Dale <rdalek1967@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] LVM and LABELS in fstab
Date: Thu, 24 Nov 2011 03:00:39 -0600 [thread overview]
Message-ID: <4ECE07B7.9000501@gmail.com> (raw)
In-Reply-To: <20111124103901.726f5e33@rohan.example.com>
Alan McKinnon wrote:
> On Wed, 23 Nov 2011 21:28:56 -0600
> Dale<rdalek1967@gmail.com> wrote:
>
>> Dale wrote:
>>> Neil Bothwick wrote:
>>>> You have space in the filesystem, but the volume containing that
>>>> filesystem is too large to move. You must first reduce the
>>>> filesystem size, with resize2fs or whatever suits your fs, then
>>>> shrink the LV with lvresize. That will free up enough extents to
>>>> be able to fit them all on one disk. Look at the output from lvs
>>>> to see what is taking up all the space.
>>> So, me staring at it a while and trying to figure it out did work.
>>> That is what I was thinking. Thing is, it looks to me like it
>>> would just move the stuff over then I can reduce it by what sdb is
>>> making for its share. Although, their way makes sense too.
>>>
>>> I basically need to reduce the thing by 59604 PEs then it can move
>>> them over to sdc so I can remove sdb. Looks like I am about to
>>> really learn something here. It uses ext4 by the way. Looks like
>>> adding is easier than removing, sort of.
>>>
>>> Now to get my ducks in a row. o_O
>>>
>>> Thanks.
>>>
>>> Dale
>>>
>>> :-) :-)
>>>
>>
>> OK. Everyone duck, I been thinking on this and Neils info above.
>> lol This is what I sort of figured out and tell me where I am off
>> here. I have to reduce the file system, change the partition in
>> cfdisk (?), resize the lv, then reduce the vg, then I can run
>> pvmove? After all that, I can remove the drive sdb? Do I have the
>> order correct too? If it does involve all this, I'm not sure I want
>> to do this. The file system and cfdisk part makes me nervous. Maybe
>> some of this isn't needed and I am reading some of the info
>> incorrectly, I hope.
> No, not quite. You're on the right track but got some of the details
> wrong. Let's look first at the layers of stuff involved:
>
>
> files& directories
>
> file system
>
> logical volume (LV)
>
> volume group (VG)
>
> physical volume (PV)
>
> physical partition (i.e. /dev/sda1 etc)
>
> physical disk (i.e. something Seagate etc made)
>
>
>
> OK, there's a lot of stuff there. When you made the LV, you worked from
> the bottom up. To undo it, you work from the top down. And the
> important bit:
>
> Everything in that list only knows about the one directly below it.
>
> The other important bit:
>
> Nothing in that list can be bigger than the thing below it.
>
> This makes perfect sense: You can't store a 5G file on a 4G
> file-system, nor can you create a 1TB partition on a 500G disk.
>
>
> Tools like lv* only know about LVs and how they are built, it's
> clueless about the actual files and filesystems involved. So when you
> want to move things around, the tool will look at the volume and see
> how many extents it uses. It will want to move all those extents
> somewhere else.
>
> Now say you made a 40G filesystem on an LV but only have 500M of
> actual files on it. LVM tools are going to want to move a 40G volume,
> never mind that 39.5G of it is unused. If you don't have 40G of free
> space, you have to start juggling.
>
> First get the filesystem down to a reasonable size:
>
> 1. Shrink the filesystem using resize2fs, resize_reiserfs etc.
> 2. lvreduce to make the logical volume match the file system.
>
> Now you have a 500M thing to move around and your life gets easier.
>
> What you want to accomplish is to move all the LVs from one disk to
> another disk, you need to have enough free space on the new PV to hold
> all those LVs. When you've done that the old PV will now have no data
> on it (none of it's extents will be in use), you can remove it from the
> VG, then delete the PV, and finally remove the disk from the machine.
>
> *fdisk is the only truly destructive tool in your toolbox, the LVM
> tools will all give you errors if you try and remove things that are in
> use or if there's not enough free space.
>
> There's no easy recipes for this that you can just follow. You need to
> understand the things you are dealing with and know what they are. But
> it's not *that* hard.
>
> Like most things in Linux, LVM assumes that you, Dale, are probably not
> a complete idiot and that you do know what you are doing. That's why
> are the gory details are exposed for you to play with.
>
> Now if it were Windows and you were extremely lucky, you might get a
> GUI thingy that let's you drag an bunch of unnamed stuff from here and
> put it there. Which would promptly fail, silently.
>
>
I think I had a light bulb moment but I plan to read this a few more
times. I have these two drives, sdb and sdc, that are in the LVM
system. I want to remove sdb, the smaller one, and when I do pvmove it
doesn't move the files, it doesn't even see the files themselves, it
sort of moves the file system itself which just happens to take the
files with it. It takes the same amount of time even if there are no
files on it. Sort of like dd does in a way. dd doesn't see files or
anything, it just copies the bits on the platter.
Am I getting close here?
You didn't really bring up winders did you? You do know I hate
winders. The only windows I like lets fresh are in when spring comes. ;-)
Dale
:-) :-)
--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!
prev parent reply other threads:[~2011-11-24 9:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 2:52 [gentoo-user] LVM and LABELS in fstab Dale
2011-11-17 6:20 ` Manuel McLure
2011-11-17 6:50 ` Dale
2011-11-17 9:43 ` Florian Philipp
2011-11-17 13:38 ` Joost Roeleveld
2011-11-17 17:37 ` Dale
2011-11-17 18:57 ` Neil Bothwick
2011-11-18 5:18 ` Dale
2011-11-20 13:02 ` James Wall
2011-11-20 20:32 ` Dale
2011-11-26 15:36 ` James Wall
2011-11-23 5:50 ` Dale
2011-11-23 13:31 ` Neil Bothwick
2011-11-23 19:07 ` Dale
2011-11-23 21:17 ` Neil Bothwick
2011-11-24 1:27 ` Dale
2011-11-24 3:28 ` Dale
2011-11-24 4:04 ` Alex Schuster
2011-11-24 4:37 ` Dale
2011-11-24 10:48 ` Dale
2011-11-24 16:48 ` Neil Bothwick
2011-11-24 8:39 ` Alan McKinnon
2011-11-24 9:00 ` Dale [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ECE07B7.9000501@gmail.com \
--to=rdalek1967@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox