Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-14-2013, 05:03 PM
|
#1
|
Member
Registered: Oct 2010
Posts: 606
Rep:
|
Adding a New Disk and LVM
Hi!
If I add a new extra disk to my Linux Server, after creating one whole partition on the new disk (fdisk /dev/sda), I run the following commands:
Code:
pvcreate /dev/sda4
vgextend myVG /dev/sda4
Then I also grow /extend my current LV.
Don't we have to format the new partition by running a command such as "mkfs.ext3 /dev/sda4"?
Two days ago I worked on a Change and the disk formatting step was not there. I just realized it. I don't know how things worked without any issue.
However, before creating the new partition, these commands were used:
Code:
=> hpacucli ctrl slot=0 logicaldrive 1 modify size=max
=> hpacucli ctrl slot=0 logicaldrive 2 modify size=max
I am not familiar with hpacucli, though. Did that thing eliminated the need for formatting the new partition?
|
|
|
11-14-2013, 05:17 PM
|
#2
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348
Rep: 
|
First of all, how did your new disk end up as /dev/sda? How come none of your existing drives show up as /dev/sda? And if you created a single partition on the new drive, why did it end up as /dev/sda4? It seems a bit odd.
Anyway, you've added a new Physical Volume to the Volume Group, and extended the Logical Volume. This means you've extended the device (in this case, the LV) on which the file system resides, but not the file system itself.
Do NOT run any version of mkfs against a partition or device that's part of an LVM Volume Group! It could destroy the entire VG and any Logical Volumes inside it.
Instead, you should run resize2fs to update the file system structures to reflect the new device size. For ext2/3/4, you can do this while the file system is mounted.
hpacucli is a command line interface used to configure RAID arrays on HP Smart controllers. It has nothing to do with LVM or file systems.
(By the way, are you sure you didn't want to extend the RAID array rather than the LVM drive?)
|
|
1 members found this post helpful.
|
11-14-2013, 05:46 PM
|
#3
|
Member
Registered: Oct 2010
Posts: 606
Original Poster
Rep:
|
Let me share the steps mentioned in the Change in which I was asked to jump in at Step 5 given below. So, I did not perform all the steps. I was handed over the case when my colleague had already completed the first 4 steps given below. i have indicated this by inserting this line: I STARTED WORKING ON THIS ACTIVITY FROM HERE:
Code:
Step 1: Ask the onsite person to replace physicaldrive 1I:1:4 (port 1I:box 1:bay 4,146 GB)
=> hpacucli ctrl all show config
=> hpacucli controller slot=0 logicaldrive all show
(will show the drive status e.g. OK/Rebuilding/Ready for rebuild)
Once drive rebuilding is complete.
Step 2: Ask the onsite person to replace physicaldrive 1I:1:3 (port 1I:box 1:bay 3, 146 GB)
=> hpacucli ctrl all show config
=> hpacucli controller slot=0 logicaldrive all show
(will show the drive status e.g. OK/Rebuilding/Ready for rebuild)
Once drive rebuilding is complete.
Step 3 ask the onsite person to replace physicaldrive 1I:1:2 (port 1I:box 1:bay 2, 146 GB)
=> hpacucli ctrl all show config
=> hpacucli controller slot=0 logicaldrive all show
(will show the drive status e.g. OK/Rebuilding/Ready for rebuild)
Once drive rebuild complete.
Step 4: ask the onsite person to replace physicaldrive 1I:1:1 (port 1I:box 1:bay 1, 146 GB)
=> hpacucli ctrl all show config
=> hpacucli controller slot=0 logicaldrive all show
(will show the drive status e.g. OK/Rebuilding/Ready for rebuild)
Once drive rebuilding is complete.
====================================
Step 5
once all drive replace check drive status
=> hpacucli ctrl all show config
expand logical drive size.
=> hpacucli ctrl slot=0 logicaldrive 1 modify size=max
=> hpacucli ctrl slot=0 logicaldrive 2 modify size=max
=> hpacucli ctrl all show config
check disk size in fdisk
=> fdisk -l (if not showing the new size reboot the server)
I STARTED WORKING ON THIS ACTIVITY FROM HERE:
reboot the server(if not showing the any extra unallocated/free space)
=> shutdown -r now
once the server up after reboot create new partition from unpartition/free space
=> fdisk /dev/<Disk>
Note: The <Disk> should be "sda" here. Run "fdisk -l" OR "cat /proc/partitions" commands to verify.
=> In the above step make sure that you specify a Linux LVM Type for the new partition and it has to be a Primary Partition.
=> pvresize /dev/sdb
=> shutdown -r now
=> run "pvcreate <parition>" on the new partition created above.
=> vgextend VolGroup01 <New Partition>
=> vgdisplay
OR vgscan
=> pvdisplay
OR pvscan
(We may not need to allocate all of the free space. So, let's allocate 250G as we did in the original case.)
=> lvextend -L +250G /dev/mapper/VolGroup01-app001
=> resize2fs /dev/mapper/VolGroup01
Verify that the total disk space has grown now:
=> df -h /app001
|
|
|
11-14-2013, 07:42 PM
|
#4
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348
Rep: 
|
I understand now. /dev/sda is a logical drive (one of two, according to the previous post) presented to the OS by the RAID controller.
You've just replaced all the drives in the array with larger drives, one by one, and told the RAID controller to extend the logical RAID devices. As a result, the /dev/sda device has grown, and you've opted to use this space to create a new partition, /dev/sda4 (as opposed to extending an existing partition).
A new LVM Physical Volume was created in this new partition, and the Physical Volume was used to extend an existing Volume Group. A Logical Volume was then extended to take advantage of the newly available space in the Volume Group.
It all sounds good. You just need to extend the file system with resize2fs and you'll be done.
Just out of curiosity: As it seems the RAID array contains two logical devices, does the second device appear as /dev/sdb? And did the second "modify" command issued in hpacucli cause it to grow in size, or did the first device get all the new disk space?
|
|
1 members found this post helpful.
|
11-15-2013, 12:52 PM
|
#5
|
Member
Registered: Oct 2010
Posts: 606
Original Poster
Rep:
|
Quote:
Originally Posted by Ser Olmy
Just out of curiosity: As it seems the RAID array contains two logical devices, does the second device appear as /dev/sdb? And did the second "modify" command issued in hpacucli cause it to grow in size, or did the first device get all the new disk space?
|
You are right! I saw /dev/sdb and I was asked just to run "pvresize" on that one.
|
|
|
All times are GMT -5. The time now is 08:03 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|