LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   debian 8 / extend to use full drive (https://www.linuxquestions.org/questions/linux-server-73/debian-8-extend-to-use-full-drive-4175599753/)

MrCoolLV 02-14-2017 01:45 PM

debian 8 / extend to use full drive
 
Hello, im looking for a way to expand the storage (lvextend -l +100%FREE /dev/mapper/debian--vg-root) but im being very careful as is an live production server i manged to get the other system done just fine months ago but forgotten the steps

storage is 1.3TB as you can see on fdisk, but on /dev/mapper/debian--vg-root is only showing 119GB. any help will be great thanks

root@mx:~# fdisk -l
Quote:

Disk /dev/sda: 1.3 TiB, 1395864371200 bytes, 2726297600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1652c7ed

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 499711 497664 243M 83 Linux
/dev/sda2 501758 251656191 251154434 119.8G 5 Extended
/dev/sda5 501760 251656191 251154432 119.8G 8e Linux LVM

Disk /dev/mapper/debian--vg-root: 114.9 GiB, 123337703424 bytes, 240893952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/debian--vg-swap_1: 4.9 GiB, 5251268608 bytes, 10256384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@mx:~# df -l
Quote:

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/dm-0 118425900 16125332 96261836 15% /
udev 10240 0 10240 0% /dev
tmpfs 2004064 213800 1790264 11% /run
tmpfs 5010156 88 5010068 1% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 5010156 0 5010156 0% /sys/fs/cgroup
/dev/sda1 240972 33620 194911 15% /boot
tmpfs 1002032 12 1002020 1% /run/user/1000
tmpfs 1002032 0 1002032 0% /run/user/0
root@mx:~# pvdisplay
Quote:

--- Physical volume ---
PV Name /dev/sda5
VG Name debian-vg
PV Size 119.76 GiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 30658
Free PE 0
Allocated PE 30658
PV UUID dXxbLy-2Kf5-kCEh-8gWa-JBKl-5Arx-h3zGEl
root@mx:~# vgdisplay
Quote:

--- Volume group ---
VG Name debian-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 119.76 GiB
PE Size 4.00 MiB
Total PE 30658
Alloc PE / Size 30658 / 119.76 GiB
Free PE / Size 0 / 0
VG UUID 6ckK2L-IaM8-fZOK-i6qD-DPpN-VdBz-KpZTbT

r3sistance 02-14-2017 02:10 PM

Expanding a partition does not automatically resize the filing system it contains

There was a thread recently with the same issue: http://www.linuxquestions.org/questi...ce-4175599382/

the answer you seek is probably in there :).

syg00 02-14-2017 07:15 PM

Go get a good LVM guide - the RHEL LVM admin guide is one such. It is available (from RH) for free download, no registration required.
The pv needs to be enlarged first, then the vg, and lastly the lv. Then as suggested, the filesystem - fsadm will likely do the last two at once for you, depending on filesystem.
Rather than mess with enlarging the pv, a safer (and preferred by me) option is to create a new pv on the free space and add it to the vg, then processd as normal. See the admin guide above.

MrCoolLV 02-15-2017 11:53 AM

Quote:

Originally Posted by syg00 (Post 5670666)
Go get a good LVM guide - the RHEL LVM admin guide is one such. It is available (from RH) for free download, no registration required.
The pv needs to be enlarged first, then the vg, and lastly the lv. Then as suggested, the filesystem - fsadm will likely do the last two at once for you, depending on filesystem.
Rather than mess with enlarging the pv, a safer (and preferred by me) option is to create a new pv on the free space and add it to the vg, then processd as normal. See the admin guide above.

just to be clear, you like me to add /dev/sba6 ?

i try this before seems not to work
http://unix.stackexchange.com/questi...lling-linux-or

rknichols 02-15-2017 12:35 PM

Your extended partition is using just 119.8GB, and not the full 1.3TB of the disk. It is fully used by sda5. To create a logical partition sda6 you first have to enlarge the extended partition. You can do that with gparted and create sda6. Since you presently have just 2 primary partitions, you could also just create sda3 in the available ~1.24TB. Either of those is going to require a reboot to let the kernel use the new partitioning.

