Solved

Mount two disks in Linux CentOS

Posted on 2014-02-20
6
552 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 5

Accepted Solution

by:
Dave Gould earned 400 total points
ID: 39873229
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
ID: 39873276
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
ID: 39873347
please show the result of fdisk -l and pvdisplay
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 1

Author Comment

by:bqamarauli
ID: 39873351
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
ID: 39873406
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
ID: 39873416
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Teach the user how to edit .vmx files to add advanced configuration options Open vSphere Web Client: Edit Settings for a VM: Choose VM Options -> Advanced: Add Configuration Parameters:
This Micro Tutorial steps you through the configuration steps to configure your ESXi host Management Network settings and test the management network, ensure the host is recognized by the DNS Server, configure a new password, and the troubleshooting…

749 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