Matching MySQL Directories to Mounted File System(s)

MySQL and MariaDB

Audience
Public
Source Type
Documentation

Once the directory locations are known they can be inspected to identify the FlashArray volume(s) which each corresponds to.

For Linux/Unix systems the "df " command is useful to get an overview of what file systems are mounted and the volumes they correspond to.

For Microsoft Windows systems the diskpart and wmic utilities will be used to identify file system(s) and corresponding volume(s).

Note:

If using a file system layout which separates database/schema files then the location of each database/schema will not be shown with this output. Instead, datadir directory should be checked to see where the symbolic links direct towards.

Linux/Unix

When using the "df -h" command all mounted file systems and the corresponding volumes are listed. One the volumes for MySQL have been identified take note of the /dev/mapper/<volume> path as this will be used to identify the volume serial number.

Using the Volume and File System Architectural Layout there should be a volume mounted to "/var/lib/mysql". This file system contains all of the databases/schemas, transaction logs, and binary logs.


[root@DB-01 ~]# df -h
Filesystem                                      Size  Used Avail Use% Mounted on
devtmpfs                                        252G     0  252G   0% /dev
tmpfs                                           252G     0  252G   0% /dev/shm
tmpfs                                           252G   11M  252G   1% /run
tmpfs                                           252G     0  252G   0% /sys/fs/cgroup
/dev/mapper/rhel-root                           410G  5.5G  405G   2% /
/dev/mapper/rhel-home                            37G  293M   37G   1% /home
/dev/mapper/3624a93708488b6dac70f42a20001edcd2 1014M  325M  690M  32% /boot
/dev/mapper/3624a93708488b6dac70f42a20001edcd1  599M  6.9M  592M   2% /boot/efi
tmpfs                                            51G     0   51G   0% /run/user/0
/dev/mapper/3624a9370668f1ab9b15f4bc400011883   2.0T   25G  2.0T   2% /var/lib/mysql

Where Separate data/binary and transaction log directories have been used the output of "df -h" should have multiple volumes, each with its own file system, which corresponds to the entries identified when looking for the MySQL directories.


[root@DB-01 ~]# df -h
Filesystem                                      Size  Used Avail Use% Mounted on
devtmpfs                                        252G     0  252G   0% /dev
tmpfs                                           252G     0  252G   0% /dev/shm
tmpfs                                           252G   11M  252G   1% /run
tmpfs                                           252G     0  252G   0% /sys/fs/cgroup
/dev/mapper/rhel-root                           410G   38G  373G  10% /
/dev/dm-9                                      1014M  256M  759M  26% /boot
/dev/mapper/rhel-home                            37G  293M   37G   1% /home
/dev/mapper/3624a93708488b6dac70f42a20001edce1  599M  6.9M  592M   2% /boot/efi
tmpfs                                            51G     0   51G   0% /run/user/0
/dev/mapper/3624a9370668f1ab9b15f4bc400011886   2.0T   34G  2.0T   2% /mysql/base
/dev/mapper/3624a9370668f1ab9b15f4bc40001189e   512G  3.7G  509G   1% /mysql/undo
/dev/mapper/3624a9370668f1ab9b15f4bc400011894   1.0T   40G  985G   4% /mysql/log
/dev/mapper/3624a9370668f1ab9b15f4bc4000118a2   768G   36G  733G   5% /mysql/warehouse01
/dev/mapper/3624a9370668f1ab9b15f4bc4000118a3   768G  5.4G  763G   1% /mysql/warehouse02
/dev/mapper/3624a9370668f1ab9b15f4bc4000118a4   768G  5.4G  763G   1% /mysql/warehouse03
/dev/mapper/3624a9370668f1ab9b15f4bc4000118a5   768G  5.4G  763G   1% /mysql/warehouse04

If separating database and schema files using symbolic links then the datadir needs to be inspected to see where the link directs to. Symbolic links can be identified below where the entry is of the following form: localfolder -> remote folder. Take note of the remote folder and check it against the entries provided by df -h.


