Re: How to Rezize Partition on LVM

2015-10-25 Thread ray
I would like to than everyone for the input.  Here is how it was completed:

Boot into GUI mycomp as root

# df -h
FilesystemSize  Used Avail Use% Mounted on
/dev/dm-0 8.2G  2.9G  4.9G  38% /
udev   10M 0   10M   0% /dev
tmpfs 3.2G  9.2M  3.2G   1% /run
tmpfs 7.9G   68K  7.9G   1% /dev/shm
tmpfs 5.0M  4.0K  5.0M   1% /run/lock
tmpfs 7.9G 0  7.9G   0% /sys/fs/cgroup
/dev/sda1 236M   46M  178M  21% /boot
/dev/mapper/mycomp--vg-var   2.7G  351M  2.2G  14% /var
/dev/mapper/mycomp--vg-tmp   360M  2.1M  335M   1% /tmp
/dev/mapper/mycomp--vg-home  427G  136M  405G   1% /home
tmpfs 1.6G  4.0K  1.6G   1% /run/user/118
tmpfs 1.6G  8.0K  1.6G   1% /run/user/0
root@mycomp:~# resize2fs /dev/mapper/mycomp--vg-home 5G
Filesystem at /dev/mapper/mycomp--vg-home is mounted on /home; on-line resizing 
required
resize2fs: On-line shrinking not supported

Rebooting into command line interface for root worked, the /home partition was 
not mounted.

---

# lvreduce -L 5G /dev/mapper/mycomp--vg-home
  WARNING: Reducing active and open logical volume to 5.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce home? [y/n]: y
  Size of logical volume mycomp-vg/home changed from 433.32 GiB (110931 
extents) to 5.00 GiB (1280 extents).
  Logical volume home successfully resized



Re: How to Rezize Partition on LVM

2015-10-25 Thread Mario Castelán Castro

El 25/10/15 a las 13:03, ray escribió:

Now that the /home logical volume has been reduced, I would like to add a 
partition in the remaining space or reduce the LV's size to fee the unused 
space and create a new logical volume. Since the existing LV totally occupies 
the SSD, I don't see how to do this.

I would appreciate any suggestions on how to complete this.


It seems like confusing LV with PV. An *LVM group* presents itself to 
the block devices that contains it as a *physical volume* (PV), in turn, 
LVM provides *logical volumes* (LV) over which you may place 
filesystems. Don't confuse those 3 concepts. If you want to make a 
partition outside LVM, you would have to reduce the LVM physical volume, 
not the LVM logical volume (which you already did).


If you already reduced the filesystem and the logical volume, then there 
is free space within your LVM volume group; there may be no "free space 
in the SSD" (space not assigned to any partition or the MBR), but that 
is how it is supposed to be. The reason to use LVM is to put filesystems 
in logical volumes within your volume group to get the benefits of 
logical volume management, not as partitions outside your volume group, 
because you lose those benefits.


You can create logical volumes with "lvcreate". Read the manual!

  man lvm



Re: How to Rezize Partition on LVM

2015-10-25 Thread Pascal Hambourg
ray a écrit :
> I would like to than everyone for the input.  Here is how it was completed:
> 
> Boot into GUI mycomp as root

I thought that logging as root was prohibited by GUI display managers.

> # df -h
> FilesystemSize  Used Avail Use% Mounted on
(...)
> /dev/mapper/mycomp--vg-home  427G  136M  405G   1% /home
(...)
> root@mycomp:~# resize2fs /dev/mapper/mycomp--vg-home 5G
> Filesystem at /dev/mapper/mycomp--vg-home is mounted on /home; on-line 
> resizing required
> resize2fs: On-line shrinking not supported

You need to unmount /home first. If you're logged as root, it should work.

> Rebooting into command line interface for root worked, the /home partition 
> was not mounted.

What do you call "command line interface for root" ? Single user mode ?

> # lvreduce -L 5G /dev/mapper/mycomp--vg-home
>   WARNING: Reducing active and open logical volume to 5.00 GiB
>   THIS MAY DESTROY YOUR DATA (filesystem etc.)
> Do you really want to reduce home? [y/n]: y
>   Size of logical volume mycomp-vg/home changed from 433.32 GiB (110931 
> extents) to 5.00 GiB (1280 extents).
>   Logical volume home successfully resized

I hope you reran the resize2fs command successfully before doing this.
Otherwise you just ruined your /home filesystem.



Re: How to Rezize Partition on LVM

2015-10-25 Thread ray
On Sunday, October 25, 2015 at 10:00:08 AM UTC-5, Pascal Hambourg wrote:
> (...)
> I thought that logging as root was prohibited by GUI display managers.
That is what I have read.  But I tried it anyway and found it to work.

> (...)
> I hope you reran the resize2fs command successfully before doing this.
> Otherwise you just ruined your /home filesystem.
I did not make a record of that so I am not sure whether I reran resize2fs.   
This system has been reboot a few times since then and many configurations 
altered.  I haven't noticed a failure.



Re: How to Rezize Partition on LVM

2015-10-25 Thread ray
Now that the /home logical volume has been reduced, I would like to add a 
partition in the remaining space or reduce the LV's size to fee the unused 
space and create a new logical volume. Since the existing LV totally occupies 
the SSD, I don't see how to do this.

I would appreciate any suggestions on how to complete this.



Re: How to Rezize Partition on LVM

2015-10-24 Thread Pascal Hambourg
ray a écrit :
> I would like to resize the /home partition but it is mounted, and when
> umount is run, it errors with 'busy'.  
> 
> 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.  

Are you talking about plain partitions or LVM logical volumes ? In the
subject you mentionned LVM, but in the body you mention only partitions.
Regarding your question, this is not the same at all.

It is too late now, but here is my advice for future installations using
LVM : if you don't plan to use btrfs, don't allocate all the space to
the logical volumes, leave some free space for future allocation.
Growing an ext2/3/4 filesystem is easy and can be done online (without
unmounting it). However online shrinking is only supported with a btrfs
filesystem. Some filesystems such as XFS don't even allow offline shrinking.

/home can be unmounted only when no process uses it. In practice it
means that you cannot be logged in as a regular user (with its home
directory in /home) but directly as root, without using 'su' or 'sudo'.
In my experience it is not necessary to boot in single user mode or from
another system. Just log in as root in a tty console.



Re: How to Rezize Partition on LVM

2015-10-23 Thread Charlie Kravetz
On Fri, 23 Oct 2015 18:05:55 -0700 (PDT)
ray  wrote:

>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?
>

I have always booted from a live cd or usb to do the resizing. That
keeps the partition from being mounted.

-- 
Charlie Kravetz
Linux Registered User Number 425914
[http://linuxcounter.net/user/425914.html]
Never let anyone steal your DREAM.   [http://keepingdreams.com]



Re: How to Rezize Partition on LVM

2015-10-23 Thread Mario Castelán Castro

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 
40286720 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: 
; 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.



How to Rezize Partition on LVM

2015-10-23 Thread ray
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?