LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-11-2018, 05:08 AM   #1
zio_mangrovia
LQ Newbie
 
Registered: Jun 2018
Posts: 13

Rep: Reputation: Disabled
change disk partitions without reboot


iN cENTOS 6 I noted 2 different behaviour in LVM if I create Physical Volume to whole disk e.g. /dev/sda or if I create a PV to /dev/sda1, in both cases /dev/sda or /dev/sda1 are "Linux LVM - 8e".

If I need to increase size fo /dev/sda PV, I increase my physical disk (e.g. in VMware environment), I assure myself new disk size is detected by kernel (no reboot is necessary), I resize PV, LV and File System and I reach my target with no reboot server.
In second case that is /dev/sda1 (when I have LVM partition and not whole disk) I need to reboot server otherwise kernel is not able to detect new Physical volume size. There is way to make it with no reboot ?
i THINK kernel has the partition table in memory (2nd case) while if I'm using a partition-tables-less disk (1st case) It's necessary no boot.
 
Old 10-11-2018, 10:40 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,047

Rep: Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798
I don't know of any way to make the kernel accept new partitioning while the disk is in use, but consider just adding another disk with just the added space and adding that new disk to the volume group. If you want to clean things up at some later time when you are rebooting, enlarge that first disk, boot, and then pvmove the LVM extents on the second disk back to the first. Once you've done that, you can remove the second disk from the volume group and delete it. Yes, you can do pvmove while the system is running.
 
Old 10-11-2018, 11:28 AM   #3
zio_mangrovia
LQ Newbie
 
Registered: Jun 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Here is my method applied in 1st, whole disk is linux LVM

increase vmware disk size
echo 1 > /sys/class/scsi_device/x:y:z:k/device/rescan
pvresize /dev/sdx
lvextend -l +100%FREE /dev/...
xfs_growfs /dev/...

This procedure works only disk has no partitions, /dev/sdd:


Quote:
I don't know of any way to make the kernel accept new partitioning while the disk is in use
infact this method works only when disk has no partitions.
 
Old 10-11-2018, 11:35 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,714

Rep: Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380
Quote:
iN cENTOS 6 I noted 2 different behaviour in LVM if I create Physical Volume to whole disk e.g. /dev/sda or if I create a PV to /dev/sda1, in both cases /dev/sda or /dev/sda1 are "Linux LVM - 8e".
As far as I know the behavior is the same regardless if using the whole disk or a partition.

Yes the partition table is in memory and may not be automatically reread after using a partitioning utility. There are other utilities to reread the MBR/partition table which might work i.e. partx or partprobe.
 
Old 10-11-2018, 11:49 AM   #5
zio_mangrovia
LQ Newbie
 
Registered: Jun 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
As far as I know the behavior is the same regardless if using the whole disk or a partition.
No, this one is not the same behaviour, you should try it with both methods

Quote:
Yes the partition table is in memory and may not be automatically reread after using a partitioning utility. There are other utilities to reread the MBR/partition table which might work i.e. partx or partprobe
In first case (the whole disk) I don't understand, because you says partition table if I don't use disk 'fdisk command' to change partition table but I change only VMware disk size. I have no partitions inside disk

Last edited by zio_mangrovia; 10-11-2018 at 02:41 PM.
 
Old 10-11-2018, 02:36 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,047

Rep: Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798
Quote:
Originally Posted by michaelk View Post
Yes the partition table is in memory and may not be automatically reread after using a partitioning utility. There are other utilities to reread the MBR/partition table which might work i.e. partx or partprobe.
You will find that, for this situation, partprobe will be unable to load the new table. (I tried it.)
 
Old 10-11-2018, 02:44 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,714

Rep: Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380Reputation: 2380
Thanks for the info.
 
Old 10-12-2018, 02:46 PM   #8
zio_mangrovia
LQ Newbie
 
Registered: Jun 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
I don't know of any way to make the kernel accept new partitioning while the disk is in use, but consider just adding another disk with just the added space and adding that new disk to the volume group. If you want to clean things up at some later time when you are rebooting, enlarge that first disk, boot, and then pvmove the LVM extents on the second disk back to the first. Once you've done that, you can remove the second disk from the volume group and delete it. Yes, you can do pvmove while the system is running.
this way permits to increase disk numbers while I want to keep the same disk.
What reason for similar behaviour for 1st and 2nd according to your opinion?
 
Old 10-12-2018, 05:16 PM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,047

Rep: Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798
Quote:
Originally Posted by zio_mangrovia View Post
What reason for similar behaviour for 1st and 2nd according to your opinion?
Please clarify your question. I'm not sure what you are asking. I don't know any way to expand that partition without either rebooting or at least temporarily adding a second disk.
 
Old 10-15-2018, 09:26 AM   #10
zio_mangrovia
LQ Newbie
 
Registered: Jun 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
Please clarify your question.
I'm searching 2 answers:
  1. 1st case (disk has no partitions): Why am I able to modify physical volume size and to detect immediately it without reboot? Because It doesn't exist partitions table loaded into kernel?
  2. 2nd case (disk has LVM partitions): If I don't want to add other disks and I want to resize my disk, I have to make reboot ? There are no solutions? Right?
now I hope my questions are more clear
 
Old 10-15-2018, 09:45 AM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,047

Rep: Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798Reputation: 1798
Actually, I find it a bit surprising that the kernel will recognize a changed size of an active disk. Any explanation of why those two cases differ would be pure speculation on my part. You will just have to accept that there is no way to get the kernel to recognize a changed partition size without rebooting.
 
  


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
[SOLVED] what is a logical partitions and group partitions and how to check disk space on a partition ITareliteralyMyInitials Linux - Newbie 10 02-08-2016 12:19 PM
Disk partitions missing after reboot samBl Linux - Hardware 6 06-29-2011 08:47 PM
How to change disk size by editing disk information on the hard disk? xptchina Linux - Virtualization and Cloud 2 12-16-2010 09:12 AM
Change primary partitions to logical partitions AND migrate their data? chickenlinux Linux - Hardware 10 04-04-2010 05:31 PM
name change in /etc/hosts and reboot doesnt change name aussieaubs Linux - Newbie 5 06-26-2009 09:40 AM

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

All times are GMT -5. The time now is 12:11 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