[PLUG] lvm: reclaim and reallocate space
Dale Snell
ddsnell at frontier.com
Wed Aug 3 22:52:39 UTC 2016
On Wed, 3 Aug 2016 12:16:04 -0700, in message
CAArW4Zj-j2pEK-6qJOgyuWd193pwUc4wJxG=+3Xn=h6WJvGUpg at mail.gmail.com,
mitch portland wrote:
> Hi Guys,
>
> I have a Fedora 21 machine on which I configured the 250Gb drive in
> the following way:
>
> hobgoblin:~:{619}lsblk
> NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
> sda 8:0 0 232.9G 0 disk
> ├─sda1 8:1 0 500M 0 part /boot
> └─sda2 8:2 0 232.4G 0 part
> ├─fedora-swap 253:0 0 15.7G 0 lvm [SWAP]
> ├─fedora-root 253:1 0 50G 0 lvm /
> └─fedora-home 253:2 0 166.7G 0 lvm /home
> sr0 11:0 1 1024M 0 rom
> sr1 11:1 1 1024M 0 rom
> hobgoblin:~:{620}df
> Filesystem Size Used Avail Use% Mounted on
> devtmpfs 16G 0 16G 0% /dev
> tmpfs 16G 122M 16G 1% /dev/shm
> tmpfs 16G 1.5M 16G 1% /run
> tmpfs 16G 0 16G 0% /sys/fs/cgroup
> /dev/mapper/fedora-root 50G 38G 9.5G 80% /
> tmpfs 16G 460K 16G 1% /tmp
> /dev/sda1 477M 177M 271M 40% /boot
> /dev/mapper/fedora-home 164G 11G 146G 7% /home
> tmpfs 3.2G 28K 3.2G 1% /run/user/2155
>
> I've been using the machine for over a year, and all's well, except
> that I'm now continually running out of space on the / volume. The
> applications I use install in /opt, and I have to keep many different
> versions around for my work, so space is getting very tight. /home
> has plenty of space though, so I'd like to reallocate most of it to /.
>
> I've used the OSX disk utility to "pack" a partition's contents into
> it more efficiently, and then reduce the size of the partition so I
> can reallocate it to another. Using that gui tool, the process is all
> very clear and works great.
>
> When I set up the Fedora 21 machine, there was a very nice gui
> interface for setting up the partitions and logical volumes. But
> Fedora 21 doesn't seem to have an equivalent tool that can be run
> after installation, now that system-config-lvm is no longer
> supported. Command-line lvm looks simple-ish to use; but what I'm not
> clear on is whether it can pack a volume's contents in order to
> create a clear area of unused space before resizing the volume.
>
> I can't afford to break this machine, so I'm trying to make sure I
> know exactly what I'm doing before I get started.
>
> Thanks, mitch
Hi Mitch
First off, you should read the man pages for fsadm(8) and
lvresize(8). You need to resize /home before you can re-size the
logical partition. The LVM command-line programs are not
particularly difficult to use, but you must be absolutely certain
that you're doing the right thing. Since my memory is as leaky as
a sieve, I always have to re-read the man pages for any of the
commands I need to use. :-)
That said, it should not be difficult to re-size /home -- that's
your main worry. It wouldn't hurt to re-size / either, but
I don't think it's really necessary.
Once that's done, you should be able to use lvresize(8) to shrink
/home, then expand /.
There should be no need to fiddle with the pv* or vg* LVM
commands. But do read up on the lg* commands. There are a lot of
them, I know, but they're well worth reading about.
Hope this helps,
--Dale
--
“I’ve always felt that a leader should have a strong chin.
Santiago has _no_ chin, and his running mate has several. This,
to me, is not a good combination.”
-- Susan Ivanova, “Midnight on the Firing Line”, Babylon 5
More information about the PLUG
mailing list