• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

Mount two disks in Linux CentOS

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
bqamarauli
Asked:
bqamarauli
  • 3
  • 3
1 Solution
 
Dave GouldOnsite SupportCommented:
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
 
bqamarauliAuthor Commented:
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
 
Dave GouldOnsite SupportCommented:
please show the result of fdisk -l and pvdisplay
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
bqamarauliAuthor Commented:
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
 
Dave GouldOnsite SupportCommented:
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
 
bqamarauliAuthor Commented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now