Solved

Mount two disks in Linux CentOS

Posted on 2014-02-20
6
539 Views
Last Modified: 2014-02-20
Hi,

I am new to Linux and need help with disk drives mount. Basically, I have CentOS 6 virtual server on VMware. It has two disk drives Disk1 (30GB) and Disk2 (40GB). When I run df -h in SSH I can only see Disk1 but cannot see Disk2.
What I want to do is to mount these two drives as one so I get 70GB disk space and then install Apache and MySQL on it to use as a webserver.

Could you please advise how to do it?

Thank you.
0
Comment
Question by:bqamarauli
  • 3
  • 3
6 Comments
 
LVL 5

Accepted Solution

by:
Dave Gould earned 400 total points
Comment Utility
So you need to increase the size of "Disk1" using LVM.
When you type "fdisk -l" what do you get?
You probably have /dev/sda which is configured correctly and /dev/sdb whis says that it does not contain a valid partition table. If this is the case, you need to create a new partition.
fdisk /dev/sdb
Command - n
select p (primary)
partition number  - 1
first cyl - "enter"
last - "enter"
Back to command prompt - t
select partition - 1
Hex code - 8e (used for Linux LVM)
Back to command prompt - w (to write the table to the disk)

Now if you go out and rerun fdisk -l your disk should be listed correctly.

Once the disk is ready, you need to run pvcreate /dev/sdb1
this will create a physical volume that will be added to the volume group

Check on the name of your current volume group with "vgdisplay"

Now you need to extend the existing volume group with the new disk:
vgextend the_name_of_the_existing_vg /dev/sdb1
           example vgextend volgrp1 /dev/sdb1
If you run the pvscan command, you will see that the disk /dev/sdb1 is now part of the volume group.

You now need to extenf the logical volume
Get the current lv name with the command "lvdisplay" (it should be something like /dev/yourvgname/root )
extent the current lv:
lvextend /dev/yourvgname/root /dev/sdb1

You can now resize the file system with - resize2fs the_lv_you_just_increased
   example : resize2fs /dev/yourvgname/root

now run df -h and your disk should have incorperated the extra capacity.
0
 
LVL 1

Author Comment

by:bqamarauli
Comment Utility
Hi,

Thank you for your reply. I've got to the point where I put vgdisplay command but when I run, it says "No volume groups found". Up until that everything went ok.

Am I missing something.
0
 
LVL 5

Expert Comment

by:Dave Gould
Comment Utility
please show the result of fdisk -l and pvdisplay
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Author Comment

by:bqamarauli
Comment Utility
Actually I found a way to resolve it. I ran two commands: pvscan and vgscan and after that I could see existing volume groups. Then I did the rest as you said and it worked perfectly.

This is a very helpful solution. Exactly what I wanted.

One quick question. I did this on a Linux Centos server where I do not have Apache or MySQL installed.
If I do the same on the machine which has Apache, MySQL and PHP installed, it won't break anything, right?
I just want to know if I have to be careful of something in case I am doing it on production server.

Thank you.
0
 
LVL 5

Expert Comment

by:Dave Gould
Comment Utility
You just increased an existing logical volume without any impact on the machine. You didn't lose any data from your "test" machine.
This is a tried and tested solution that works without affecting the existing data. Having said that, I always plan to do this kind of operation when the machine is less critical and always have a backup first. This is a VM so you you could take a snapshot if you want to be certain that you don't breat anything.
0
 
LVL 1

Author Comment

by:bqamarauli
Comment Utility
Yes, I absolutely agree with you regarding backups and I would never do anything like that without backup even if I knew it is a 100% bullet proof solution.

Thank you very much for your prompt responses and great solutions.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is an issue that we can get adding / removing permissions in the vCSA 6.0. We can also have issues searching for users / groups in the AD (using your identify sources). This is how one of the ways to handle this issues and fix it.
When we have a dead host and we lose all connections to the ESXi, and we need to find a way to move all VMs from that dead ESXi host.
Teach the user how to join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now