LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-14-2017, 01:45 PM   #1
MrCoolLV
LQ Newbie
 
Registered: Feb 2017
Posts: 11

Rep: Reputation: Disabled
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
 
Old 02-14-2017, 02:10 PM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
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 .

Last edited by r3sistance; 02-14-2017 at 02:33 PM.
 
Old 02-14-2017, 07:15 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,113

Rep: Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331
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.
 
Old 02-15-2017, 11:53 AM   #4
MrCoolLV
LQ Newbie
 
Registered: Feb 2017
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
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
 
Old 02-15-2017, 12:35 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,449

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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.
 
Old 02-15-2017, 12:44 PM   #6
MrCoolLV
LQ Newbie
 
Registered: Feb 2017
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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 ?
 
Old 02-15-2017, 04:14 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,449

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Quote:
Originally Posted by MrCoolLV View Post
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.
 
Old 02-15-2017, 04:29 PM   #8
MrCoolLV
LQ Newbie
 
Registered: Feb 2017
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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
 
Old 02-15-2017, 04:36 PM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,449

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Quote:
Originally Posted by MrCoolLV View Post
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.

Last edited by rknichols; 02-15-2017 at 04:38 PM.
 
Old 02-15-2017, 04:39 PM   #10
MrCoolLV
LQ Newbie
 
Registered: Feb 2017
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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:~#
 
Old 02-15-2017, 04:41 PM   #11
MrCoolLV
LQ Newbie
 
Registered: Feb 2017
Posts: 11

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-15-2017, 04:44 PM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,449

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
What does "pvdisplay" report now?
 
Old 02-15-2017, 04:49 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 20,473

Rep: Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569Reputation: 3569
rknichols,
I do not think /dev/sda2 was resized yet?
 
Old 02-15-2017, 04:50 PM   #14
MrCoolLV
LQ Newbie
 
Registered: Feb 2017
Posts: 11

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-15-2017, 04:51 PM   #15
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,449

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
@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.

Last edited by rknichols; 02-15-2017 at 04:53 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian server on Linode - drive is full norkers Linux - Server 9 01-16-2015 09:55 AM
format hard drive and add to existing hard drive to extend the capacity in linux boby.kumar Linux - Newbie 1 04-10-2013 07:18 AM
How to extend the Ubuntu Linux hard disk size to use full capacity ? albertwt Linux - Newbie 9 12-24-2010 01:22 AM
Is it possible to extend my VG and then LV to an attached usb drive ? itsakc Linux - Newbie 2 01-05-2009 07:24 AM
Is it possible to extend my VG and then LV to an attached usb drive ? itsakc Linux - Server 1 01-05-2009 05:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration