Re: [CentOS] resize lvm
On Sat, May 7, 2016 at 7:57 AM, Robert Nicholswrote: > On 05/06/2016 02:15 PM, Wes James wrote: > >> I found this: >> >> # lvextend -l +100%FREE /dev/myvg/testlv >> >> doing a search. What's the difference between 100%VG and 100%FREE? >> > > For the special case of "100%" there is no difference. For values > less than 100% with a non-empty VG, the two are quite different, > e.g., (50% of VG) != (50% of the free space in VG). > Thanks. This is the first time I'm worked with the lvm commands. I thought VG was a typo for GB, but I see in the help commands for lvm: lvdisplay and vgdisplay - vg is volume group. -wes ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On 05/06/2016 02:15 PM, Wes James wrote: I found this: # lvextend -l +100%FREE /dev/myvg/testlv doing a search. What's the difference between 100%VG and 100%FREE? For the special case of "100%" there is no difference. For values less than 100% with a non-empty VG, the two are quite different, e.g., (50% of VG) != (50% of the free space in VG). -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it. ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On 05/06/2016 01:42 PM, John R Pierce wrote: On 5/6/2016 11:39 AM, Wes James wrote: file -s /dev/dm-0 and it says XFS So would I use xfs_growfs? bingo!xfs_growfs can be used with the file system online, I'm pretty sure resize2fs requires the file system to be offline (unmounted). Online expansion of a filesystem is allowed by resize2fs. It is only for shrinking that being offline and running fsck is required. xfs does not allow shrinking at all. -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it. ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
> > From: Scott Robbins <scottr...@gmail.com> > Date: May 06, 2016 12:32:55 PM > To: CentOS mailing list <centos@centos.org> > Subject: Re: [CentOS] resize lvm > > On Fri, May 06, 2016 at 06:19:35PM +, Wes James wrote: > > I have a laptop that I put centos 7 on and I started out with a 30gig partition. I resized the other part of the disk to allow more space for centos. I then created an unformated partition in the available space, ran > > > > pvcreate /dev/sda4 > > > > > vgextend lvname /dev/sda4 > > > > > lvextend -L 184.46G /dev/lvname/root > > > > I find it easiest to do lvextend -l 100%VG /dev/lvname/rootI find it > easiest to do lvextend -l 100%VG /dev/lvname/root. > (Then, if practical, and since it's a laptop, I'm guessing it's not a > production machine), reboot from a livecd or whatever and doing e2fsk -f > /dev/lvmname/root > > I don't know if it will solve your issue, but may be worth trying. I found this: # lvextend -l +100%FREE /dev/myvg/testlv doing a search. What's the difference between 100%VG and 100%FREE? Thanks, -wes ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On Fri, May 06, 2016 at 11:42:18AM -0700, John R Pierce wrote: > On 5/6/2016 11:39 AM, Wes James wrote: > >file -s /dev/dm-0 > > > > > > > >and it says XFS > > > > > > > >So would I use xfs_growfs? > > bingo!xfs_growfs can be used with the file system online, I'm > pretty sure resize2fs requires the file system to be offline > (unmounted). Sorry, I missed that it would most likely be xfs. resize2fs doesn't necessarily require it to be offline, but it does frequently (though not always, IIRC), suggest running e2fsk first which should definitely be done while it's unmounted. -- Scott Robbins PGP keyID EB3467D6 ( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 ) gpg --keyserver pgp.mit.edu --recv-keys EB3467D6 ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On May 06, 2016, at 12:37 PM, John R Piercewrote: On 5/6/2016 11:28 AM, John R Pierce wrote: On 5/6/2016 11:19 AM, Wes James wrote: sudo resize2fs /dev/lvname/root I get: resize2fs: Bad magic number in super-block while trying to open /dev/lvname/root Couldn't find valid filesystem superblock. what file system type is this /dev/lvname/root ? oops, left out the rest... since you said C7, its quite likely its XFS not extXfs ... if thats the case, then use: xfs_growfs /dev/lvname/root Thanks for the tip. I looked at man xfs_growfs and found -d option and so I used this and it worked: sudo xfs_growfs / -d -- john r pierce, recycling bits in santa cruz ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos Thanks! -wes ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
- Original Message - | On Fri, May 06, 2016 at 06:19:35PM +, Wes James wrote: | > I have a laptop that I put centos 7 on and I started out with a 30gig | > partition. I resized the other part of the disk to allow more space for | > centos. I then created an unformated partition in the available space, | > ran | > | > | > pvcreate /dev/sda4 | > | > | > | > vgextend lvname /dev/sda4 | > | > | > | > lvextend -L 184.46G /dev/lvname/root | | | I find it easiest to do lvextend -l 100%VG /dev/lvname/rootI find it | easiest to do lvextend -l 100%VG /dev/lvname/root. | (Then, if practical, and since it's a laptop, I'm guessing it's not a | production machine), reboot from a livecd or whatever and doing e2fsk -f | /dev/lvmname/root | | I don't know if it will solve your issue, but may be worth trying. | | > | > | > but when I run: | > | > | > | > sudo resize2fs /dev/lvname/root | > | > | > I get: | > | > | > | > resize2fs: Bad magic number in super-block while trying to open | > /dev/lvname/root | > Couldn't find valid filesystem superblock. | > | | -- | Scott Robbins | PGP keyID EB3467D6 | ( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 ) | gpg --keyserver pgp.mit.edu --recv-keys EB3467D6 if you use pass the '-r' option to lvextend it will resize the volume for you based on the filesystem that is on the volume. no need to grow it manually afterward. -- James A. Peltier IT Services - Research Computing Group Simon Fraser University - Burnaby Campus Phone : 604-365-6432 Fax : 778-782-3045 E-Mail : jpelt...@sfu.ca Website : http://www.sfu.ca/itservices Twitter : @sfu_rcg Powering Engagement Through Technology ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On 5/6/2016 11:39 AM, Wes James wrote: file -s /dev/dm-0 and it says XFS So would I use xfs_growfs? bingo!xfs_growfs can be used with the file system online, I'm pretty sure resize2fs requires the file system to be offline (unmounted). -- john r pierce, recycling bits in santa cruz ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On May 06, 2016, at 12:29 PM, John R Piercewrote: On 5/6/2016 11:19 AM, Wes James wrote: sudo resize2fs /dev/lvname/root I get: resize2fs: Bad magic number in super-block while trying to open /dev/lvname/root Couldn't find valid filesystem superblock. what file system type is this /dev/lvname/root ? I tried to find the type from blkid /dev/sda4 but that didn't give me the info so I tried file -s /dev/dm-0 and it says XFS So would I use xfs_growfs? -- john r pierce, recycling bits in santa cruz ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On 5/6/2016 11:28 AM, John R Pierce wrote: On 5/6/2016 11:19 AM, Wes James wrote: sudo resize2fs /dev/lvname/root I get: resize2fs: Bad magic number in super-block while trying to open /dev/lvname/root Couldn't find valid filesystem superblock. what file system type is this /dev/lvname/root ? oops, left out the rest... since you said C7, its quite likely its XFS not extXfs ... if thats the case, then use: xfs_growfs /dev/lvname/root -- john r pierce, recycling bits in santa cruz ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On Fri, May 06, 2016 at 06:19:35PM +, Wes James wrote: > I have a laptop that I put centos 7 on and I started out with a 30gig > partition. I resized the other part of the disk to allow more space for > centos. I then created an unformated partition in the available space, ran > > > pvcreate /dev/sda4 > > > > vgextend lvname /dev/sda4 > > > > lvextend -L 184.46G /dev/lvname/root I find it easiest to do lvextend -l 100%VG /dev/lvname/rootI find it easiest to do lvextend -l 100%VG /dev/lvname/root. (Then, if practical, and since it's a laptop, I'm guessing it's not a production machine), reboot from a livecd or whatever and doing e2fsk -f /dev/lvmname/root I don't know if it will solve your issue, but may be worth trying. > > > but when I run: > > > > sudo resize2fs /dev/lvname/root > > > I get: > > > > resize2fs: Bad magic number in super-block while trying to open > /dev/lvname/root > Couldn't find valid filesystem superblock. > -- Scott Robbins PGP keyID EB3467D6 ( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 ) gpg --keyserver pgp.mit.edu --recv-keys EB3467D6 ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize lvm
On 5/6/2016 11:19 AM, Wes James wrote: sudo resize2fs /dev/lvname/root I get: resize2fs: Bad magic number in super-block while trying to open /dev/lvname/root Couldn't find valid filesystem superblock. what file system type is this /dev/lvname/root ? -- john r pierce, recycling bits in santa cruz ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
[CentOS] resize lvm
I have a laptop that I put centos 7 on and I started out with a 30gig partition. I resized the other part of the disk to allow more space for centos. I then created an unformated partition in the available space, ran pvcreate /dev/sda4 vgextend lvname /dev/sda4 lvextend -L 184.46G /dev/lvname/root but when I run: sudo resize2fs /dev/lvname/root I get: resize2fs: Bad magic number in super-block while trying to open /dev/lvname/root Couldn't find valid filesystem superblock. How do I resize the volume? Thanks, -wes ___ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize LVM (ext3)
Thanks guys for help! Work is done, everything went fine .. Have a nice day, D. On Wed, Oct 29, 2008 at 3:24 PM, William L. Maltby [EMAIL PROTECTED] wrote: On Wed, 2008-10-29 at 10:15 -0400, Filipe Brandenburger wrote: snip Reduce the filesystem to 78G or 79G with resize2fs, then reduce the LV to 80G, then grow the ext3 filesystem again to fill all the LV. This should make it safer when cutting the LV. That's what I always do. It eliminates small chances of my math disagreeing with resize2fs's math. Plus, IIRC, then the second re-size doesn't need a size parameter. Resize2fs will automatically grow to the maximum allowed by the partition/logvol. HTH, Filipe snip sig stuff HTH -- Bill ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
[CentOS] resize LVM (ext3)
Hello guys, my scenario is following 1. I have LVM group named system 2. I have a logical volumes - system/root , ext3 mounted as / (20GB) - system/swap, swap - system/home, ext3 mounted as /home (431GB) I need to shrink system/home to 80GB (currently there is 57GB used) and use free space to create another logical volumes. My scenario is 1. reduce ext3 fs size to 80GB by using resize2s 2. reduce system/home size by using lvreduce 3. create another logical volumes Questions 1. How can i be sure that i will shrink ext3 to exact size 80GB and that the same will lvreduce do? I do not want to cut from ext3 filesystem if i will reduce logical volume too much 2. Can you please send me commands to achieve 1) and 2) part of my scenario? 3. Or can i just use lvreduce and my ext3 will shrink automatically? 4. Do i need to umount system/home when resizing? Thanks in advance! David ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize LVM (ext3)
On Wed, Oct 29, 2008 at 12:58:32PM +0100, David Hláčik wrote: snip 1. How can i be sure that i will shrink ext3 to exact size 80GB and that dev=/dev/system/home resize2fs $dev 80G Then, to be sure of the real size: blks=$(tune2fs -l $dev | awk -F: '/Block size/ { print $2/512 }') fssize=$(tune2fs -l $dev | awk -v bs=$blks -F: '/Block count/{print $2*bs}') Now, $fssize has the complete size in bytes. Verify it: echo $fssize Now, for lvresize: lvresize -L 80G system/home Verify that the printed target size matches the wanted value. 3. Or can i just use lvreduce and my ext3 will shrink automatically? NO! lvreduce doesn't care about what's inside, and will happily lose data. 4. Do i need to umount system/home when resizing? Yes, and you must do a full fsck also: e2fsck -f /dev/system/home Regards, Luciano Rocha -- lfr 0/0 pgpNkocZH4oWf.pgp Description: PGP signature ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize LVM (ext3)
Now, for lvresize: lvresize -L 80G system/home Are you sure there should not be lvreduce -L 80G system/home ? Thanks! D. ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize LVM (ext3)
On Wed, Oct 29, 2008 at 01:38:06PM +0100, David Hláčik wrote: Now, for lvresize: lvresize -L 80G system/home Are you sure there should not be lvreduce -L 80G system/home ? Same thing. I prefer the direction-neutral lvresize. Regards, Luciano Rocha -- lfr 0/0 pgph8d6Kf9euL.pgp Description: PGP signature ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize LVM (ext3)
Hi, On Wed, Oct 29, 2008 at 07:58, David Hláčik [EMAIL PROTECTED] wrote: How can i be sure that i will shrink ext3 to exact size 80GB and that the same will lvreduce do? I do not want to cut from ext3 filesystem if i will reduce logical volume too much Reduce the filesystem to 78G or 79G with resize2fs, then reduce the LV to 80G, then grow the ext3 filesystem again to fill all the LV. This should make it safer when cutting the LV. HTH, Filipe ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] resize LVM (ext3)
On Wed, 2008-10-29 at 10:15 -0400, Filipe Brandenburger wrote: snip Reduce the filesystem to 78G or 79G with resize2fs, then reduce the LV to 80G, then grow the ext3 filesystem again to fill all the LV. This should make it safer when cutting the LV. That's what I always do. It eliminates small chances of my math disagreeing with resize2fs's math. Plus, IIRC, then the second re-size doesn't need a size parameter. Resize2fs will automatically grow to the maximum allowed by the partition/logvol. HTH, Filipe snip sig stuff HTH -- Bill ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos