# MariaDB keeps waking up HDD

**URL:** https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512
**Category:** Troubleshooting
**Tags:** mariadb
**Created:** [5 March 2024 11:10 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512 "2024-03-05T11:10:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Error404](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@Error404](https://dietpi.com/forum/u/Error404)
#### Post date: [5 March 2024 11:10 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512/1 "2024-03-05T11:10:05Z")

</div>

### Creating a bug report/issue

I have searched the existing open and closed issues

#### Required Information

- DietPi version |  
G\_DIETPI\_VERSION\_CORE=9  
G\_DIETPI\_VERSION\_SUB=1  
G\_DIETPI\_VERSION\_RC=1  
G\_GITBRANCH=‘master’  
G\_GITOWNER=‘MichaIng’  
G\_LIVE\_PATCH\_STATUS[0]=‘not applicable’
- Distro version |  
bookworm 0
- Kernel version |  
Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
- Architecture |  
arm64
- SBC model |  
RPi 4 Model B (aarch64)
- Power supply used |  
raspberry power supply
- SD card used |  
SanDisk ultra 32GB

#### Additional Information (if applicable)

- Software title |  
MariaDB (in use with Nextcloud)
- Was the software title installed freshly or updated/migrated?  
fresh installed
- Can this issue be replicated on a fresh installation of DietPi?  
I guess it is an expected behavior but it is periodic (every ~4-5min
- Bug report ID |  
not really a bug

#### Steps to reproduce

I used iotop to track r/w actions on ext. drive. MariaDB is waking up HDD

#### Extra details

So I signed up here becaus I have the problem, that MariaDB keeps waking up my HDD.  
Setup:  
I installed Nextcloud and mounted my ext. drive with the drive manager.  
I moved the User Data to my mounted HDD with the DietPi Software launcher.  
Spindown is set to 4 min. The drive is also spinning down like intended, but shortly after starts spinning again.  
Like I saoid a used iotop to see what is using the HDD and found MariaDB accessing it  
So I´m pretty sure this is a intended behavior.  
I guess the best would be to move the Data back to the SD and only move Nextcloud data to the HDD.  
What would be the simplest solution for this one?  
Help is very much appreciated, because i´m not yet that familiar with linux 🙂

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [5 March 2024 14:01 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512/2 "2024-03-05T14:01:47Z")

</div>

You could try to move only database repository to SD card as it is a symbolic link anyhow 🙂

---

<div class="post-metadata">

### Author: ![WarHawk](https://dietpi.com/forum/user_avatar/dietpi.com/warhawk/32/21_2.png) [@WarHawk](https://dietpi.com/forum/u/WarHawk)
#### Post date: [5 March 2024 14:29 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512/3 "2024-03-05T14:29:39Z")

</div>

Could you tune MariaDB to allocate more RAM before writing to the database?

> **[MariaDB Memory Allocation](https://mariadb.com/kb/en/mariadb-memory-allocation/)**
>
> Basic issues in RAM allocation for MariaDB.

---

<div class="post-metadata">

### Author: ![Error404](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@Error404](https://dietpi.com/forum/u/Error404)
#### Post date: [5 March 2024 15:27 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512/4 "2024-03-05T15:27:36Z")

</div>

thank you for your both recommendations, but I would need a little bit more explanation 🙂  
I´m not yet that familiar with linux.  
I was searching a little bit in the file structure but could neiter find the database resporitoty (or did find it and was not aware :D), nor did I find the MariaDB ini file where to increase the RAM usage.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [5 March 2024 16:09 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512/5 "2024-03-05T16:09:43Z")

</div>

MariaDB database directory is located at `/var/lib/mysql`. However this is a link to your `dietpi_userdata`. Should looks like this.

```auto
root@DietPiOPi5:~# ls -la /var/lib/mysql
lrwxrwxrwx 1 root root 26 Feb 25 21:08 /var/lib/mysql -> /mnt/dietpi_userdata/mysql
root@DietPiOPi5:~#

```

What you can do is to stop all services and move `/mnt/dietpi_userdata/mysql` to your SD card. Before we should do a backup of the DB folder, like this 😃

```auto
dietpi-services stop
cp -a /mnt/dietpi_userdata/mysql/ /mnt/dietpi_userdata/mysql_backup/
rm /var/lib/mysql
cp -a /mnt/dietpi_userdata/mysql/ /var/lib/mysql/
dietpi-services start

```

---

<div class="post-metadata">

### Author: ![Error404](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/e/da6949/32.png) [@Error404](https://dietpi.com/forum/u/Error404)
#### Post date: [5 March 2024 21:34 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512/6 "2024-03-05T21:34:56Z")

</div>

Worked perfect, thank you for your quick Help👍🏻

---

<div class="post-metadata">

### Author: ![system](https://dietpi.com/forum/uploads/default/original/1X/7e1021de2213860bce185915ce2c1786e56490ec.png) [@system](https://dietpi.com/forum/u/system)
#### Post date: [3 June 2024 21:35 UTC](https://dietpi.com/forum/t/mariadb-keeps-waking-up-hdd/19512/7 "2024-06-03T21:35:19Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
