Il giorno dom, 14/06/2015 alle 12.29 +0300, Angelo Moreschini ha
scritto:
Ciao Dario,
I need a little explanation, because I am not able to well
understood about how to get of the value of the free space.
I made some tests:
using the command pvscan I get this output:
-----
PV /dev/sda2 VG fedora_localhost lvm2 [931.02 GiB / 64.00 MiB
free]
Total: 1 [931.02 GiB] / in use: 1 [931.02 GiB] / in no VG: 0 [0 ]
-----
what means this ?
I can think this output concern ALL the Volume Group of LVM:
And the row up seem to indicate that they are (only) 64 MB free
(but what means "/ in no VG: 0 [0 ]" in the row down?)
I made the same test (inside the lvm environment) using the command
lvscan:
this time I got this output:
-----
lvm> lvscan
ACTIVE '/dev/fedora_localhost/swap' [7.75 GiB] inherit
ACTIVE '/dev/fedora_localhost/home' [873.21 GiB] inherit
ACTIVE '/dev/fedora_localhost/root' [50.00 GiB] inherit
----- OK! the total is 930.96 ------
that the second control confirm the former one, and it shows also
more details...
But what does not enter in my head, is the fact that the (huge)
quantity of free space (845449680 ) of the "home" partition is not
reported when I used the command pvscan : ...
This is the output of the command line df -k:
-----
[angelo_dev@localhost ~]$ df -k
Filesystem 1K-blocks Used
Available Use% Mounted on
/dev/mapper/fedora_localhost-root 51475068 10518776
38318468 22% /
devtmpfs 4046300 0
4046300 0% /dev
tmpfs 4057324 152
4057172 1% /dev/shm
tmpfs 4057324 904
4056420 1% /run
tmpfs 4057324 0
4057324 0% /sys/fs/cgroup
tmpfs 4057324 668
4056656 1% /tmp
/dev/mapper/fedora_localhost-home 901125392 9878132 845449680
2% /home
/dev/sda1 487652 105670
352286 24% /boot
tmpfs 811468 28
811440 1% /run/user/1001
-----
in short: I would like understand because I have to ask (shrink) free
space, in order to expand the swap partition - in the moment that -
the home partition (THAT BELONGS TO THE SAME VG) already has a huge
amount of free space ?
The free space is into filesystem, and not into LVM.
The free space into
filesystem is not useful vie LVM,
You must be transferred a little bit
of free space from filesystem to LVM
Shrink filesystem then shrink LVM
partition.
When you install Fedora, and do not do a manual partition, anaconda use all disk space for
all default partition, swap(8Gb), /(50 Gb) and /home (all the rest), 900Gb in your case.
Then now, you have a huge /home, filling for 9Gb (2%), and 0 Gb of LVM free for extend
other FS or Swap.
When I install, I do not allocate all space but only a little bit (or what I have need)
for my filesystem. Because, after, is more simple extend rater than shrink.
Now I suggest you to shrink /home to 200 Gb (or what do you want) and leave more free
space to assign where it's necessary or create new volume.
To do that follow the my previous generic procedure.
If you have ext4 FS (blkid is your friend), after you have unmount /home, the command
are:
sudo umount /dev/fedora_localhost/home # umount fs
sudo fsck.ext4 -f /dev/fedora_localhost/home # check fs
sudo resize2fs /dev/fedora_localhost/home 190G # shrink fs to a little bit less what you
want
sudo lvresize --size 200G /dev/fedora_localhost/home # Resize partition to what you want
sudo resize2fs /dev/fedora_localhost/home # extend the FS to partition size, what you
want.
sudo mount -a
sudo pvscan
At this point you'll have a lot of free space to do whatever you want.
IMPORTANT:
Before of all, do a full backup of your important data, if I or you have written something
wrong , you will need to reinstall from scratch
Ciao.
--
Dario Lesca
(inviato dal mio Linux Fedora 22 con Gnome 3.16)