LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-10-2008, 06:57 AM   #1
arshzia
LQ Newbie
 
Registered: Apr 2008
Posts: 27

Rep: Reputation: 15
how to mount one hard drive on another


Hello all,
I have linux4.6 installed on a workstation, i have 2 harddrives in it each of 300GB, one hard drive of 320GB is mounted on /DATA.Now iwant to add another hard drive of 320GB and want to mount on /DATA can i do that. if yes than how plz. explain me step by step. I have first hard drive sda, second sdb, third sdc.the /DATA is in sdb now iwant to mount sdc on /DATA.
plz reply me soon waiting for reply.
 
Old 08-10-2008, 07:13 AM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
First you can create a partition on sdc and write a filesystem to it (eg. ext3) - To do this you could use a nice
gui application: gparted or if it's not available then use a command line utility 'fdisk' (# fdisk /dev/sdc)
Be careful though not to delete your other partitions.

Once you've done it, you could see your partitions list by typing (as root):

Quote:
fdisk -l
You'll see /dev/sdc1

Create another folder in /DATA where you'll mount /dev/sdc1
Next step is mounting the /dev/sdc1 filesystem:

Quote:
mount /dev/sdc1 /DATA/your_new_folder

In order for it to mount automatically at the bootup, you'll have to add one line
to the end of your /etc/fstab file, for example:

Code:
/dev/sdc1       /DATA/your_new_folder        ext3     user,exec,rw,auto       0  0

Last edited by sycamorex; 08-10-2008 at 07:19 AM.
 
Old 08-10-2008, 08:17 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Mounting the filesytem of the third drive will hide the data on the second drive because you are mounting over it.

You could create an lvm volume spanning both disks. You may need to either first backup the data in /data or create the lvm with the 3rd disk, mount and copy the files over to it, and then add the second disk to the volume.

It would be easier if your distro has a gui lvm management program. Most like Fedora Core & SuSE do.
 
Old 08-10-2008, 08:25 AM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Quote:
Mounting the filesytem of the third drive will hide the data on the second drive because you are mounting over it.
Would it do the same if the second drive filesystem is mounted first and you mount the third drive filesystem in one of the folders of the second drive filesystem?

But yes, setting up lvm might be a much better solution if you have several hard drives
 
Old 08-10-2008, 09:38 AM   #5
arshzia
LQ Newbie
 
Registered: Apr 2008
Posts: 27

Original Poster
Rep: Reputation: 15
thanks for ur reply, also how can i merge sdb and sdc through LVM can yuo please tell me step by step.
waiting for ur reply thanks in advance.
 
Old 08-10-2008, 09:44 AM   #6
arshzia
LQ Newbie
 
Registered: Apr 2008
Posts: 27

Original Poster
Rep: Reputation: 15
one more thing as u said that if i create a folder in /DATA and mount /dev/sdc1 on the /DATA/new folder then the data which is in /DATA will be seen or it will not be seen because i have more than 120GB 0f data in /DATA.
 
Old 08-10-2008, 10:11 PM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Which distro are you using? It may have a gui lvm manager which will work similarily to a disk manager. It may be incorporated in the Disk manager of your distro (SuSE) or a separate program (Fedora Core). Manually, first you use the pvcreate command to initialize the disks for an lvm volume. Next use vgcreate to create the logical volume. When you create a partition that will be a part of a logical volume, you get it the type 0x8e in fdisk. For an entire disk, you need to zero out the partition table (dd if=/dev/zero of=/dev/sd<#> bs=512 count=1) first. In the vgcreate command, you give the LVM a volume label. This label will show up in /dev/system/ and represents a device that you can partition as if it where a device for a drive.

There are manpages for pvcreate, vgcreate, etal. There is also an LVM Howto on the www.tldp.org website.

Because you need to zero out the drive before adding it, you may want to create a Logical manager with just the new third drive first. Then create a filesystem on it (formatting), mount it and migrate the files over. If your former home occupied an entire drive, then zero out the mbr of the disk. Next use pvcreate to prepare the partition or disk. Next you can use vgextend to add your old home partition or disk to the volume you created with vgcreate. Lastly use your disk manager or gparted to expand the /home partition to cover the entire volume.

Again, this will be easier to do using your disto's LVM manager. In SuSE, it is a part of their gparted based partitioning program (sudo /sbin/yast2 disk) and you can do all this in one place.
 
Old 08-10-2008, 11:13 PM   #8
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
I would advise against LVM, unless you need contiguous space. When LVM has a problem it can be a real bear to deal with. You can split /Data/ into /Data/1 and /Data/2 and mount each drive respectively. You can do this without loosing what is on the 1st drive (you would just be changing the mount point from /Data to /Data/1 (you do no specifically need to use /1 or /2 it can be whatever you like). You could also mount the new drive on a new folder of the current /Data/ drive(make sure /Data is mounted(in fstab) before you try to mount /Data/new in this case).
 
Old 08-10-2008, 11:41 PM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Another way to do almost the same thing is to mount the third drive as /data2 and then create a symbolic link: /data1/data2->/data2.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount hard drive slackass Debian 10 08-08-2007 10:46 PM
Help writing script file to mount / mount hard drive Rustylinux Linux - General 6 06-27-2006 09:34 AM
how to mount hard drive ricemark20 Fedora - Installation 4 08-31-2005 09:20 AM
how do you mount a hard drive? blackdragon Linux - Newbie 2 07-22-2005 10:28 AM
Where to mount second hard drive Harimwakairi Linux - Newbie 3 08-11-2003 04:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:28 PM.

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