LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 11-14-2013, 05:03 PM   #1
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Rep: Reputation: 59
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?
 
Old 11-14-2013, 05:17 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,339

Rep: Reputation: Disabled
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.
Old 11-14-2013, 05:46 PM   #3
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
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
 
Old 11-14-2013, 07:42 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,339

Rep: Reputation: Disabled
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.
Old 11-15-2013, 12:52 PM   #5
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by Ser Olmy View Post
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.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an LVM hard disk to a system already running/using LVM firewiz87 Linux - Hardware 5 08-15-2010 12:59 AM
Mounting LVM Disk to non-LVM disk gak_92 Linux - Hardware 1 08-07-2009 03:34 AM
Problem adding new disk via in FD6 system-config-lvm BurntChips Fedora 0 11-16-2006 12:24 PM
LVM - adding a new scsi hard disk ddaas Red Hat 1 07-28-2005 02:13 AM
Adding drive with LVM DBabo Linux - Software 2 06-11-2005 10:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:59 AM.

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