Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] reduce and grow lvm partitions set in raid. 1
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Moopie
n00b
n00b


Joined: 12 Jul 2014
Posts: 8
Location: France

PostPosted: Sun Mar 20, 2016 4:59 pm    Post subject: [SOLVED] reduce and grow lvm partitions set in raid. 1 Reply with quote

Hello everyone,

I've recently installed Gentoo without problems but the root / is too small.
So I want to reduce the /home and grow the /

However, my disks is a little bit complex. I've 2 disks in raid 1 with LVM.
I tried to reduce my home with lvreduce but that corrupt my partition ! I have to shrink the partition to his original size .

So my question is, what's the right way to reduce and grow lvm partitions set in raid 1.

Thanks.


Last edited by Moopie on Sun Mar 20, 2016 9:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Sun Mar 20, 2016 5:22 pm    Post subject: Reply with quote

Yes this is a very risky operation. What you want to do is
1. BACKUP YOUR SYSTEM
2. MAKE ANOTHER BACKUP OF YOUR SYSTEM
3. MAKE SURE YOUR BACKUP IS GOOD

ok sillyness aside, this is very risky indeed. Then you may go forward.
4. Use the resize2fs program to reduce the size of your home partition. Make it a bit smaller than what you really want, so you can have some slop on the volume resize
5. fsck the resized partition to make sure it's correct
6. Make sure the resized partition is indeed smaller than before and the size you expect
7. Use lvresize to reduce the size of the volume. DANGER! If you make it too small and chip off your reduced size partition, DATA LOSS! Hence making the resize smaller reduces the chance of off-by-1's.
8. Use resize2fs on the resized partition to grow use up the slack you made in step 4. Ideally you would have 0 growth, but a small bit of growth is expected.
9. Now you can lvresize your root partition to take up extra space
10. and then resize2fs root, and now you're done.

Now I don't know what filesystem you're using but this is for ext2/3/4fs... I suspect other filesystems have their own resizer program (which is independent of lvresize).
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Sun Mar 20, 2016 5:32 pm    Post subject: Reply with quote

backup ofc

always first reduce the file system
than the lvm things (logical volume first, than you can remove those phyiscal extents.) (i suggest you read the lvm intro or how the different layers are designed ...) that should make things clear
Back to top
View user's profile Send private message
Moopie
n00b
n00b


Joined: 12 Jul 2014
Posts: 8
Location: France

PostPosted: Sun Mar 20, 2016 5:39 pm    Post subject: Reply with quote

I'm doing a backup of my /home right now..
Fortunately I didn't lose data.

I will do as you say, I hope that will work !
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43221
Location: 56N 3W

PostPosted: Sun Mar 20, 2016 8:09 pm    Post subject: Reply with quote

Moopie,

The take away from this is that shrinking filesystems and the logical volume they are contained on is slow and risky.
Growing logical volumes, then the fiesystems is trivial in comparsion.
There is no need to allocate all of your physical volume to logical volumes al the outset. Grow and/or add logical volumes as you need them.

Not all filesystems support growing and shrinking. A few do neither. A few can be grown only.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Moopie
n00b
n00b


Joined: 12 Jul 2014
Posts: 8
Location: France

PostPosted: Sun Mar 20, 2016 9:08 pm    Post subject: Reply with quote

I've followed eccerr0r advices, and that's worked !
Thanks you guys ;)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Mon Mar 21, 2016 7:16 pm    Post subject: Reply with quote

I do wonder about lvm fragmentation. Granted the chunks are large (usually 4MB stripes) but would it ever get to a point that it becomes necessary to defragment logical volumes...

I've never had much luck with LVM speed, my nfs over LVM on MDRAID5 is pitiful in terms of i/o speed (both random and sequential, but random is really hurting)...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Mon Mar 21, 2016 7:30 pm    Post subject: Reply with quote

eccerr0r wrote:
I do wonder about lvm fragmentation. Granted the chunks are large (usually 4MB stripes) but would it ever get to a point that it becomes necessary to defragment logical volumes...


In an extreme case, like if you had an LV that used only every other 4MB extent, you would notice. But in practice this situation usually does not occur. Usually you grow LV in huge chunks and not 4MB at a time.

I have no performance issues with GPT->RAID->LUKS->LVM->XFS.

You can use pvmove to defrag LVM, if it ever becomes necessary. I think there was also a defrag lvm script out there somewhere, but not sure about its quality...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum