Solved

Mount two disks in Linux CentOS

Posted on 2014-02-20
6
556 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
Teach the user how to configure vSphere clusters to support the VMware FT feature Open vSphere Web Client: Verify vSphere HA is enabled: Verify netowrking for vMotion and FT Logging is in place or create it: Turn On FT for a virtual machine: Verify …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

752 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