iscsi

root@node1 ~]# yum -y install targetcli
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在解决依赖关系
--> 正在检查事务
---> 软件包 targetcli.noarch.0.2.1.fb46-1.el7 将被 安装
--> 正在处理依赖关系 python-rtslib >= 2.1.fb41,它被软件包 targetcli-2.1.fb46-1.el7.noarch 需要
--> 正在处理依赖关系 python-configshell,它被软件包 targetcli-2.1.fb46-1.el7.noarch 需要
--> 正在检查事务
---> 软件包 python-configshell.noarch.1.1.1.fb23-3.el7 将被 安装
--> 正在处理依赖关系 pyparsing,它被软件包 1:python-configshell-1.1.fb23-3.el7.noarch 需要
--> 正在处理依赖关系 python-urwid,它被软件包 1:python-configshell-1.1.fb23-3.el7.noarch 需要
---> 软件包 python-rtslib.noarch.0.2.1.fb63-2.el7 将被 安装
--> 正在处理依赖关系 python-kmod,它被软件包 python-rtslib-2.1.fb63-2.el7.noarch 需要
--> 正在检查事务
---> 软件包 pyparsing.noarch.0.1.5.6-9.el7 将被 安装
---> 软件包 python-kmod.x86_64.0.0.9-4.el7 将被 安装
---> 软件包 python-urwid.x86_64.0.1.1.1-3.el7 将被 安装
--> 解决依赖关系完成


依赖关系解决


================================================================================
 Package                  架构         版本                   源           大小
================================================================================
正在安装:
 targetcli                noarch       2.1.fb46-1.el7         rhel7        64 k
为依赖而安装:
 pyparsing                noarch       1.5.6-9.el7            rhel7        94 k
 python-configshell       noarch       1:1.1.fb23-3.el7       rhel7        67 k
 python-kmod              x86_64       0.9-4.el7              rhel7        57 k
 python-rtslib            noarch       2.1.fb63-2.el7         rhel7        97 k
 python-urwid             x86_64       1.1.1-3.el7            rhel7       654 k


事务概要
================================================================================
安装  1 软件包 (+5 依赖软件包)


总下载量:1.0 M
安装大小:4.6 M
Downloading packages:
(1/6): pyparsing-1.5.6-9.el7.noarch.rpm                    |  94 kB   00:00     
(2/6): python-configshell-1.1.fb23-3.el7.noarch.rpm        |  67 kB   00:00     
(3/6): python-kmod-0.9-4.el7.x86_64.rpm                    |  57 kB   00:00     
(4/6): python-rtslib-2.1.fb63-2.el7.noarch.rpm             |  97 kB   00:00     
(5/6): python-urwid-1.1.1-3.el7.x86_64.rpm                 | 654 kB   00:00     
(6/6): targetcli-2.1.fb46-1.el7.noarch.rpm                 |  64 kB   00:00     
--------------------------------------------------------------------------------
总计                                               4.3 MB/s | 1.0 MB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : python-kmod-0.9-4.el7.x86_64                                1/6 
  正在安装    : python-rtslib-2.1.fb63-2.el7.noarch                         2/6 
  正在安装    : pyparsing-1.5.6-9.el7.noarch                                3/6 
  正在安装    : python-urwid-1.1.1-3.el7.x86_64                             4/6 
  正在安装    : 1:python-configshell-1.1.fb23-3.el7.noarch                  5/6 
  正在安装    : targetcli-2.1.fb46-1.el7.noarch                             6/6 
rhel7/productid                                          | 1.6 kB     00:00     
  验证中      : python-rtslib-2.1.fb63-2.el7.noarch                         1/6 
  验证中      : 1:python-configshell-1.1.fb23-3.el7.noarch                  2/6 
  验证中      : python-urwid-1.1.1-3.el7.x86_64                             3/6 
  验证中      : pyparsing-1.5.6-9.el7.noarch                                4/6 
  验证中      : python-kmod-0.9-4.el7.x86_64                                5/6 
  验证中      : targetcli-2.1.fb46-1.el7.noarch                             6/6 


已安装:
  targetcli.noarch 0:2.1.fb46-1.el7                                             


作为依赖被安装:
  pyparsing.noarch 0:1.5.6-9.el7     python-configshell.noarch 1:1.1.fb23-3.el7 
  python-kmod.x86_64 0:0.9-4.el7     python-rtslib.noarch 0:2.1.fb63-2.el7      
  python-urwid.x86_64 0:1.1.1-3.el7 


完毕!
[root@node1 ~]# fsblk
bash: fsblk: 未找到命令...
[root@node1 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
vdb           252:16   0   20G  0 disk 
[root@node1 ~]# parted /dev/vdb
GNU Parted 3.1
使用 /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
(parted) mkpart primary 1M 50%                                            
(parted) mkpart primary  50%  100%                                      
(parted) print                                                            
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 


Number  Start   End     Size    File system  Name     标志
 1      1049kB  10.7GB  10.7GB               primary
 2      10.7GB  21.5GB  10.7GB               primary


(parted) quit                                                             
信息: You may need to update /etc/fstab.


[root@node1 ~]# lsblk                                                     
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
vdb           252:16   0   20G  0 disk 
├─vdb1        252:17   0   10G  0 part 
└─vdb2        252:18   0   10G  0 part 
[root@node1 ~]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.fb46
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.


/> ls
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- block .............................................. [Storage Objects: 0]
  | o- fileio ............................................. [Storage Objects: 0]
  | o- pscsi .............................................. [Storage Objects: 0]
  | o- ramdisk ............................................ [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 0]
  o- loopback ..................................................... [Targets: 0]
/> /backstores/
/backstores/*         /backstores/block/    /backstores/fileio/   
/backstores/pscsi/    /backstores/ramdisk/  
/> /backstores/block 
bookmarks  cd         create     delete     exit       get        help       
ls         pwd        refresh    set        status     
/> /backstores/block create formysql /dev/vdb1
Created block storage object formysql using /dev/vdb1.
/> /iscsi 
@last      bookmarks  cd         create     delete     exit       get        
help       info       ls         pwd        refresh    set        status     
version    
/> /iscsi create iqn.2018-07.cn.tedu.nsd1803
Created target iqn.2018-07.cn.tedu.nsd1803.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/> ls
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- block .............................................. [Storage Objects: 1]
  | | o- formysql ................. [/dev/vdb1 (0 bytes) write-thru deactivated]
  | |   o- alua ............................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ................... [ALUA state: Active/optimized]
  | o- fileio ............................................. [Storage Objects: 0]
  | o- pscsi .............................................. [Storage Objects: 0]
  | o- ramdisk ............................................ [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 1]
  | o- iqn.2018-07.cn.tedu.nsd1803 ................................... [TPGs: 1]
  |   o- tpg1 ........................................... [no-gen-acls, no-auth]
  |     o- acls ...................................................... [ACLs: 0]
  |     o- luns ...................................................... [LUNs: 0]
  |     o- portals ................................................ [Portals: 1]
  |       o- 0.0.0.0:3260 ................................................. [OK]
  o- loopback ..................................................... [Targets: 0]
/> /iscsi/iqn.2018-07.cn.tedu.nsd1803/tpg1/luns create /backstores/block/formysql 
Created LUN 0.
/> ls
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- block .............................................. [Storage Objects: 1]
  | | o- formysql ................... [/dev/vdb1 (0 bytes) write-thru activated]
  | |   o- alua ............................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ................... [ALUA state: Active/optimized]
  | o- fileio ............................................. [Storage Objects: 0]
  | o- pscsi .............................................. [Storage Objects: 0]
  | o- ramdisk ............................................ [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 1]
  | o- iqn.2018-07.cn.tedu.nsd1803 ................................... [TPGs: 1]
  |   o- tpg1 ........................................... [no-gen-acls, no-auth]
  |     o- acls ...................................................... [ACLs: 0]
  |     o- luns ...................................................... [LUNs: 1]
  |     | o- lun0 .............. [block/formysql (/dev/vdb1) (default_tg_pt_gp)]
  |     o- portals ................................................ [Portals: 1]
  |       o- 0.0.0.0:3260 ................................................. [OK]
  o- loopback ..................................................... [Targets: 0]
/> /iscsi/iqn.2018-07.cn.tedu.nsd1803/tpg1/acls create iqn.2018-07.cn.tedu.node2
Created Node ACL for iqn.2018-07.cn.tedu.node2
Created mapped LUN 0.
/> ls
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- block .............................................. [Storage Objects: 1]
  | | o- formysql ................... [/dev/vdb1 (0 bytes) write-thru activated]
  | |   o- alua ............................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ................... [ALUA state: Active/optimized]
  | o- fileio ............................................. [Storage Objects: 0]
  | o- pscsi .............................................. [Storage Objects: 0]
  | o- ramdisk ............................................ [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 1]
  | o- iqn.2018-07.cn.tedu.nsd1803 ................................... [TPGs: 1]
  |   o- tpg1 ........................................... [no-gen-acls, no-auth]
  |     o- acls ...................................................... [ACLs: 1]
  |     | o- iqn.2018-07.cn.tedu.node2 ........................ [Mapped LUNs: 1]
  |     |   o- mapped_lun0 .......................... [lun0 block/formysql (rw)]
  |     o- luns ...................................................... [LUNs: 1]
  |     | o- lun0 .............. [block/formysql (/dev/vdb1) (default_tg_pt_gp)]
  |     o- portals ................................................ [Portals: 1]
  |       o- 0.0.0.0:3260 ................................................. [OK]
  o- loopback ..................................................... [Targets: 0]
/> /iscsi/iqn.2018-07.cn.tedu.nsd1803/tpg1/acls create iqn.2018-07.cn.tedu.node3
Created Node ACL for iqn.2018-07.cn.tedu.node3
Created mapped LUN 0.
/> saveconfig 
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
[root@node1 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
vdb           252:16   0   20G  0 disk 
├─vdb1        252:17   0   10G  0 part 
└─vdb2        252:18   0   10G  0 part 

[root@node1 ~]# 




[root@node2 ~]# yum list | grep iscsi
iscsi-initiator-utils.x86_64            6.2.0.874-4.el7            @anaconda/7.4
iscsi-initiator-utils-iscsiuio.x86_64   6.2.0.874-4.el7            @anaconda/7.4
libiscsi.x86_64                         1.9.0-7.el7                @anaconda/7.4
libvirt-daemon-driver-storage-iscsi.x86_64
iscsi-initiator-utils.i686              6.2.0.874-4.el7            rhel7        
libiscsi.i686                           1.9.0-7.el7                rhel7        
[root@node2 ~]# yum -y install iscsi-initiator-utils
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
软件包 iscsi-initiator-utils-6.2.0.874-4.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@node2 ~]# vim /etc/iscsi/initiatorname.iscsi 
[root@node2 ~]# iscsi
iscsiadm     iscsid       iscsi-iname  iscsistart   iscsiuio     
[root@node2 ~]# man iscsiadm 
[root@node2 ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.4.1 --discover
192.168.4.1:3260,1 iqn.2018-07.cn.tedu.nsd1803
[root@node2 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
[root@node2 ~]# systemctl restart iscsi
[root@node2 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   10G  0 disk 
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
[root@node2 ~]# systemctl enable iscsi
[root@node2 ~]# systemctl enable iscsid
Created symlink from /etc/systemd/system/multi-user.target.wants/iscsid.service to /usr/lib/systemd/system/iscsid.service.
[root@node2 ~]# yum -y install mariadb-server
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-server.x86_64.1.5.5.56-2.el7 将被 安装
--> 正在处理依赖关系 mariadb(x86-64) = 1:5.5.56-2.el7,它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要
--> 正在处理依赖关系 perl-DBD-MySQL,它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.56-2.el7 将被 安装
---> 软件包 perl-DBD-MySQL.x86_64.0.4.023-5.el7 将被 安装
--> 解决依赖关系完成


依赖关系解决


================================================================================
 Package               架构          版本                    源            大小
================================================================================
正在安装:
 mariadb-server        x86_64        1:5.5.56-2.el7          rhel7         11 M
为依赖而安装:
 mariadb               x86_64        1:5.5.56-2.el7          rhel7        9.1 M
 perl-DBD-MySQL        x86_64        4.023-5.el7             rhel7        140 k


事务概要
================================================================================
安装  1 软件包 (+2 依赖软件包)


总下载量:20 M
安装大小:107 M
Downloading packages:
(1/3): mariadb-5.5.56-2.el7.x86_64.rpm                     | 9.1 MB   00:00     
(2/3): mariadb-server-5.5.56-2.el7.x86_64.rpm              |  11 MB   00:00     
(3/3): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm               | 140 kB   00:00     
--------------------------------------------------------------------------------
总计                                                36 MB/s |  20 MB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 1:mariadb-5.5.56-2.el7.x86_64                               1/3 
  正在安装    : perl-DBD-MySQL-4.023-5.el7.x86_64                           2/3 
  正在安装    : 1:mariadb-server-5.5.56-2.el7.x86_64                        3/3 
rhel7/productid                                          | 1.6 kB     00:00     
  验证中      : 1:mariadb-server-5.5.56-2.el7.x86_64                        1/3 
  验证中      : perl-DBD-MySQL-4.023-5.el7.x86_64                           2/3 
  验证中      : 1:mariadb-5.5.56-2.el7.x86_64                               3/3 


已安装:
  mariadb-server.x86_64 1:5.5.56-2.el7                                          


作为依赖被安装:
  mariadb.x86_64 1:5.5.56-2.el7       perl-DBD-MySQL.x86_64 0:4.023-5.el7      


完毕!
[root@node2 ~]# ls /var/lib/mysql/
[root@node2 ~]# mount /dev/sda 
anaconda-ks.cfg       .esd_auth             模板/
.bash_history         .ICEauthority         视频/
.bash_logout          initial-setup-ks.cfg  图片/
.bash_profile         .lesshst              文档/
.bashrc               .local/               下载/
.cache/               .tcshrc               音乐/
.config/              .viminfo              桌面/
.cshrc                .Xauthority           
.dbus/                公共/                 
[root@node2 ~]# mount /dev/sda 
anaconda-ks.cfg       .esd_auth             模板/
.bash_history         .ICEauthority         视频/
.bash_logout          initial-setup-ks.cfg  图片/
.bash_profile         .lesshst              文档/
.bashrc               .local/               下载/
.cache/               .tcshrc               音乐/
.config/              .viminfo              桌面/
.cshrc                .Xauthority           
.dbus/                公共/                 
[root@node2 ~]# mount /dev/sda 
anaconda-ks.cfg       .esd_auth             模板/
.bash_history         .ICEauthority         视频/
.bash_logout          initial-setup-ks.cfg  图片/
.bash_profile         .lesshst              文档/
.bashrc               .local/               下载/
.cache/               .tcshrc               音乐/
.config/              .viminfo              桌面/
.cshrc                .Xauthority           
.dbus/                公共/                 
[root@node2 ~]# ls /dev/sda1
ls: 无法访问/dev/sda1: 没有那个文件或目录
[root@node2 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   10G  0 disk 
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
[root@node2 ~]# mount /dev/sda /var/lib/mysql/
mount: /dev/sda 写保护,将以只读方式挂载
mount: 未知的文件系统类型“(null)”
[root@node2 ~]# chown mysql:mysql /var/lib/mysql/
[root@node2 ~]# systemctl start mysql
Failed to start mysql.service: Unit not found.
[root@node2 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@node2 ~]# ls /var/lib/mysql/
[root@node2 ~]# systemctl restart mysqd
Failed to restart mysqd.service: Unit not found.
[root@node2 ~]# systemctl restart mysqld
Failed to restart mysqld.service: Unit not found.
[root@node2 ~]# systemctl restart mysql
Failed to restart mysql.service: Unit not found.
[root@node2 ~]# which mysql
/usr/bin/mysql
[root@node2 ~]# systemctl start mariadb
[root@node2 ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server


Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.


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


MariaDB [(none)]> 


[root@node2 ~]# systemctl stop mariadb
[root@node2 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   10G  0 disk 
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
(reverse-i-search)`': ^C
[root@node2 ~]# systemctl stop iscsi
[root@node2 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   10G  0 disk 
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
[root@node2 ~]# systemctl start iscsi
[root@node2 ~]# systemctl start iscsi
[root@node2 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   10G  0 disk 
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
[root@node2 ~]# par
parec      parecord   parted     partprobe  partx      
[root@node2 ~]# parted /dev/sda
GNU Parted 3.1
使用 /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mk                                                               
mklabel  mkpart   mktable  
(parted) mklabel gpt
(parted) mkpart primary 1M 100%
(parted) print                                                            
Model: LIO-ORG formysql (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 


Number  Start   End     Size    File system  Name     标志
 1      1049kB  10.7GB  10.7GB               primary


(parted) exit                                                             
  align-check TYPE N                        check partition N for TYPE(min|opt) alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found partitions, or a particular partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright information of GNU Parted
(parted) quit                                                             
信息: You may need to update /etc/fstab.


[root@node2 ~]# lsblk                                           
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   10G  0 disk 
└─sda1          8:1    0   10G  0 part 
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
[root@node2 ~]# mount /dev/sda1 /var/lib/mysql/
mount: /dev/sda1 写保护,将以只读方式挂载
mount: 未知的文件系统类型“(null)”
[root@node2 ~]# mkf
mkfifo       mkfs         mkfs.ext2    mkfs.fat     mkfs.vfat    
mkfontdir    mkfs.btrfs   mkfs.ext3    mkfs.minix   mkfs.xfs     
mkfontscale  mkfs.cramfs  mkfs.ext4    mkfs.msdos   
[root@node2 ~]# mkfs
mkfs         mkfs.cramfs  mkfs.ext3    mkfs.fat     mkfs.msdos   mkfs.xfs
mkfs.btrfs   mkfs.ext2    mkfs.ext4    mkfs.minix   mkfs.vfat    
[root@node2 ~]# mkfs.ext4 /dev/sda1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620672 blocks
131033 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2151677952
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632


Allocating group tables: 完成                            
正在写入inode表: 完成                            
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成 


[root@node2 ~]# mount /dev/sda1 /var/lib/mysql/
[root@node2 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   10G  0 disk 
└─sda1          8:1    0   10G  0 part /var/lib/mysql
sr0            11:0    1 1024M  0 rom  
vda           252:0    0   20G  0 disk 
├─vda1        252:1    0    1G  0 part /boot
└─vda2        252:2    0   19G  0 part 
  ├─rhel-root 253:0    0   17G  0 lvm  /
  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
[root@node2 ~]# df -h
文件系统               容量  已用  可用 已用% 挂载点
/dev/mapper/rhel-root   17G  3.3G   14G   20% /
devtmpfs               481M     0  481M    0% /dev
tmpfs                  497M     0  497M    0% /dev/shm
tmpfs                  497M  7.1M  490M    2% /run
tmpfs                  497M     0  497M    0% /sys/fs/cgroup
/dev/vda1             1014M  161M  854M   16% /boot
tmpfs                  100M     0  100M    0% /run/user/0
/dev/sda1              9.8G   37M  9.2G    1% /var/lib/mysql
[root@node2 ~]# 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐于技术分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值