-- Up-to-date: /usr/local/mysql/mysql-test/lib/My/SafeProcess/my_safe_process
-- Installing: /usr/local/mysql/mysql-test/lib/My/SafeProcess/Base.pm
-- Installing: /usr/local/mysql/support-files/mysqld_multi.server
-- Installing: /usr/local/mysql/support-files/mysql-log-rotate
-- Installing: /usr/local/mysql/support-files/magic
-- Installing: /usr/local/mysql/share/aclocal/mysql.m4
-- Installing: /usr/local/mysql/support-files/mysql.server
[root@mysql mysql-5.7.31]# ls
archive_output_directory find_libevent_version.c plugin
boost include rapid
BUILD info_macros.cmake README
client INSTALL regex
cmake install_manifest.txt scripts
CMakeCache.txt libbinlogevents source_downloads
CMakeFiles libbinlogstandalone sql
cmake_install.cmake libmysql sql-common
CMakeLists.txt libmysqld storage
cmd-line-utils libservices strings
config.h.cmake LICENSE support-files
configure.cmake make_dist.cmake testclients
CPackConfig.cmake Makefile unittest
CPackSourceConfig.cmake man VERSION
CTestTestfile.cmake myconfig.sh VERSION.dep
dbug mysql-test vio
Docs mysys win
Doxyfile-perfschema mysys_ssl zlib
extra packaging
[root@mysql mysql-5.7.31]# cd ~
[root@mysql ~]# ls
anaconda-ks.cfg mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz
mysql-5.7.31 mysql-boost-5.7.31.tar.gz
[root@mysql ~]# cd /
[root@mysql /]# ls
bin dev home lib64 mnt opt root sbin sys usr
boot etc lib media mysql_3306 proc run srv tmp var
[root@mysql /]# cd m
media/ mnt/ mysql_3306/
[root@mysql /]# cd ~/mysql-5.7.31/
[root@mysql mysql-5.7.31]# ls
archive_output_directory find_libevent_version.c plugin
boost include rapid
BUILD info_macros.cmake README
client INSTALL regex
cmake install_manifest.txt scripts
CMakeCache.txt libbinlogevents source_downloads
CMakeFiles libbinlogstandalone sql
cmake_install.cmake libmysql sql-common
CMakeLists.txt libmysqld storage
cmd-line-utils libservices strings
config.h.cmake LICENSE support-files
configure.cmake make_dist.cmake testclients
CPackConfig.cmake Makefile unittest
CPackSourceConfig.cmake man VERSION
CTestTestfile.cmake myconfig.sh VERSION.dep
dbug mysql-test vio
Docs mysys win
Doxyfile-perfschema mysys_ssl zlib
extra packaging
[root@mysql mysql-5.7.31]# cat myconfig.sh
cmake . \
-DCMAKE_ISNTALL_PREFIX=/mysql_3307 \
-DMYSQL_DATADIR=/mysql_3307/data \
-DMYSQL_TCP_PORT=3307 \
-DMYSQL_UNIX_ADDR=/mysql_3307/mysql.sock \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci\
-DENABLED_LOCAL_INFILE=1 \
-DWITH_SSL=system \
-DWITH_BOOST=boost \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all
[root@mysql mysql-5.7.31]# cd /mysql_3307
-bash: cd: /mysql_3307: No such file or directory
[root@mysql mysql-5.7.31]# ls
archive_output_directory find_libevent_version.c plugin
boost include rapid
BUILD info_macros.cmake README
client INSTALL regex
cmake install_manifest.txt scripts
CMakeCache.txt libbinlogevents source_downloads
CMakeFiles libbinlogstandalone sql
cmake_install.cmake libmysql sql-common
CMakeLists.txt libmysqld storage
cmd-line-utils libservices strings
config.h.cmake LICENSE support-files
configure.cmake make_dist.cmake testclients
CPackConfig.cmake Makefile unittest
CPackSourceConfig.cmake man VERSION
CTestTestfile.cmake myconfig.sh VERSION.dep
dbug mysql-test vio
Docs mysys win
Doxyfile-perfschema mysys_ssl zlib
extra packaging
[root@mysql mysql-5.7.31]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sr0 11:0 1 4.4G 0 rom
[root@mysql mysql-5.7.31]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 475M 0 475M 0% /dev
tmpfs 487M 0 487M 0% /dev/shm
tmpfs 487M 14M 473M 3% /run
tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/mapper/centos-root 17G 12G 5.9G 66% /
/dev/sda1 1014M 138M 877M 14% /boot
tmpfs 98M 0 98M 0% /run/user/0
[root@mysql mysql-5.7.31]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b6c0b
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@mysql mysql-5.7.31]# fdisk /dev/sdb
fdisk: cannot open /dev/sdb: No such file or directory
[root@mysql mysql-5.7.31]#
磁盘管理
MBR分区
fdisk分区
4个主分区或3个主分区+1个拓展分区(N个逻辑分区)
fdisk
新建磁盘
重启
[root@mysql ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x256e2877.
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help):
n 创建新分区
d 删除分区
p 打印分区表
n
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 20971519 10484736 83 Linux
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
No free sectors available
Command (m for help):
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
First sector (2099200-20971519, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-20971519, default 20971519): +1G
Partition 2 of type Linux and of size 1 GiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3):
First sector (4196352-20971519, default 4196352):
Using default value 4196352
Last sector, +sectors or +size{K,M,G} (4196352-20971519, default 20971519): +1G
Partition 3 of type Linux and of size 1 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): p
Selected partition 4
First sector (6293504-20971519, default 6293504):
Using default value 6293504
Last sector, +sectors or +size{K,M,G} (6293504-20971519, default 20971519): +1G
Partition 4 of type Linux and of size 1 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 8390655 1048576 83 Linux
Command (m for help): n
If you want to create more than four partitions, you must replace a
primary partition with an extended partition first.
Command (m for help):
Command (m for help): d
Partition number (1-4, default 4): 4
Partition 4 is deleted
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): e
Selected partition 4
First sector (6293504-20971519, default 6293504):
Using default value 6293504
Last sector, +sectors or +size{K,M,G} (6293504-20971519, default 20971519): +3G
Partition 4 of type Extended and of size 3 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (6295552-12584959, default 6295552):
Using default value 6295552
Last sector, +sectors or +size{K,M,G} (6295552-12584959, default 12584959): +1G
Partition 5 of type Linux and of size 1 GiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
Command (m for help): n
All primary partitions are in use
Adding logical partition 6
First sector (8394752-12584959, default 8394752):
Using default value 8394752
Last sector, +sectors or +size{K,M,G} (8394752-12584959, default 12584959): +1G
Partition 6 of type Linux and of size 1 GiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
Command (m for help): N
All primary partitions are in use
Adding logical partition 7
First sector (10493952-12584959, default 10493952):
Using default value 10493952
Last sector, +sectors or +size{K,M,G} (10493952-12584959, default 12584959): +1G
Value out of range.
Last sector, +sectors or +size{K,M,G} (10493952-12584959, default 12584959): +1023K
Partition 7 of type Linux and of size 1 MiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
/dev/sdb7 10493952 10495999 1024 83 Linux
Command (m for help): N
All primary partitions are in use
Adding logical partition 8
First sector (10498048-12584959, default 10498048):
Using default value 10498048
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +1023M
Value out of range.
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +1022M
Value out of range.
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +1020M
Value out of range.
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +100M
Partition 8 of type Linux and of size 100 MiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
/dev/sdb7 10493952 10495999 1024 83 Linux
/dev/sdb8 10498048 10702847 102400 83 Linux
Command (m for help):
partx -a /dev/sdb
更新分区表
Command (m for help): W
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part
├─sdb2 8:18 0 1G 0 part
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
/dev/sdb7 10493952 10495999 1024 83 Linux
/dev/sdb8 10498048 10702847 102400 83 Linux
[root@mysql ~]# partx -a /dev/sdb
partx: /dev/sdb: error adding partitions 1-8
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part
├─sdb2 8:18 0 1G 0 part
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]#
mkfs.ext4 /dev/sdb1
格式化分区
mkdir /u01
mount /dev/sdb1 /u01
挂载
[root@mysql ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@mysql ~]# mkdir /u01
[root@mysql ~]# mount /dev/sdb1 /u01
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /u01
├─sdb2 8:18 0 1G 0 part
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]# mkfs.vfat /dev/sdb2
-bash: mkfs.vfat: command not found
[root@mysql ~]# yum -y install dosfstools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
updates | 2.9 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package dosfstools.x86_64 0:3.0.20-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================
Package Arch Version Repository Size
========================================================================
Installing:
dosfstools x86_64 3.0.20-10.el7 base 101 k
Transaction Summary
========================================================================
Install 1 Package
Total download size: 101 k
Installed size: 243 k
Downloading packages:
dosfstools-3.0.20-10.el7.x86_64.rpm | 101 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : dosfstools-3.0.20-10.el7.x86_64 1/1
Verifying : dosfstools-3.0.20-10.el7.x86_64 1/1
Installed:
dosfstools.x86_64 0:3.0.20-10.el7
Complete!
[root@mysql ~]# mkfs.vfat /dev/sdb2
mkfs.fat 3.0.20 (12 Jun 2013)
[root@mysql ~]# mkdir /u02
[root@mysql ~]# mount /dev/sdb2 /u02
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /u01
├─sdb2 8:18 0 1G 0 part /u02
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]#
NFS
码
192.168.235.130
[root@mysql /]# cd m
media/ mnt/ mysql_3306/
[root@mysql /]# cd ~/mysql-5.7.31/
[root@mysql mysql-5.7.31]# ls
archive_output_directory find_libevent_version.c plugin
boost include rapid
BUILD info_macros.cmake README
client INSTALL regex
cmake install_manifest.txt scripts
CMakeCache.txt libbinlogevents source_downloads
CMakeFiles libbinlogstandalone sql
cmake_install.cmake libmysql sql-common
CMakeLists.txt libmysqld storage
cmd-line-utils libservices strings
config.h.cmake LICENSE support-files
configure.cmake make_dist.cmake testclients
CPackConfig.cmake Makefile unittest
CPackSourceConfig.cmake man VERSION
CTestTestfile.cmake myconfig.sh VERSION.dep
dbug mysql-test vio
Docs mysys win
Doxyfile-perfschema mysys_ssl zlib
extra packaging
[root@mysql mysql-5.7.31]# cat myconfig.sh
cmake . \
-DCMAKE_ISNTALL_PREFIX=/mysql_3307 \
-DMYSQL_DATADIR=/mysql_3307/data \
-DMYSQL_TCP_PORT=3307 \
-DMYSQL_UNIX_ADDR=/mysql_3307/mysql.sock \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci\
-DENABLED_LOCAL_INFILE=1 \
-DWITH_SSL=system \
-DWITH_BOOST=boost \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all
[root@mysql mysql-5.7.31]# cd /mysql_3307
-bash: cd: /mysql_3307: No such file or directory
[root@mysql mysql-5.7.31]# ls
archive_output_directory find_libevent_version.c plugin
boost include rapid
BUILD info_macros.cmake README
client INSTALL regex
cmake install_manifest.txt scripts
CMakeCache.txt libbinlogevents source_downloads
CMakeFiles libbinlogstandalone sql
cmake_install.cmake libmysql sql-common
CMakeLists.txt libmysqld storage
cmd-line-utils libservices strings
config.h.cmake LICENSE support-files
configure.cmake make_dist.cmake testclients
CPackConfig.cmake Makefile unittest
CPackSourceConfig.cmake man VERSION
CTestTestfile.cmake myconfig.sh VERSION.dep
dbug mysql-test vio
Docs mysys win
Doxyfile-perfschema mysys_ssl zlib
extra packaging
[root@mysql mysql-5.7.31]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sr0 11:0 1 4.4G 0 rom
[root@mysql mysql-5.7.31]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 475M 0 475M 0% /dev
tmpfs 487M 0 487M 0% /dev/shm
tmpfs 487M 14M 473M 3% /run
tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/mapper/centos-root 17G 12G 5.9G 66% /
/dev/sda1 1014M 138M 877M 14% /boot
tmpfs 98M 0 98M 0% /run/user/0
[root@mysql mysql-5.7.31]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b6c0b
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 secto
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@mysql mysql-5.7.31]# fdisk /dev/sdb
fdisk: cannot open /dev/sdb: No such file or directory
[root@mysql mysql-5.7.31]# reroot
-bash: reroot: command not found
[root@mysql mysql-5.7.31]# reboot
Remote side unexpectedly closed network connection
────────────────────────────────────────────────────────────────────────
Session stopped
- Press <Return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
root@192.168.235.130's password:
Access denied
root@192.168.235.130's password:
┌───────────────────────────────────────────────────────────────────
│ • MobaXterm Personal Edition v23.2 •
│ (SSH client, X server and network tools)
│
│ ⮞ SSH session to root@192.168.235.130
│ • Direct SSH : ✓
│ • SSH compression : ✓
│ • SSH-browser : ✓
│ • X11-forwarding : ✗ (disabled or not supported by server)
│
│ ⮞ For more info, ctrl+click on help or visit our website.
└───────────────────────────────────────────────────────────────────
Last failed login: Sat Jul 12 16:22:54 CST 2025 from 192.168.235.1 on ssy
There was 1 failed login attempt since the last successful login.
Last login: Fri Jul 11 21:20:03 2025 from 192.168.235.1
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 475M 0 475M 0% /dev
tmpfs 487M 0 487M 0% /dev/shm
tmpfs 487M 7.7M 479M 2% /run
tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/mapper/centos-root 17G 12G 5.9G 66% /
/dev/sda1 1014M 138M 877M 14% /boot
tmpfs 98M 0 98M 0% /run/user/0
[root@mysql ~]# fdisk -l
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b6c0b
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 secto
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@mysql ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xb35cd5b9.
Command (m for help): fdisk /dev/sdb
f: unknown command
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): fdisk /dev/sdb
f: unknown command
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): exit
e: unknown command
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): x
Expert command (m for help): m
Command action
b move beginning of data in a partition
c change number of cylinders
d print the raw data in the first sector
e list extended partitions
f fix partition order
g create an IRIX (SGI) partition table
h change number of heads
i change the disk identifier
m print this menu
p print the partition table
q quit without saving changes
r return to main menu
s change number of sectors/track
v verify the partition table
w write table to disk and exit
Expert command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@mysql ~]# fdisk -l
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b6c0b
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 secto
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@mysql ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x256e2877.
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 20971519 10484736 83 Linux
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
No free sectors available
Command (m for help): d
Selected partition 1
Partition 1 is deleted
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1g
Unsupported suffix: 'g'.
Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte)
2^N: K (KibiByte), M (MebiByte), G (GibiByte)
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1G
Partition 1 of type Linux and of size 1 GiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
First sector (2099200-20971519, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-20971519, default 20971519): +1G
Partition 2 of type Linux and of size 1 GiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3):
First sector (4196352-20971519, default 4196352):
Using default value 4196352
Last sector, +sectors or +size{K,M,G} (4196352-20971519, default 20971519): +1G
Partition 3 of type Linux and of size 1 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): p
Selected partition 4
First sector (6293504-20971519, default 6293504):
Using default value 6293504
Last sector, +sectors or +size{K,M,G} (6293504-20971519, default 20971519): +1G
Partition 4 of type Linux and of size 1 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 8390655 1048576 83 Linux
Command (m for help): n
If you want to create more than four partitions, you must replace a
primary partition with an extended partition first.
Command (m for help): d
Partition number (1-4, default 4): 4
Partition 4 is deleted
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
Command (m for help): n
Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): e
Selected partition 4
First sector (6293504-20971519, default 6293504):
Using default value 6293504
Last sector, +sectors or +size{K,M,G} (6293504-20971519, default 20971519): +3G
Partition 4 of type Extended and of size 3 GiB is set
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (6295552-12584959, default 6295552):
Using default value 6295552
Last sector, +sectors or +size{K,M,G} (6295552-12584959, default 12584959): +1G
Partition 5 of type Linux and of size 1 GiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
Command (m for help): n
All primary partitions are in use
Adding logical partition 6
First sector (8394752-12584959, default 8394752):
Using default value 8394752
Last sector, +sectors or +size{K,M,G} (8394752-12584959, default 12584959): +1G
Partition 6 of type Linux and of size 1 GiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
Command (m for help): N
All primary partitions are in use
Adding logical partition 7
First sector (10493952-12584959, default 10493952):
Using default value 10493952
Last sector, +sectors or +size{K,M,G} (10493952-12584959, default 12584959): +1G
Value out of range.
Last sector, +sectors or +size{K,M,G} (10493952-12584959, default 12584959): +1023K
Partition 7 of type Linux and of size 1 MiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
/dev/sdb7 10493952 10495999 1024 83 Linux
Command (m for help): N
All primary partitions are in use
Adding logical partition 8
First sector (10498048-12584959, default 10498048):
Using default value 10498048
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +1023M
Value out of range.
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +1022M
Value out of range.
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +1020M
Value out of range.
Last sector, +sectors or +size{K,M,G} (10498048-12584959, default 12584959): +100M
Partition 8 of type Linux and of size 100 MiB is set
Command (m for help): P
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
/dev/sdb7 10493952 10495999 1024 83 Linux
/dev/sdb8 10498048 10702847 102400 83 Linux
Command (m for help): W
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part
├─sdb2 8:18 0 1G 0 part
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x256e2877
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 4196351 1048576 83 Linux
/dev/sdb3 4196352 6293503 1048576 83 Linux
/dev/sdb4 6293504 12584959 3145728 5 Extended
/dev/sdb5 6295552 8392703 1048576 83 Linux
/dev/sdb6 8394752 10491903 1048576 83 Linux
/dev/sdb7 10493952 10495999 1024 83 Linux
/dev/sdb8 10498048 10702847 102400 83 Linux
[root@mysql ~]# partx -a /dev/sdb
partx: /dev/sdb: error adding partitions 1-8
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part
├─sdb2 8:18 0 1G 0 part
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@mysql ~]# mkdir /u01
[root@mysql ~]# mount /dev/sdb1 /u01
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /u01
├─sdb2 8:18 0 1G 0 part
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]# mkfs.vfat /dev/sdb2
-bash: mkfs.vfat: command not found
[root@mysql ~]# yum -y install dosfstools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
updates | 2.9 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package dosfstools.x86_64 0:3.0.20-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================
Package Arch Version Repository Size
========================================================================
Installing:
dosfstools x86_64 3.0.20-10.el7 base 101 k
Transaction Summary
========================================================================
Install 1 Package
Total download size: 101 k
Installed size: 243 k
Downloading packages:
dosfstools-3.0.20-10.el7.x86_64.rpm | 101 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : dosfstools-3.0.20-10.el7.x86_64 1/1
Verifying : dosfstools-3.0.20-10.el7.x86_64 1/1
Installed:
dosfstools.x86_64 0:3.0.20-10.el7
Complete!
[root@mysql ~]# mkfs.vfat /dev/sdb2
mkfs.fat 3.0.20 (12 Jun 2013)
[root@mysql ~]# mkdir /u02
[root@mysql ~]# mount /dev/sdb2 /u02
[root@mysql ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /u01
├─sdb2 8:18 0 1G 0 part /u02
├─sdb3 8:19 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part
├─sdb7 8:23 0 1M 0 part
└─sdb8 8:24 0 100M 0 part
sr0 11:0 1 4.4G 0 rom
[root@mysql ~]#
192.168.235.10
web
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v23.2 • │
│ (SSH client, X server and network tools) │
│ │
│ ⮞ SSH session to code@192.168.235.10 │
│ • Direct SSH : ✓ │
│ • SSH compression : ✓ │
│ • SSH-browser : ✓ │
│ • X11-forwarding : ✓ (remote display is forwarded through SSH) │
│ │
│ ⮞ For more info, ctrl+click on help or visit our website. │
└──────────────────────────────────────────────────────────────────────┘
Last login: Sun Jun 29 13:44:40 2025 from 192.168.235.1
[code@samba ~]$ hostname
samba.web.cn
[code@samba ~]$ yum repolist
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
源标识 源名称 状态
local1 local yum 4,070
repolist: 4,070
[code@samba ~]$ systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[code@samba ~]$ setenforce 0
setenforce: setenforce() failed
[code@samba ~]$ setenforce 0
setenforce: setenforce() failed
[code@samba ~]$ cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[code@samba ~]$ sudo su
[sudo] code 的密码:
code 不在 sudoers 文件中。此事将被报告。
[code@samba ~]$ su - caozx26
密码:
上一次登录:日 6月 29 13:50:45 CST 2025pts/2 上
[caozx26@samba ~]$ sudo su
[sudo] caozx26 的密码:
[root@samba caozx26]# setenforce 0
[root@samba caozx26]# systemctl status httpd
Unit httpd.service could not be found.
[root@samba caozx26]# yum install httpd -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-95.el7.centos 将被 安装
--> 解决依赖关系完成
依赖关系解决
====================================================================================
Package 架构 版本 源 大小
====================================================================================
正在安装:
httpd x86_64 2.4.6-95.el7.centos local1 2.7 M
事务概要
====================================================================================
安装 1 软件包
总下载量:2.7 M
安装大小:9.4 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : httpd-2.4.6-95.el7.centos.x86_64 1/1
验证中 : httpd-2.4.6-95.el7.centos.x86_64 1/1
已安装:
httpd.x86_64 0:2.4.6-95.el7.centos
完毕!
[root@samba caozx26]# systemctl start httpd
[root@samba caozx26]# echo "NFS实战">>/var/www/html/index.html
[root@samba caozx26]# cat /var/www/html/index.html
<img src="media/1.jpg" alt="芒果" width="200" height="100">
<video width="900" height="450" controls>
<source src="media/2.mp4">
</video>
NFS实战
[root@samba caozx26]# ll -d /var/www/html/media
drwxr-xr-x. 2 root root 58 6月 21 20:30 /var/www/html/media
[root@samba caozx26]# cat /var/www/html/media
cat: /var/www/html/media: 是一个目录
[root@samba caozx26]# mount -t nfs 192.168.235.3:/share /var/www/html/media
mount.nfs: /var/www/html/media is busy or already mounted
[root@samba caozx26]# ll /var/www/html/media
总用量 7652
-rw-r--r--. 1 root root 8330 6月 21 11:30 1.jpg
-rw-r--r--. 1 root root 7803714 6月 21 13:14 2.mp4
-rw-r--r--. 1 root root 5767 6月 21 18:47 3.jpg
-rw-r--r--. 1 root root 5379 6月 21 20:30 4.jpg
[root@samba caozx26]# cat /var/www/html/index.html
<img src="media/1.jpg" alt="芒果" width="200" height="100">
<video width="900" height="450" controls>
<source src="media/2.mp4">
</video>
NFS实战
[root@samba caozx26]# ca
192.168.235.3
nfs
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v23.2 • │
│ (SSH client, X server and network tools) │
│ │
│ ⮞ SSH session to root@192.168.235.3 │
│ • Direct SSH : ✓ │
│ • SSH compression : ✓ │
│ • SSH-browser : ✓ │
│ • X11-forwarding : ✓ (remote display is forwarded through SSH) │
│ │
│ ⮞ For more info, ctrl+click on help or visit our website. │
└──────────────────────────────────────────────────────────────────────┘
Last login: Sun Jun 29 13:44:20 2025 from 192.168.235.1
[root@nfs ~]# hostname
nfs.cn
[root@nfs ~]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,791
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 526
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 6,173
repolist: 30,562
[root@nfs ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:d8:7a:bb brd ff:ff:ff:ff:ff:ff
inet 192.168.235.3/24 brd 192.168.235.255 scope global ens33
valid_lft forever preferred_lft forever
3: ens34: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:0c:29:d8:7a:c5 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:62:f3:9e brd ff:ff:ff:ff:ff:ff
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:62:f3:9e brd ff:ff:ff:ff:ff:ff
[root@nfs ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
5月 10 05:13:51 localhost.localdomain systemd[1]: Starting firewalld - dynamic ....
5月 10 05:13:52 localhost.localdomain systemd[1]: Started firewalld - dynamic f....
5月 10 05:13:53 localhost.localdomain firewalld[828]: WARNING: AllowZoneDrifting...
5月 10 08:41:22 localhost.localdomain systemd[1]: Stopping firewalld - dynamic ....
5月 10 08:41:26 localhost.localdomain systemd[1]: Stopped firewalld - dynamic f....
Hint: Some lines were ellipsized, use -l to show in full.
[root@nfs ~]# setenforce 0
[root@nfs ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@nfs ~]# setenforce 0
[root@nfs ~]# rpm -ql rpcbind
/etc/sysconfig/rpcbind
/usr/lib/systemd/system/rpcbind.service
/usr/lib/systemd/system/rpcbind.socket
/usr/lib/tmpfiles.d/rpcbind.conf
/usr/sbin/rpcbind
/usr/sbin/rpcinfo
/usr/share/doc/rpcbind-0.2.0
/usr/share/doc/rpcbind-0.2.0/AUTHORS
/usr/share/doc/rpcbind-0.2.0/ChangeLog
/usr/share/doc/rpcbind-0.2.0/README
/usr/share/man/man8/rpcbind.8.gz
/usr/share/man/man8/rpcinfo.8.gz
/var/lib/rpcbind
[root@nfs ~]# rpm -ql rpcutil
未安装软件包 rpcutil
[root@nfs ~]# rpm -ql nfs-utils
/etc/exports.d
/etc/gssproxy/24-nfs-server.conf
/etc/modprobe.d/lockd.conf
/etc/nfs.conf
/etc/nfsmount.conf
/etc/request-key.d/id_resolver.conf
/etc/sysconfig/nfs
/sbin/mount.nfs
/sbin/mount.nfs4
/sbin/osd_login
/sbin/rpc.statd
/sbin/umount.nfs
/sbin/umount.nfs4
/usr/lib/systemd/scripts/nfs-utils_env.sh
/usr/lib/systemd/system-generators/nfs-server-generator
/usr/lib/systemd/system-generators/rpc-pipefs-generator
/usr/lib/systemd/system/auth-rpcgss-module.service
/usr/lib/systemd/system/nfs-blkmap.service
/usr/lib/systemd/system/nfs-client.target
/usr/lib/systemd/system/nfs-config.service
/usr/lib/systemd/system/nfs-idmap.service
/usr/lib/systemd/system/nfs-idmapd.service
/usr/lib/systemd/system/nfs-lock.service
/usr/lib/systemd/system/nfs-mountd.service
/usr/lib/systemd/system/nfs-secure.service
/usr/lib/systemd/system/nfs-server.service
/usr/lib/systemd/system/nfs-utils.service
/usr/lib/systemd/system/nfs.service
/usr/lib/systemd/system/nfslock.service
/usr/lib/systemd/system/proc-fs-nfsd.mount
/usr/lib/systemd/system/rpc-gssd.service
/usr/lib/systemd/system/rpc-statd-notify.service
/usr/lib/systemd/system/rpc-statd.service
/usr/lib/systemd/system/rpc_pipefs.target
/usr/lib/systemd/system/rpcgssd.service
/usr/lib/systemd/system/rpcidmapd.service
/usr/lib/systemd/system/var-lib-nfs-rpc_pipefs.mount
/usr/sbin/blkmapd
/usr/sbin/exportfs
/usr/sbin/mountstats
/usr/sbin/nfsdcltrack
/usr/sbin/nfsidmap
/usr/sbin/nfsiostat
/usr/sbin/nfsstat
/usr/sbin/rpc.gssd
/usr/sbin/rpc.idmapd
/usr/sbin/rpc.mountd
/usr/sbin/rpc.nfsd
/usr/sbin/rpcdebug
/usr/sbin/showmount
/usr/sbin/sm-notify
/usr/sbin/start-statd
/usr/share/doc/nfs-utils-1.3.0
/usr/share/doc/nfs-utils-1.3.0/ChangeLog
/usr/share/doc/nfs-utils-1.3.0/KNOWNBUGS
/usr/share/doc/nfs-utils-1.3.0/NEW
/usr/share/doc/nfs-utils-1.3.0/README
/usr/share/doc/nfs-utils-1.3.0/THANKS
/usr/share/doc/nfs-utils-1.3.0/TODO
/usr/share/man/man5/exports.5.gz
/usr/share/man/man5/nfs.5.gz
/usr/share/man/man5/nfs.conf.5.gz
/usr/share/man/man5/nfsmount.conf.5.gz
/usr/share/man/man7/nfs.systemd.7.gz
/usr/share/man/man7/nfsd.7.gz
/usr/share/man/man8/blkmapd.8.gz
/usr/share/man/man8/exportfs.8.gz
/usr/share/man/man8/gssd.8.gz
/usr/share/man/man8/idmapd.8.gz
/usr/share/man/man8/mount.nfs.8.gz
/usr/share/man/man8/mountd.8.gz
/usr/share/man/man8/mountstats.8.gz
/usr/share/man/man8/nfsd.8.gz
/usr/share/man/man8/nfsdcltrack.8.gz
/usr/share/man/man8/nfsidmap.8.gz
/usr/share/man/man8/nfsiostat.8.gz
/usr/share/man/man8/nfsstat.8.gz
/usr/share/man/man8/rpc.gssd.8.gz
/usr/share/man/man8/rpc.idmapd.8.gz
/usr/share/man/man8/rpc.mountd.8.gz
/usr/share/man/man8/rpc.nfsd.8.gz
/usr/share/man/man8/rpc.sm-notify.8.gz
/usr/share/man/man8/rpc.statd.8.gz
/usr/share/man/man8/rpcdebug.8.gz
/usr/share/man/man8/showmount.8.gz
/usr/share/man/man8/sm-notify.8.gz
/usr/share/man/man8/statd.8.gz
/usr/share/man/man8/umount.nfs.8.gz
/var/lib/nfs
/var/lib/nfs/etab
/var/lib/nfs/rmtab
/var/lib/nfs/rpc_pipefs
/var/lib/nfs/statd
/var/lib/nfs/statd/sm
/var/lib/nfs/statd/sm.bak
/var/lib/nfs/state
/var/lib/nfs/v4recovery
/var/lib/nfs/xtab
[root@nfs ~]# rpm -a rpcbind
RPM 版本 4.11.3
版权所有 (C) 1998-2002 - 红帽公司。
该程序可以在 GNU GPL 条款下自由分发
用法: rpm [-aKfgpqVcdLilsiv?] [-a|--all] [-f|--file] [-g|--group] [-p|--package]
[--pkgid] [--hdrid] [--triggeredby] [--whatrequires] [--whatprovides]
[--nomanifest] [-c|--configfiles] [-d|--docfiles] [-L|--licensefiles]
[--dump] [-l|--list] [--queryformat=QUERYFORMAT] [-s|--state]
[--nofiledigest] [--nofiles] [--nodeps] [--noscript] [--allfiles]
[--allmatches] [--badreloc] [-e|--erase <package>+] [--excludedocs]
[--excludepath=<path>] [--force] [-F|--freshen <packagefile>+] [-h|--hash]
[--ignorearch] [--ignoreos] [--ignoresize] [-i|--install] [--justdb]
[--nodeps] [--nofiledigest] [--nocontexts] [--noorder] [--noscripts]
[--notriggers] [--nocollections] [--oldpackage] [--percent]
[--prefix=<dir>] [--relocate=<old>=<new>] [--replacefiles]
[--replacepkgs] [--test] [-U|--upgrade <packagefile>+]
[--reinstall=<packagefile>+] [-D|--define “MACRO EXPR”] [--undefine=MACRO]
[-E|--eval “EXPR”] [--macros=<FILE:…>] [--noplugins] [--nodigest]
[--nosignature] [--rcfile=<FILE:…>] [-r|--root ROOT] [--dbpath=DIRECTORY]
[--querytags] [--showrc] [--quiet] [-v|--verbose] [--version]
[-?|--help] [--usage] [--scripts] [--setperms] [--setugids] [--setcaps]
[--restore] [--conflicts] [--obsoletes] [--provides] [--requires]
[--info] [--changelog] [--xml] [--triggers] [--last] [--dupes]
[--filesbypkg] [--fileclass] [--filecolor] [--fscontext]
[--fileprovide] [--filerequire] [--filecaps]
[root@nfs ~]# rpm -q rpcbinf
未安装软件包 rpcbinf
[root@nfs ~]# rpm -q rpcbind
rpcbind-0.2.0-49.el7.x86_64
[root@nfs ~]# rpm -qa|grep ^nfs
nfs-utils-1.3.0-0.68.el7.2.x86_64
nfs4-acl-tools-0.3.3-21.el7.x86_64
[root@nfs ~]# cat /etc/exports
/share 192.168.235.0/24(rw,sync)
[root@nfs ~]# systemctl status rpcbind
● rpcbind.service - RPC bind service
Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
Active: active (running) since 五 2025-06-20 22:40:51 CST; 3 weeks 0 days ago
Main PID: 91918 (rpcbind)
Tasks: 1
CGroup: /system.slice/rpcbind.service
└─91918 /sbin/rpcbind -w
6月 20 22:40:51 nfs.cn systemd[1]: Starting RPC bind service...
6月 20 22:40:51 nfs.cn systemd[1]: Started RPC bind service.
[root@nfs ~]# systemctl status nfs
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
└─order-with-mounts.conf
Active: active (exited) since 五 2025-06-20 22:41:00 CST; 3 weeks 0 days ago
Main PID: 91949 (code=exited, status=0/SUCCESS)
Tasks: 0
CGroup: /system.slice/nfs-server.service
6月 20 22:40:59 nfs.cn systemd[1]: Starting NFS server and services...
6月 20 22:41:00 nfs.cn systemd[1]: Started NFS server and services.
[root@nfs ~]# ss -naltp|grep 111
LISTEN 0 128 *:111 *:* users:(("rpcbind",pid=91918,fd=8))
LISTEN 0 128 [::]:111 [::]:* users:(("rpcbind",pid=91918,fd=11))
[root@nfs ~]# ss -naltp |grep 111
LISTEN 0 128 *:111 *:* users:(("rpcbind",pid=91918,fd=8))
LISTEN 0 128 [::]:111 [::]:* users:(("rpcbind",pid=91918,fd=11))
[root@nfs ~]# yum status httpd
已加载插件:fastestmirror, langpacks
没有该命令:status。请使用 /usr/bin/yum --help
[root@nfs ~]# systemctl status httpd
Unit httpd.service could not be found.
[root@nfs ~]# ls share
ls: 无法访问share: 没有那个文件或目录
[root@nfs ~]# ls /share
1.jpg 2.mp4 3.jpg 4.jpg
[root@nfs ~]# cd ~
[root@nfs ~]# ls
1.txt initial-setup-ks.cfg inotify-tools-3.13.tar.gz
anaconda-ks.cfg inotify-tools-3.13
[root@nfs ~]# cd inotify-tools-3.13/
[root@nfs inotify-tools-3.13]# ls
aclocal.m4 config.h config.sub INSTALL Makefile NEWS
AUTHORS config.h.in configure install-sh Makefile.am README
autom4te.cache config.h.in~ configure.ac libinotifytools Makefile.in src
ChangeLog config.log COPYING libtool man stamp-h1
config.guess config.status depcomp ltmain.sh missing
[root@nfs inotify-tools-3.13]# cd ~
[root@nfs ~]# ls
1.txt initial-setup-ks.cfg inotify-tools-3.13.tar.gz
anaconda-ks.cfg inotify-tools-3.13
[root@nfs ~]# cd /
[root@nfs /]# ls
bin code etc lib media nohup.out proc rsync.sh sbin srv tmp usr
boot dev home lib64 mnt opt root run share sys u01 var
[root@nfs /]# cat rsync.sh
/usr/local/bin/inotifywait -mrq -e create,modify,delete,move,attrib /share |while read events
do
rsync -a --delete /share/ root@192.168.235.100:/backup
echo "$(date +'%F %T')发生$events">>/var/log/rsync.log 2>&1
done
[root@nfs /]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)?
[root@nfs /]# ftp 192.168.235.100
Connected to 192.168.235.100 (192.168.235.100).
220 (vsFTPd 3.0.2)
Name (192.168.235.100:root): root
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.
[root@nfs /]# ssh root@192.168.235.100
Last login: Sat Jul 12 20:17:31 2025 from 192.168.235.1
[root@backup ~]# bye
bash: bye: 未找到命令...
[root@backup ~]# exit
登出
Connection to 192.168.235.100 closed.
[root@nfs /]# ssh-copy-id root@192.168.235.100
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
(if you think this is a mistake, you may want to use -f option)
[root@nfs /]# cat rsync.sh
/usr/local/bin/inotifywait -mrq -e create,modify,delete,move,attrib /share |while read events
do
rsync -a --delete /share/ root@192.168.235.100:/backup
echo "$(date +'%F %T')发生$events">>/var/log/rsync.log 2>&1
done
[root@nfs /]#
192.168.235.100
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v23.2 • │
│ (SSH client, X server and network tools) │
│ │
│ ⮞ SSH session to root@192.168.235.100 │
│ • Direct SSH : ✓ │
│ • SSH compression : ✓ │
│ • SSH-browser : ✓ │
│ • X11-forwarding : ✓ (remote display is forwarded through SSH) │
│ │
│ ⮞ For more info, ctrl+click on help or visit our website. │
└──────────────────────────────────────────────────────────────────────┘
Last login: Sun Jun 22 14:51:14 2025 from 192.168.235.1
ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1750575074
[root@backup ~]# ls /backup
1.jpg 2.mp4 3.jpg 4.jpg app1_java
[root@backup ~]#