Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #159714

Re: How to Rezize Partition on LVM

From Mario Castelán Castro <marioxcc.MT@yandex.com>
Newsgroups linux.debian.user
Subject Re: How to Rezize Partition on LVM
Date 2015-10-24 04:40 +0200
Message-ID <qmWUp-3Es-11@gated-at.bofh.it> (permalink)
References <qmVOG-21k-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


El 23/10/15 a las 20:05, ray escribió:
> I would like to resize the /home partition but it is mounted, and when umount is run, it errors with 'busy'.
>
> System Configuration:
> I installed jessie on a laptop with one SSD.  I used guided partitioning and selected the whole drive with multiple partitions.  The /home now takes up 420 GB.  I would like to reduce that to 20 GB to make room for another partition.
>
> What are the methods reduce this partition?

In order to resize a partition that is on LVM, you must *first* reduce 
the size of the filesystem, *then* reduce the size of the logical 
volume, to exactly the same size (or the LVM LV bigger than the 
filesystem, but that is wasteful and does not make sense). To make sure 
that the LVM LV and filesystem are the same size, specify the size to 
all tools in bytes to be sure. Instead of using a bigger unit like MB or 
MiB. Make the conversion and make it a multiple of 1 MiB, for example, 
if you want 400 GB, rounding to the nearest multiple of 1 MiB gives 
400000286720 bytes.

To shrink a filesystem, you will need to use a filesystem-specifc tool. 
For ext{2,3,4} you can use "resize2fs"; the filesystem needs to be 
unmounted in order to make it smaller, but you can make a filesystem 
bigger either mounted or unmounted mounted (but this is the opposite you 
need in this case).

To resize a logical volume, take a look into the documentation (man 
page) of the tool "lvresize".

The only requirement that will cause a minor inconvenience is to have 
your partition unmounted. Since you want to resize /home, it will 
normally be used by many programs, including your desktop environment; 
and therefore there is no trivially easy way to unmount it while using 
your graphical environment.

You should be able to boot in single user mode and do the resizing with 
/home unmounted. I have not done that in Debian 8 yet (which a different 
boot system by default than Debian 7).

You can also boot from a Live CD image of Debian and perform the 
resizing from there; however, there is no need to burn the image to an 
actual CD, and it is a waste of resources (money and natural resources) 
unless it is actually required for a different and good reason. Instead, 
put the CD image as a file into your root partition and boot from there 
using GRUB. There is plenty of information about how to boot an ISO 
image from GRUB in its manual and scattered in the web. For example, 
with a very quick search I found this: 
<http://xmodulo.com/boot-iso-image-from-grub.html>; do your own research.

A web search will bring more information about resizing in general. 
Resizing is a common task when installing operating systems. *I heavily 
recommend against using Google.* Google has way too much power and don't 
uses it for good (neither it should have that much power in the first 
place). For example, DuckDuckGo comes pre-configured in Iceweasel; it 
promises to not to track, and it isn't an Internet tyrant (unlike 
Google), so consider using it instead.

Standard recommendation of making a backup applies.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to Rezize Partition on LVM ray <ray@aarden.us> - 2015-10-24 03:30 +0200
  Re: How to Rezize Partition on LVM Charlie Kravetz <cjk@teamcharliesangels.com> - 2015-10-24 04:40 +0200
  Re: How to Rezize Partition on LVM Mario Castelán Castro <marioxcc.MT@yandex.com> - 2015-10-24 04:40 +0200
  Re: How to Rezize Partition on LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-10-24 17:50 +0200
    Re: How to Rezize Partition on LVM ray <ray@aarden.us> - 2015-10-25 14:00 +0100
      Re: How to Rezize Partition on LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-10-25 16:00 +0100
        Re: How to Rezize Partition on LVM ray <ray@aarden.us> - 2015-10-25 20:10 +0100
        Re: How to Rezize Partition on LVM ray <ray@aarden.us> - 2015-10-25 20:30 +0100
          Re: How to Rezize Partition on LVM Mario Castelán Castro <marioxcc.MT@yandex.com> - 2015-10-25 20:50 +0100
            Re: How to Resize Partition on LVM ray <ray@aarden.us> - 2015-10-26 02:50 +0100
              Re: How to Resize Partition on LVM Mario Castelán Castro  <marioxcc.MT@yandex.com> - 2015-10-26 03:20 +0100
              Re: How to Resize Partition on LVM Pascal Hambourg <pascal@plouf.fr.eu.org> - 2015-10-26 10:00 +0100
                Re: How to Resize Partition on LVM Mario Castelán Castro  <marioxcc.MT@yandex.com> - 2015-10-26 15:20 +0100
                Re: How to Resize Partition on LVM ray <ray@aarden.us> - 2015-10-27 05:10 +0100

csiph-web