LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-19-2016, 03:14 PM   #1
gatsby
Member
 
Registered: Jan 2006
Posts: 58

Rep: Reputation: 16
Add space to RHEL7 without a reboot?


Hello -

I was wondering how folks handle the situation to add disk space to a logical volume without rebooting the system.

If I have a VM and expand the virtual disk, I use fdisk to create the partition. However, when I execute partprobe, it sometimes tells me I need to reboot to have the partition table re-read. I've heard of partx allowing you to re-read the partition table without the reboot but am wondering what peoples' experience is with that.

Once the partition is creating, I can use pvcreate to turn the partition into a physical volume, then use vgextend to add it to a volume group and then extend the LVM.

But that partprobe bit is where the reboot seems most likely to be needed.

Thanks

Last edited by gatsby; 05-19-2016 at 03:21 PM.
 
Old 05-19-2016, 04:07 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Instead of expanding the old disk, add a new disk. Then on the VM, rescan the disk busses, partition the new disk, pvcreate/vgextend/lvextend/resize2fs.
 
Old 05-23-2016, 10:30 AM   #3
gatsby
Member
 
Registered: Jan 2006
Posts: 58

Original Poster
Rep: Reputation: 16
Does anyone expand the existing virtual disk and then add the new space to the LV without a reboot? Just curious if there are any reliable alternatives to resizing that way without a reboot.
 
Old 12-09-2018, 11:11 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,074

Rep: Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813
If you add a new partition, rather than resizing an existing one, then partprobe should succeed in making that new partition available to the kernel. Then you can add that partition to the LVM volume group and extend existing LVs into that space.
 
Old 12-09-2018, 03:48 PM   #5
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 331

Rep: Reputation: 50
Always avoid to use partitions when this possible.

I use partitions only for bootable system disk.
The data disk has PV on whole disk; then you need only re-scan resized disk, pvresize, then lvresize and finally resizefs.

Why do you need a partition, if it will be the only one on the disk ? No pros, only contras.
 
Old 12-09-2018, 08:44 PM   #6
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 2,228

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
Quote:
Originally Posted by voleg View Post
Why do you need a partition, if it will be the only one on the disk ? No pros, only contras.
This becomes off-topic, but the pro of creating a single partition is that the disk is clearly marked as in-use. In addition, if you give the partition the right type (LVM in this case), this documents its intended use.

If people without UNIX/Linux background have access to the same storage as you (think LUNs on a disk array in a datacenter), a non-partitioned disk looks to them like nobody uses it.

This is less of a problem if you are alone, but imagine you inspect a disk a few years after setting it up. A partition could help you understand what it is for.
 
Old 12-09-2018, 08:54 PM   #7
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 2,228

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
Quote:
Originally Posted by gatsby View Post
If I have a VM and expand the virtual disk, I use fdisk to create the partition. However, when I execute partprobe, it sometimes tells me I need to reboot to have the partition table re-read.
This is so because the in-memory copy of the partition table is in use. Usually that's so for the root disk. I don't think there is anything you can do except reboot.
Quote:
I've heard of partx allowing you to re-read the partition table without the reboot but am wondering what peoples' experience is with that.
Personally, I don't know partx, and its man page doesn't make it clear to me how it differs from partprobe. I have used partprobe, but it only tells the kernel that the partitioning on the disk might have changed; it can't force the kernel to actually re-read the disk.

To add to the confusion, there is a command kpartx, which does something different. It creates device mapper devices that reflect the partitioning of a physical disk, and it's mostly (or exclusively) used on multipath devices.

Last edited by berndbausch; 12-09-2018 at 08:56 PM.
 
Old 12-09-2018, 10:54 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,074

Rep: Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813Reputation: 1813
Quote:
Originally Posted by berndbausch View Post
To add to the confusion, there is a command kpartx, which does something different. It creates device mapper devices that reflect the partitioning of a physical disk, and it's mostly (or exclusively) used on multipath devices.
kpartx is also very useful when you have a file that is an image of a complete, partitioned disk. kpartx will create /dev/mapper entries for each of those internal partitions.
 
1 members found this post helpful.
  


Reply

Tags
lvm, partitioning, red hat linux


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
Unable to install RHEL7 KVM onto RHEL7 desktop redhatprat Red Hat 10 02-18-2015 04:44 AM
Reboot computer after partitition add jlinkels Linux - Software 22 01-12-2009 02:20 AM
`df -k` is not updating the right space status without reboot Narayandutt Linux - Server 2 11-20-2007 01:40 AM
add space to / when from spare space on disk ctsiow Linux - General 4 11-07-2007 08:55 AM
How to add RAID1 without a reboot G../ Linux - Newbie 1 07-20-2002 11:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:41 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration