MySQL数据库数据文件全丢失、无备份、已停库、如何恢复?

image.png

问题说明:

MySQL数据库数据文件目录被误rm -rf,无备份,如果进程还在,可以考虑通过文件句柄将误删除的文件找回,但如果数据库已经关闭,还有希望恢复吗?

解决方案:

linux文件被删除之后,只是将文件的inode节点中的扇区指针清零,实际上文件还存在磁盘上面,如果没有被覆盖,还有恢复的可能性。本次使用extundelete 工具进行恢复。

工具限制:

只支持ext3和ext4文件系统,不支持xfs。
如果使用extundelete工具恢复xfs文件系统的文件,会提示如下报错:

extundelete: Bad magic number in super-block when trying to open filesystem /dev/sdl

xfs系统在网上可以找到其他工具。

测试过程如下:

环境说明:

MySQL:8.4.5
OS:Oracle Linux 7.5

下载extundelete 工具

https://sourceforge.net/projects/extundelete/files/latest/download?source=top3_dlp_t5

image.png

安装extundelete

[root@cjc-db-02 soft]# ls -lrth extundelete-0.2.4.tar.bz2 
-rw-r--r-- 1 root root 106K Jun 15 08:01 extundelete-0.2.4.tar.bz2

[root@cjc-db-02 soft]# yum -y install e2fsprogs-libs e2fsprogs e2fsprogs-devel

[root@cjc-db-02 soft]# rpm -q e2fsprogs-libs e2fsprogs e2fsprogs-devel
e2fsprogs-libs-1.45.4-3.0.7.el7.x86_64
e2fsprogs-1.45.4-3.0.7.el7.x86_64
e2fsprogs-devel-1.45.4-3.0.7.el7.x86_64

[root@cjc-db-02 soft]# tar -jxvf extundelete-0.2.4.tar.bz2

[root@cjc-db-02 soft]# cd extundelete-0.2.4/
[root@cjc-db-02 extundelete-0.2.4]# ls
acinclude.m4  aclocal.m4  autogen.sh  config.h.in  configure  configure.ac  depcomp  install-sh  LICENSE  Makefile.am  Makefile.in  missing  README  src

编译安装

[root@cjc-db-02 extundelete-0.2.4]# ./configure && make && make install

编译安装错误处理

如果有如下报错:

Configuring extundelete 0.2.4
Writing generated files to disk
make -s all-recursive
Making all in src
extundelete.cc: In function ‘ext2_ino_t find_inode(ext2_filsys, ext2_filsys, ext2_inode*, std::string, int)’:
extundelete.cc:1272:29: warning: narrowing conversion of ‘search_flags’ from ‘int’ to ‘ext2_ino_t {aka unsigned int}’ inside { } [-Wnarrowing]
    buf, match_name2, priv, 0};
                             ^
insertionops.cc: In function ‘std::ostream& operator<<(std::ostream&, const ext2_inode&)’:
insertionops.cc:36:36: error: ‘const struct ext2_inode’ has no member named ‘i_dir_acl’
   os << "Directory ACL: " << inode.i_dir_acl << std::endl;
                                    ^