MrCoolLV 02-15-2017 12:44 PM

Quote:

Originally Posted by rknichols (Post 5671029)
Your extended partition is using just 119.8GB, and not the full 1.3TB of the disk. It is fully used by sda5. To create a logical partition sda6 you first have to enlarge the extended partition. You can do that with gparted and create sda6. Since you presently have just 2 primary partitions, you could also just create sda3 in the available ~1.24TB. Either of those is going to require a reboot to let the kernel use the new partitioning.



thank you, question no way to just expand sda5 ?

rknichols 02-15-2017 04:14 PM

Quote:

Originally Posted by MrCoolLV (Post 5671038)
thank you, question no way to just expand sda5 ?

If you expand the extended partition (sda2), then you will be able to expand sda5. After you expand sda5, you will then need to tell LVM to expand the LVM physical volume to use the space. Just run "pvresize /dev/sda5". The space will then be available to expand logical volumes or create new ones. If you do expand an LV, don't forget to use the "--resizefs" option to adjust the filesystem structure too.

MrCoolLV 02-15-2017 04:29 PM

Quote:

Originally Posted by rknichols (Post 5671130)
If you expand the extended partition (sda2), then you will be able to expand sda5. After you expand sda5, you will then need to tell LVM to expand the LVM physical volume to use the space. Just run "pvresize /dev/sda5". The space will then be available to expand logical volumes or create new ones. If you do expand an LV, don't forget to use the "--resizefs" option to adjust the filesystem structure too.

I think i understand but to confirm

1. pvresize /dev/sda5
2. resize2fs /dev/dm-0 +900G
3. lvextend -L+900G /dev/debian-vg/root --resizefs

rknichols 02-15-2017 04:36 PM

Quote:

Originally Posted by MrCoolLV (Post 5671136)
I think i understand but to confirm

1. pvresize /dev/sda5
2. resize2fs /dev/dm-0 +900G
3. lvextend -L+900G /dev/debian-vg/root --resizefs

You do not need step 2 (and it's out of order anyway -- should be last). The "--resizefs" in the lvextend command will take care of resizing the filesystem at the proper time. And really the command should be
Code:

lvextend -L+900G --resizefs /dev/debian-vg/root
The way you write it is probably OK.

MrCoolLV 02-15-2017 04:39 PM

Quote:

Originally Posted by rknichols (Post 5671141)
You do not need step 2 (and it's out of order anyway -- should be last). The "--resizefs" in the lvextend command will take care of resizing the filesystem at the proper time. And really the command should be
Code:

lvextend -L+900G --resizefs /dev/debian-vg/root
The way you write it is probably OK.


this is the message i got

Physical volume "/dev/sda5" changed
1 physical volume(s) resized / 0 physical volume(s) not resized

root@mx:~# lvextend -L+900G /dev/debian-vg/root --resizefs
Insufficient free space: 230400 extents needed, but only 0 available
root@mx:~#

MrCoolLV 02-15-2017 04:41 PM

with corrected line #2



root@mx:~# pvresize /dev/sda5
Physical volume "/dev/sda5" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
root@mx:~# lvextend -L+900G --resizefs /dev/debian-vg/root
Insufficient free space: 230400 extents needed, but only 0 available
root@mx:~# ^C

rknichols 02-15-2017 04:44 PM

What does "pvdisplay" report now?

michaelk 02-15-2017 04:49 PM

rknichols,
I do not think /dev/sda2 was resized yet?

MrCoolLV 02-15-2017 04:50 PM

thank you for helping

root@mx:~# pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name debian-vg
PV Size 119.76 GiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 30658
Free PE 0
Allocated PE 30658
PV UUID dXxbLy-2Kf5-kCEh-8gWa-JBKl-5Arx-h3zGEl

rknichols 02-15-2017 04:51 PM

@michaelk -- The pvresize command reported success ("1 physical volume(s) resized...").

Oops, you're right. There was no explicit size request there.

@MrCoolLV -- You need to resize the partitions first.


All times are GMT -5. The time now is 11:53 AM.