Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to move mysql to another partition on ubuntu server

Posted on 2008-06-19
4
Medium Priority
?
890 Views
Last Modified: 2013-11-15
Im preparing for my install of DRBD for a database application and I have just setup a new partition on my ubuntu server hard drive that I would like mysql database to reside on. Right now I did the initial install of ubuntu server with the LAMP installation so the database is already on the server. How do I move the database and all of its files to my new partition? Below is my printout of fdisk -l

Disk /dev/sda: 146.8 GB, 146809028608 bytes
255 heads, 63 sectors/track, 17848 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00055edd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       17464   140279548+  83  Linux
/dev/sda2           17472       17848     3028252+   5  Extended
/dev/sda3           17465       17471       56227+  83  Linux
/dev/sda5           17472       17848     3028221   82  Linux swap / Solaris

I would like mysql to be moved to sda3 instead of sda1. Thanks
0
Comment
Question by:tupac1979
[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
  • 2
4 Comments
 
LVL 4

Expert Comment

by:albuitra
ID: 21825716
sda3 is very small
0
 
LVL 48

Expert Comment

by:hernst42
ID: 21825741
shutdown mysql, pack every thing in /var/lib/mysql, mount /dev/sda3 to /var/lib/mysql untar everything, start mysql and the data should be moved to an extra parition. So you can also replace this mountpoint with drdb mount point.
0
 

Author Comment

by:tupac1979
ID: 21826273
hernst42 thanks I know your instructions are good but Im a beginner so can you provide me a few commands and then that will be all I need. Thanks
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 2000 total points
ID: 21826719
controlling mysql:
/etc/init.d/mysql stop/start

packing
tar -czf /tmp/mysql.tgz /var/lib/mysql
unpacking
cd /
tar -xzf /tmp/mysql.tgz

mount /dev/sda3 /var/lib/mysql

also edit /etc/fstab to reflect the changes of mounting
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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