make[2]: *** [extundelete-insertionops.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

需要打一个补丁:
下载补丁:

https://sourceforge.net/p/extundelete/tickets/5/attachment/extundelete-0.2.4-e2fsprogs.patch.txt

上传到服务器:

[root@cjc-db-02 soft]# ls -lrth extundelete-0.2.4-e2fsprogs.patch.txt 
-rw-r--r-- 1 root root 582 Jun 15 08:37 extundelete-0.2.4-e2fsprogs.patch.txt

查看补丁内容:

[root@cjc-db-02 soft]# cat extundelete-0.2.4-e2fsprogs.patch.txt 
--- a/src/insertionops.cc	2012-12-30 18:23:32.000000000 +0100
+++ b/src/insertionops.cc	2018-05-07 22:58:13.065868723 +0200
@@ -33,7 +33,7 @@
   os << "File flags: " << inode.i_flags << std::endl;
   os << "File version (for NFS): " << inode.i_generation << std::endl;
   os << "File ACL: " << inode.i_file_acl << std::endl;
-  os << "Directory ACL: " << inode.i_dir_acl << std::endl;
+  os << "Directory ACL: " << inode.i_size_high << std::endl;
   os << "Fragment address: " << inode.i_faddr << std::endl;
   os << "Direct blocks: ";
   for (int n = 0; n < EXT2_NDIR_BLOCKS; n++)

移动到安装目录

[root@cjc-db-02 soft]# mv extundelete-0.2.4-e2fsprogs.patch.txt extundelete-0.2.4

更新补丁

[root@cjc-db-02 extundelete-0.2.4]# patch -p1<extundelete-0.2.4-e2fsprogs.patch.txt
patching file src/insertionops.cc

再次安装

[root@cjc-db-02 extundelete-0.2.4]# ./configure
Configuring extundelete 0.2.4
Writing generated files to disk

[root@cjc-db-02 extundelete-0.2.4]# make && make install
make -s all-recursive
Making all in src
Making install in src
  /usr/bin/install -c extundelete '/usr/local/bin'

帮助信息:

查看extundelete工具帮助信息:

[root@edbjr2p1 ~]# extundelete --help
Usage: extundelete [options] [--] device-file
Options:
  --version, -[vV]       Print version and exit successfully.
  --help,                Print this help and exit successfully.
  --superblock           Print contents of superblock in addition to the rest.
                         If no action is specified then this option is implied.
  --journal              Show content of journal.
  --after dtime          Only process entries deleted on or after 'dtime'.
  --before dtime         Only process entries deleted before 'dtime'.
Actions:
  --inode ino            Show info on inode 'ino'.
  --block blk            Show info on block 'blk'.
  --restore-inode ino[,ino,...]
                         Restore the file(s) with known inode number 'ino'.
                         The restored files are created in ./RECOVERED_FILES
                         with their inode number as extension (ie, file.12345).
  --restore-file 'path'  Will restore file 'path'. 'path' is relative to root
                         of the partition and does not start with a '/'
                         The restored file is created in the current
                         directory as 'RECOVERED_FILES/path'.
  --restore-files 'path' Will restore files which are listed in the file 'path'.
                         Each filename should be in the same format as an option
                         to --restore-file, and there should be one per line.
  --restore-directory 'path'
                         Will restore directory 'path'. 'path' is relative to the
                         root directory of the file system.  The restored
                         directory is created in the output directory as 'path'.
  --restore-all          Attempts to restore everything.
  -j journal             Reads an external journal from the named file.
  -b blocknumber         Uses the backup superblock at blocknumber when opening
                         the file system.
  -B blocksize           Uses blocksize as the block size when opening the file
                         system.  The number should be the number of bytes.
  --log 0                Make the program silent.
  --log filename         Logs all messages to filename.
--log D1=0,D2=filename   Custom control of log messages with comma-separated
   Examples below:       list of options.  Dn must be one of info, warn, or
   --log info,error      error.  Omission of the '=name' results in messages
   --log warn=0          with the specified level to be logged to the console.
   --log error=filename  If the parameter is '=0', logging for the specified
                         level will be turned off.  If the parameter is
                         '=filename', messages with that level will be written
                         to filename.
   -o directory          Save the recovered files to the named directory.
                         The restored files are created in a directory
                         named 'RECOVERED_FILES/' by default.

数据文件目录信息

[mysql@cjc-db-02 mysqldata]$ cd 
[mysql@cjc-db-02 ~]$ ls -lrth /mysqldata/3308/data/
total 1.1G
-rw-r----- 1 mysql mysql   56 May 31 10:31 auto.cnf
-rw-r----- 1 mysql mysql  26M May 31 10:31 #ib_16384_1.dblwr
-rw-r----- 1 mysql mysql  124 May 31 10:31 mysql_upgrade_history
-rw------- 1 mysql mysql 1.7K May 31 10:31 server-key.pem
-rw-r--r-- 1 mysql mysql 1.1K May 31 10:31 server-cert.pem
-rw-r--r-- 1 mysql mysql 1.1K May 31 10:31 ca.pem
-rw------- 1 mysql mysql 1.7K May 31 10:31 ca-key.pem
-rw------- 1 mysql mysql 1.7K May 31 10:31 client-key.pem
-rw-r--r-- 1 mysql mysql 1.1K May 31 10:31 client-cert.pem
-rw-r--r-- 1 mysql mysql  452 May 31 10:31 public_key.pem
-rw------- 1 mysql mysql 1.7K May 31 10:31 private_key.pem
drwxr-x--- 2 mysql mysql 4.0K May 31 10:31 mysql
drwxr-x--- 2 mysql mysql 4.0K May 31 10:31 sys
drwxr-x--- 2 mysql mysql 4.0K Jun  2 16:54 cjc
drwxr-x--- 3 mysql mysql 4.0K Jun  2 17:06 #ib_archive
drwxr-x--- 2 mysql mysql 4.0K Jun 15 07:59 performance_schema
-rw-r----- 1 mysql mysql  25M Jun 15 07:59 mysql.ibd
-rw-r----- 1 mysql mysql 1.0G Jun 15 07:59 ibdata1
-rw-r----- 1 mysql mysql 3.7K Jun 15 07:59 ib_buffer_pool
-rw-r----- 1 mysql mysql  18M Jun 15 07:59 #ib_16384_0.dblwr
drwxr-x--- 2 mysql mysql 4.0K Jun 15 07:59 #innodb_temp

模拟误删除:

[mysql@cjc-db-02 ~]$ rm -rf /mysqldata/3308/data/

恢复数据

创建临时目录

[root@cjc-db-02 ~]# mkdir /extundelete
[root@cjc-db-02 ~]# cd /extundelete/

查看误删除目录所在磁盘:sdl

[root@cjc-db-02 ~]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   50G  0 disk 
├─sda1            8:1    0    1G  0 part /boot
├─sda2            8:2    0    2G  0 part 
│ └─ol-swap     249:1    0    2G  0 lvm  [SWAP]
└─sda3            8:3    0   47G  0 part 
  └─vg_cjc-root 249:0    0   47G  0 lvm  /
sdb               8:16   0    2G  0 disk 
......
sdl               8:176  0   10G  0 disk /mysqldata

扫描磁盘:
没有扫描出data磁盘,理论上应该可以扫描出来

[root@cjc-db-02 extundelete]# extundelete /dev/sdl --inode 2
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 80 groups loaded.
Group: 0
Contents of inode 2:
0000 | ed 41 6d 02 00 10 00 00 b5 34 4e 68 9e 32 4e 68 | .Am......4Nh.2Nh
0010 | 9e 32 4e 68 00 00 00 00 6d 02 0a 00 08 00 00 00 | .2Nh....m.......
0020 | 00 00 00 00 00 00 00 00 83 04 00 00 00 00 00 00 | ................
0030 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
0080 | 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |  ...............
0090 | d6 2e 4e 68 00 00 00 00 00 00 00 00 00 00 00 00 | ..Nh............
00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00b0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00d0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
00f0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................

Inode is Allocated
File mode: 16877
Low 16 bits of Owner Uid: 621
Size in bytes: 4096
Access time: 1749955765
Creation time: 1749955230
Modification time: 1749955230
Deletion Time: 0
Low 16 bits of Group Id: 621
Links count: 10
Blocks count: 8
File flags: 0
File version (for NFS): 0
File ACL: 0
Directory ACL: 0
Fragment address: 0
Direct blocks: 1155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Indirect block: 0
Double indirect block: 0
Triple indirect block: 0

File name                                       | Inode number | Deleted status
.                                                 2
..                                                2
3308                                             16385
app                                               376833
back                                              65537
dbcheck                                           491521
dblogs                                            483329
dbscripts                                         499713
dbtmpfile                                         507905
tools                                             516097

由于上一步没有扫描出data目录,所以指定恢复data目录失败:

[root@cjc-db-02 extundelete]# extundelete /dev/sdl --restore-directory data
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 80 groups loaded.
Loading journal descriptors ... 3723 descriptors loaded.
Failed to restore file data
Could not find correct inode number past inode 2.
Try altering the filename to one of the entries listed below.
File name                                       | Inode number | Deleted status
.                                                 2
..                                                2
3308                                             16385
app                                               376833
back                                              65537
dbcheck                                           491521
dblogs                                            483329
dbscripts                                         499713
dbtmpfile                                         507905
tools                                             516097
extundelete: Operation not permitted while restoring directory.
extundelete: Operation not permitted when trying to examine filesystem

指定绝对路径也是相同的报错

/mysqldata/13309/data

尝试恢复sdl整个磁盘

[root@cjc-db-02 extundelete]# extundelete /dev/sdl --restore-all
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 80 groups loaded.
Loading journal descriptors ... 3723 descriptors loaded.
Searching for recoverable inodes in directory / ... 
269 recoverable inodes found.
Looking through the directory structure for deleted files ... 
121 recoverable inodes still lost.
Unable to restore inode 172033 (file.172033): Space has been reallocated.
Unable to restore inode 172034 (file.172034): Space has been reallocated.
Unable to restore inode 172035 (file.172035): Space has been reallocated.
Unable to restore inode 172036 (file.172036): Space has been reallocated.
Unable to restore inode 172037 (file.172037): Space has been reallocated.
Unable to restore inode 172038 (file.172038): Space has been reallocated.
Unable to restore inode 172039 (file.172039): Space has been reallocated.
Unable to restore inode 172040 (file.172040): Space has been reallocated.
Unable to restore inode 172041 (file.172041): Space has been reallocated.
Unable to restore inode 172042 (file.172042): Space has been reallocated.
Unable to restore inode 172043 (file.172043): Space has been reallocated.
Unable to restore inode 172044 (file.172044): Space has been reallocated.
Unable to restore inode 172045 (file.172045): Space has been reallocated.
Unable to restore inode 172046 (file.172046): Space has been reallocated.
Unable to restore inode 172047 (file.172047): Space has been reallocated.
Unable to restore inode 172048 (file.172048): Space has been reallocated.
Unable to restore inode 172049 (file.172049): Space has been reallocated.
Unable to restore inode 172050 (file.172050): Space has been reallocated.
Unable to restore inode 172051 (file.172051): Space has been reallocated.
Unable to restore inode 172052 (file.172052): Space has been reallocated.
Block 985088 is allocated.
Block 993359 is allocated.
Failed to restore inode 172066 to file RECOVERED_FILES/file.172066:Some blocks were allocated.
Unable to restore inode 172067 (file.172067): Space has been reallocated.
Unable to restore inode 172068 (file.172068): Space has been reallocated.
Unable to restore inode 172069 (file.172069): Space has been reallocated.
Unable to restore inode 172070 (file.172070): Space has been reallocated.
Unable to restore inode 172071 (file.172071): Space has been reallocated.
Unable to restore inode 172072 (file.172072): Space has been reallocated.
Unable to restore inode 172073 (file.172073): Space has been reallocated.
Unable to restore inode 172074 (file.172074): Space has been reallocated.
Unable to restore inode 172075 (file.172075): Space has been reallocated.
Unable to restore inode 172076 (file.172076): Space has been reallocated.
Unable to restore inode 172077 (file.172077): Space has been reallocated.
Unable to restore inode 172078 (file.172078): Space has been reallocated.
Unable to restore inode 172079 (file.172079): Space has been reallocated.
Unable to restore inode 172080 (file.172080): Space has been reallocated.
Unable to restore inode 172081 (file.172081): Space has been reallocated.
Unable to restore inode 172082 (file.172082): Space has been reallocated.
Unable to restore inode 172083 (file.172083): Space has been reallocated.
Unable to restore inode 172084 (file.172084): Space has been reallocated.
Unable to restore inode 172085 (file.172085): Space has been reallocated.
Unable to restore inode 172086 (file.172086): Space has been reallocated.
Unable to restore inode 172087 (file.172087): Space has been reallocated.
Unable to restore inode 172088 (file.172088): Space has been reallocated.
Unable to restore inode 172089 (file.172089): Space has been reallocated.
Unable to restore inode 172090 (file.172090): Space has been reallocated.
Unable to restore inode 172091 (file.172091): Space has been reallocated.
Unable to restore inode 172092 (file.172092): Space has been reallocated.
Unable to restore inode 172093 (file.172093): Space has been reallocated.
Unable to restore inode 172094 (file.172094): Space has been reallocated.
Unable to restore inode 172095 (file.172095): Space has been reallocated.
Unable to restore inode 172096 (file.172096): Space has been reallocated.
Unable to restore inode 172097 (file.172097): Space has been reallocated.
Unable to restore inode 172098 (file.172098): Space has been reallocated.
Unable to restore inode 245761 (file.245761): Space has been reallocated.
Unable to restore inode 245762 (file.245762): Space has been reallocated.
Unable to restore inode 245763 (file.245763): Space has been reallocated.
Unable to restore inode 245764 (file.245764): Space has been reallocated.
Unable to restore inode 245765 (file.245765): Space has been reallocated.
Unable to restore inode 245766 (file.245766): Space has been reallocated.
Unable to restore inode 245767 (file.245767): Space has been reallocated.
Unable to restore inode 245768 (file.245768): Space has been reallocated.
Unable to restore inode 245769 (file.245769): Space has been reallocated.
Unable to restore inode 245770 (file.245770): Space has been reallocated.
Unable to restore inode 245771 (file.245771): Space has been reallocated.
Unable to restore inode 245772 (file.245772): Space has been reallocated.
Unable to restore inode 245773 (file.245773): Space has been reallocated.
Unable to restore inode 245774 (file.245774): Space has been reallocated.
Unable to restore inode 245775 (file.245775): Space has been reallocated.
Unable to restore inode 245776 (file.245776): Space has been reallocated.
Unable to restore inode 245777 (file.245777): Space has been reallocated.
Unable to restore inode 245778 (file.245778): Space has been reallocated.
Unable to restore inode 245779 (file.245779): Space has been reallocated.
Unable to restore inode 245780 (file.245780): Space has been reallocated.
Unable to restore inode 245781 (file.245781): Space has been reallocated.
Unable to restore inode 245782 (file.245782): Space has been reallocated.
Unable to restore inode 245783 (file.245783): Space has been reallocated.
Unable to restore inode 245784 (file.245784): Space has been reallocated.
Unable to restore inode 245785 (file.245785): Space has been reallocated.
Unable to restore inode 245786 (file.245786): Space has been reallocated.
Unable to restore inode 245787 (file.245787): Space has been reallocated.
Unable to restore inode 245788 (file.245788): Space has been reallocated.
Unable to restore inode 245789 (file.245789): Space has been reallocated.
Unable to restore inode 245790 (file.245790): Space has been reallocated.
Unable to restore inode 245791 (file.245791): Space has been reallocated.
Unable to restore inode 245792 (file.245792): Space has been reallocated.
Unable to restore inode 245793 (file.245793): Space has been reallocated.
Unable to restore inode 245794 (file.245794): Space has been reallocated.
Unable to restore inode 245795 (file.245795): Space has been reallocated.
Unable to restore inode 245796 (file.245796): Space has been reallocated.
Unable to restore inode 245797 (file.245797): Space has been reallocated.
Unable to restore inode 245798 (file.245798): Space has been reallocated.
Unable to restore inode 245799 (file.245799): Space has been reallocated.
Unable to restore inode 245800 (file.245800): Space has been reallocated.
Unable to restore inode 245801 (file.245801): Space has been reallocated.
Unable to restore inode 245802 (file.245802): Space has been reallocated.
Unable to restore inode 245803 (file.245803): Space has been reallocated.
Unable to restore inode 245804 (file.245804): Space has been reallocated.
Unable to restore inode 245805 (file.245805): Space has been reallocated.
Unable to restore inode 245806 (file.245806): Space has been reallocated.
Unable to restore inode 245807 (file.245807): Space has been reallocated.
Unable to restore inode 385025 (file.385025): Space has been reallocated.
Unable to restore inode 385026 (file.385026): Space has been reallocated.
Unable to restore inode 385027 (file.385027): Space has been reallocated.
Unable to restore inode 385028 (file.385028): Space has been reallocated.
Unable to restore inode 385029 (file.385029): Space has been reallocated.

恢复成功

[root@cjc-db-02 extundelete]# ls
RECOVERED_FILES
[root@cjc-db-02 extundelete]# ls -lrth RECOVERED_FILES/
total 800M
drwxr-xr-x 3 root root  18 Jun 15 11:01 3308
drwxr-xr-x 2 root root  38 Jun 15 11:02 app
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172053
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172054
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172055
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172056
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172057
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172058
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172059
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172060
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172061
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172062
-rw-r--r-- 1 root root 64M Jun 15 11:02 file.172063
-rw-r--r-- 1 root root 64M Jun 15 11:03 file.172064
-rw-r--r-- 1 root root 64M Jun 15 11:03 file.172065
-rw-r--r-- 1 root root 24K Jun 15 11:03 file.172066.part
-rw-r--r-- 1 root root 64M Jun 15 11:03 file.245808


[root@cjc-db-02 extundelete]# ls -lrth RECOVERED_FILES/3308/data/
total 1.1G
-rw-r--r-- 1 root root   56 Jun 15 11:01 auto.cnf
-rw-r--r-- 1 root root 1.0G Jun 15 11:01 ibdata1
-rw-r--r-- 1 root root  18M Jun 15 11:01 #ib_16384_0.dblwr
-rw-r--r-- 1 root root  26M Jun 15 11:01 #ib_16384_1.dblwr
-rw-r--r-- 1 root root  25M Jun 15 11:01 mysql.ibd
drwxr-xr-x 2 root root  100 Jun 15 11:01 mysql
-rw-r--r-- 1 root root  124 Jun 15 11:01 mysql_upgrade_history
drwxr-xr-x 2 root root 8.0K Jun 15 11:01 performance_schema
-rw-r--r-- 1 root root 1.7K Jun 15 11:01 server-key.pem
-rw-r--r-- 1 root root 1.1K Jun 15 11:01 ca.pem
-rw-r--r-- 1 root root 1.7K Jun 15 11:01 ca-key.pem
-rw-r--r-- 1 root root 1.1K Jun 15 11:01 server-cert.pem
drwxr-xr-x 2 root root   28 Jun 15 11:01 sys
-rw-r--r-- 1 root root  452 Jun 15 11:01 public_key.pem
-rw-r--r-- 1 root root 1.7K Jun 15 11:01 private_key.pem
-rw-r--r-- 1 root root 1.7K Jun 15 11:01 client-key.pem
-rw-r--r-- 1 root root 1.1K Jun 15 11:01 client-cert.pem
drwxr-xr-x 3 root root   22 Jun 15 11:02 #ib_archive
drwxr-xr-x 2 root root   57 Jun 15 11:02 cjc
-rw-r--r-- 1 root root 3.7K Jun 15 11:02 ib_buffer_pool

将data目录拷会mysql数据目录下:

[root@cjc-db-02 extundelete]# cp -r /extundelete/RECOVERED_FILES/3308/data /mysqldata/3308/

[root@cjc-db-02 extundelete]# chown mysql:mysql /mysqldata -R
[root@cjc-db-02 extundelete]# du -sh /mysqldata/3308/data/
1.3G	/mysqldata/3308/data/

验证

启动MySQL数据库

[mysql@cjc-db-02 ~]$ sh start_mysql.sh

error.log有temp文件的告警:

[mysql@cjc-db-02 ~]$ sh start_mysql.sh 
2025-06-15T11:12:40.845922+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_1.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.101396+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_2.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.119987+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_3.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.128244+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_4.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.134205+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_5.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.138870+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_6.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.143785+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_7.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.384594+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_8.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.530662+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_9.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.578722+08:00 1 [Warning] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_10.ibt, desired size 81920 Operating system error number 22 - Invalid argument. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2025-06-15T11:12:41.761064+08:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-06-15T11:12:45.267139+08:00 0 [ERROR] [MY-013180] [Server] Function 'clone' already exists.
2025-06-15T11:12:45.267206+08:00 0 [Warning] [MY-010736] [Server] Couldn't load plugin named 'clone' with soname 'mysql_clone.so'.
2025-06-15T11:12:49.505660+08:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-06-15T11:12:49.505755+08:00 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-06-15T11:12:50.908590+08:00 0 [System] [MY-010931] [Server] /mysqldata/app/8.4.5/bin/mysqld: ready for connections. Version: '8.4.5'  socket: '/mysqldata/3308/socket/mysql.sock'  port: 3308  MySQL Community Server - GPL.
2025-06-15T11:12:50.909097+08:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock

不影响数据库使用:

[mysql@cjc-db-02 ~]$ mysql -uroot -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.5 MySQL Community Server - GPL

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select * from cjc.t1;
+----+------+----------+
| id | name | time     |
+----+------+----------+
|  1 | x    | 10:35:52 |
|  2 | y    | 10:35:56 |
|  3 | z    | 10:36:02 |
|  4 | a    | 17:10:34 |
|  5 | f    | 17:10:40 |
|  6 | g    | 17:24:36 |
+----+------+----------+
6 rows in set (0.01 sec)

mysql> insert into cjc.t1 values(7,'f',now());
Query OK, 1 row affected (0.16 sec)

mysql> insert into cjc.t1 values(8,'r',now());
Query OK, 1 row affected (0.07 sec)

mysql> select * from cjc.t1;
+----+------+----------+
| id | name | time     |
+----+------+----------+
|  1 | x    | 10:35:52 |
|  2 | y    | 10:35:56 |
|  3 | z    | 10:36:02 |
|  4 | a    | 17:10:34 |
|  5 | f    | 17:10:40 |
|  6 | g    | 17:24:36 |
|  7 | f    | 11:13:41 |
|  8 | r    | 11:13:47 |
+----+------+----------+
8 rows in set (0.00 sec)

—End—
###chenjuchao 20250615###
欢迎关注我的公众号《IT小Chen

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值