[root@DB-01 ~]# ll -h /mysql/base/data/
total 18G
-rw-r-----. 1 mysql mysql   56 Feb 23 06:10  auto.cnf
-rw-------. 1 mysql mysql 1.7K Feb 23 06:10  ca-key.pem
-rw-r--r--. 1 mysql mysql 1.1K Feb 23 06:10  ca.pem
-rw-r--r--. 1 mysql mysql 1.1K Feb 23 06:10  client-cert.pem
-rw-------. 1 mysql mysql 1.7K Feb 23 06:10  client-key.pem
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:27  DB-06-bin.000001
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:28  DB-06-bin.000002
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:28  DB-06-bin.000003
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:28  DB-06-bin.000004
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:28  DB-06-bin.000005
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:28  DB-06-bin.000006
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:29  DB-06-bin.000007
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:29  DB-06-bin.000008
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:29  DB-06-bin.000009
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:29  DB-06-bin.000010
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:29  DB-06-bin.000011
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:29  DB-06-bin.000012
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:30  DB-06-bin.000013
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:30  DB-06-bin.000014
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:30  DB-06-bin.000015
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:30  DB-06-bin.000016
-rw-r-----  1 mysql mysql 1.1G Mar  1 02:30  DB-06-bin.000017
-rw-r-----  1 mysql mysql  72M Mar  1 02:30  DB-06-bin.000018
-rw-r-----  1 mysql mysql  342 Mar  1 02:30  DB-06-bin.index
-rw-r-----  1 mysql mysql 3.6K Mar  1 02:26  ib_buffer_pool
-rw-r-----. 1 mysql mysql  12M Mar  1 02:30  ibdata1
-rw-r-----  1 mysql mysql  12M Mar  1 02:26  ibtmp1
drwxr-x---. 2 mysql mysql  187 Mar  1 02:26 '#innodb_temp'
drwxr-x---. 2 mysql mysql  143 Feb 23 06:10  mysql
-rw-r-----. 1 mysql mysql  25M Mar  1 02:30  mysql.ibd
drwxr-x---. 2 mysql mysql 8.0K Feb 23 06:10  performance_schema
-rw-------. 1 mysql mysql 1.7K Feb 23 06:10  private_key.pem
-rw-r--r--. 1 mysql mysql  452 Feb 23 06:10  public_key.pem
-rw-r--r--. 1 mysql mysql 1.1K Feb 23 06:10  server-cert.pem
-rw-------. 1 mysql mysql 1.7K Feb 23 06:10  server-key.pem
drwxr-x---. 2 mysql mysql   28 Feb 23 06:10  sys
lrwxrwxrwx. 1 root  root    18 Feb 23 07:03  warehouse01 -> /mysql/warehouse01
lrwxrwxrwx. 1 root  root    18 Feb 23 07:04  warehouse02 -> /mysql/warehouse02
lrwxrwxrwx. 1 root  root    18 Feb 23 07:04  warehouse03 -> /mysql/warehouse03
lrwxrwxrwx. 1 root  root    18 Feb 23 07:04  warehouse04 -> /mysql/warehouse04

Microsoft Windows

Open a PowerShell or Command Prompt and enter the diskpart utility:


diskpart

Once in the diskpart utility use the following to list the volumes:


list volume


DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D                       DVD-ROM         0 B  No Media
  Volume 1     C                NTFS   Partition    255 GB  Healthy    Boot
  Volume 2         Recovery     NTFS   Partition    499 MB  Healthy    Hidden
  Volume 3                      FAT32  Partition     99 MB  Healthy    System
  Volume 4         Warehouse01  NTFS   Partition    767 GB  Healthy
    C:\MySQL\Warehouse01\
  Volume 5         Warehouse02  NTFS   Partition    767 GB  Healthy
    C:\MySQL\Warehouse02\
  Volume 6         Warehouse03  NTFS   Partition    767 GB  Healthy
    C:\MySQL\Warehouse03\
  Volume 7         Warehouse04  NTFS   Partition    767 GB  Healthy
    C:\MySQL\Warehouse04\
  Volume 8         MySQL_Base   NTFS   Partition   2047 GB  Healthy
    C:\MySQL\Base\
  Volume 9         MySQL_BinLo  NTFS   Partition   1247 GB  Healthy
    C:\MySQL\BinLog\
  Volume 10        MySQL_Log    NTFS   Partition   1023 GB  Healthy
    C:\MySQL\Log\
  Volume 11        MySQL_Undo   NTFS   Partition    511 GB  Healthy
    C:\MySQL\Undo\

Take note of the Volume ### and Ltr. Using this information the volumes can then be matched to a serial number using wmic.