# Changing the DataDir before or after configuring the Cluster?

**URL:** <https://forums.percona.com/t/changing-the-datadir-before-or-after-configuring-the-cluster/22882>\
**Category:** Percona XtraDB Cluster 5.x\
**Tags:** community, mysql, percona\
**Created:** [June 17, 2023, 9:54am UTC](https://forums.percona.com/t/changing-the-datadir-before-or-after-configuring-the-cluster/22882 "2023-06-17T09:54:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keon](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@Keon](https://forums.percona.com/u/Keon)\
**Post date:** [June 17, 2023, 9:54am UTC](https://forums.percona.com/t/changing-the-datadir-before-or-after-configuring-the-cluster/22882/1 "2023-06-17T09:54:03Z")

</div>

(educational purposes)

Hey comm,

actually i’m just trying to understand the working of xtraDB Cluster and how to set it up proberly. In this situation i want to use 3 cloud servers, where each has a ssd volume connected.

Cause the SSD of the server itself is very small, i want to have the data directory of the xtraDB Cluster on these SSD volumes which are connected to the server, because i can upsize them when there is a need of it (up to 10 TB).

I already done the installation on the 3 servers as follows:

> **[Percona XtraDB Cluster - Install Percona XtraDB Cluster on Debian or Ubuntu](https://docs.percona.com/percona-xtradb-cluster/8.0/install/apt.html#install-from-repository)**
>
> Specific information on the supported platforms, products, and versions
> is described in Percona Software and Platform Lifecycle.

Now i would come up to configure nodes for write-set replication:

> **[Percona XtraDB Cluster - Configure nodes for write-set replication](https://docs.percona.com/percona-xtradb-cluster/8.0/configure.html)**
>
> After installing Percona XtraDB Cluster on each node, you need to configure the cluster.
> In this section, we will demonstrate how to configure a three node cluster:

And i’m asking myself, if i should change the DataDir to the SSD volume before i do this or when is the best time for it.

Someone can give me a recommendation? Maybe a doc link, cause i didnt find something about changing the dataDir?

Best regards  
Keon

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [June 18, 2023, 12:33am UTC](https://forums.percona.com/t/changing-the-datadir-before-or-after-configuring-the-cluster/22882/2 "2023-06-18T00:33:28Z")

</div>

Hello @Keon,  
MySQL’s data directory is set via config file `/etc/my.cnf` (or `/etc/mysql/my.cnf` depending on your OS). Look for `[mysqld]` section, and `datadir=` Shut down MySQL. Change this parameter to a new value. Copy the contents of /var/lib/mysql (the default) to this new location, ensure permissions/ownerships are correct, and then start MySQL.  
Alternatively, you could have simply mounted your block device as `/var/lib/mysql` and not needed to change any mysql settings.
