Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 24th, 2011, 09:15 PM
nibz nibz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 8 nibz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 47 sec
Reputation Power: 0
How to setup mysql to use another hard drive?

Ok first Im completely new to linux. I know lol sorry..

My questions is, I am running a large database website under linux. I have 5 hard drives, but hard disk 1 is where linux is installed and apache is installed + all other server files. What I am trying to do is, is there anyway that I could make mysql use hard disk 2? here is an example:

Say I have my site on hdd1 and I want to tell my site to use hdd2 to store and retrieve all database files from hdd2 so that way hdd1 wont get filled up and run out of space.

Is there a way to do this? this is will be so helpful if anyone can help. Thank you.

Reply With Quote
  #2  
Old October 25th, 2011, 11:28 AM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,680 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 55 m 14 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
All the databases or just one in particular?

Either way it's the same:
1. Stop mysqld
2a. ls the datadir (eg, /var/lib/mysql or /var/lib/mysql/database) and remember that
2b. Backup whatever you're dealing with, just for kicks
3. Move the datadir files to the new hard drive
4a. (Re)mount the drive at that directory
4b. ls the datadir and see that it looks like it did before
5. Start mysqld and make sure stuff doesn't catch on fire

Reply With Quote
  #3  
Old October 25th, 2011, 04:18 PM
nibz nibz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 8 nibz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 47 sec
Reputation Power: 0
one last question.

Is there any guide to help me mount different hard drives for different purposes under linux?

For example. Lets say I want to mount hdd2 to something like /system/uploads/ so from hdd1 (where my site is)I can edit the config file and point it to upload all the system files to /system/uploads which is in the 2nd drive hdd2. Say for example I have 3 hdds so the 1st hdd is where my linux is installed the other 2 sits there empty. So i want hdd1 to access hdd2 and hdd3 to store/retrieve files, like hdd1 wants to store a file into hdd2. hope its not confusing.

Reply With Quote
  #4  
Old October 25th, 2011, 04:49 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,680 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 55 m 14 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Depending on your Linux there are different ways to mount drives to folders. Editing /etc/fstab directly is probably an option.

Where you put stuff depends on how the system will be used. If it's a database machine then you probably want the database information on its own drive (RAIDed, even!). If it's a source control repository then you probably want a drive dedicated to holding that. Running a (small) web hosting business? Mount /home on its own drives too.

From what I can gather you have three hard drives and three important locations:
- The root, of course
- An uploads folder. I guess you'll have a lot of large uploads
- The MySQL data directory
Three and three. Use one drive for /, one for /system/uploads, and one for /var/lib/mysql.

Reply With Quote
  #5  
Old October 25th, 2011, 05:20 PM
nibz nibz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 8 nibz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 47 sec
Reputation Power: 0
Quote:
Originally Posted by requinix
Depending on your Linux there are different ways to mount drives to folders. Editing /etc/fstab directly is probably an option.

Where you put stuff depends on how the system will be used. If it's a database machine then you probably want the database information on its own drive (RAIDed, even!). If it's a source control repository then you probably want a drive dedicated to holding that. Running a (small) web hosting business? Mount /home on its own drives too.

From what I can gather you have three hard drives and three important locations:
- The root, of course
- An uploads folder. I guess you'll have a lot of large uploads
- The MySQL data directory
Three and three. Use one drive for /, one for /system/uploads, and one for /var/lib/mysql.


Your right thats exactly what I want to do. Is there any guide that would help me towards this setup? if so that will be so helpful.

In your opinion, do you think (performance wise) setting up 3 hdds and linking it to perform different tasks would be better, or buy a large data hard drive something like 3TB? my site will be storing large amounts of data. thanks!

Reply With Quote
  #6  
Old October 25th, 2011, 06:25 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,680 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 55 m 14 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
With multiple drives, losing one means only losing part of your data. Stick everything on one drive and you better have backups of everything. Which you should do anyways, but that's not the point.

You should be really learning about this, not just picking up a guide and getting it over with. Learn about hard drives, RAID and redundancy and backups, mounting stuff in Linux... There's a lot to cover that a simple guide might not get. A lot that you should know if you're going to fill this kind of role.

All that aside, I don't know of any guides. Besides Google. And there isn't a whole lot to do: add the drives in /etc/fstab with the right options and you're practically done.

Reply With Quote
  #7  
Old October 25th, 2011, 08:10 PM
nibz nibz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 8 nibz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 47 sec
Reputation Power: 0
Thanks alot! that makes more sense.

To be honest, I love linux and I really love to learn everything about linux after being a windows user for 11yrs, windows kinda sucks in terms of security and reliability. But everything forums like this makes learning much more easier and I understand more, rathar than flipping notes in books lol. Anyway thanks again for helping!

Reply With Quote
  #8  
Old October 25th, 2011, 08:41 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,233 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 15 m 56 sec
Reputation Power: 4445
You don't have to use /var/lib/mysql. You should be able to simply stop mysql, move any existing data files to the new location, edit /etc/my.cnf with the new datafiles location, restart mysql.

Fedora linux (which I use) installs lvm partitions which allows you to expand a partition spanning multiple physical drives to get a larger storage partition. I'd try to use a bigger drive though, I just don't like the idea of not being able to recover data off a drive that's been pulled from a computer.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #9  
Old October 25th, 2011, 10:41 PM
nibz nibz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 8 nibz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 47 sec
Reputation Power: 0
Quote:
Originally Posted by Doug G
You don't have to use /var/lib/mysql. You should be able to simply stop mysql, move any existing data files to the new location, edit /etc/my.cnf with the new datafiles location, restart mysql.

Fedora linux (which I use) installs lvm partitions which allows you to expand a partition spanning multiple physical drives to get a larger storage partition. I'd try to use a bigger drive though, I just don't like the idea of not being able to recover data off a drive that's been pulled from a computer.


Thanks. I didnt know that. Btw I also use fedora 10.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > How to setup mysql to use another hard drive?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap