re-scan new disks without restarting CentOS

  • re-scan new disks(/dev/sdc):
#ls /sys/class/scsi_host/
host0 host1 host2
[root@db210_13:56:14 /data]
#echo "- - -" > /sys/class/scsi_host/host0/scan
[root@db210_13:57:57 /data]
#echo "- - -" > /sys/class/scsi_host/host1/scan
[root@db210_13:57:57 /data]
#echo "- - -" > /sys/class/scsi_host/host2/scan
[root@db210_13:57:58 /data]
#fdisk -l Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 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: 0x00084df7 Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 5222399 2098176 82 Linux swap / Solaris
/dev/sda3 5222400 86259711 40518656 83 Linux
/dev/sda4 86259712 125829119 19784704 5 Extended
/dev/sda5 86261760 125829119 19783680 83 Linux Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 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: 0x0e9c0acb Device Boot Start End Blocks Id System
/dev/sdb1 2048 419430399 209714176 83 Linux **Disk /dev/sdc: 536.9 GB**, 536870912000 bytes, 1048576000 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
  • format disk
[root@db210_12:15:04 /backup]
#fdisk /dev/sdc
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 0xb4f30c82. 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-1048575999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1048575999, default 1048575999):
Using default value 1048575999
Partition 1 of type Linux and of size 500 GiB is set Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
  • Create PV & VG& LV
[root@db210_12:15:23 /backup]
#pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created.
[root@db210_12:15:47 /backup]
#pvs
PV VG Fmt Attr PSize PFree
/dev/sdc1 lvm2 --- <500.00g <500.00g
#vgcreate MySQL /dev/sdc1
Volume group "MySQL" successfully created
#vgs
VG #PV #LV #SN Attr VSize VFree
MySQL 1 0 0 wz--n- <500.00g <500.00g
#lvcreate -L499G MySQL
Logical volume "lvol0" created.
  • Format LV and Mount the LV
[root@db210_12:21:52 /backup]
#mkfs.xfs /dev/MySQL/lvol0
meta-data=/dev/MySQL/lvol0 isize=256 agcount=4, agsize=32702464 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=130809856, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=63872, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0 #mkdir /data2
[root@db210_12:24:39 /backup]
#mount /dev/MySQL/lvol0 /data2
[root@db210_12:25:18 /data]
#mv * /data2/
  • show the mounted disk .
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 39G 12G 28G 30% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 8.6M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda5 19G 33M 19G 1% /home
/dev/sdb1 200G 33M 200G 1% /data
/dev/sda1 497M 119M 379M 24% /boot
tmpfs 783M 0 783M 0% /run/user/0
/dev/mapper/MySQL-lvol0 499G 44G 456G 9% /data2
  • To make the mount persistent across reboots
vi /etc/fstab
**********************************************************
# /etc/fstab
# Created by anaconda on Sat Jun 30 21:49:24 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=4e617a1c-dcd5-4891-b649-a096e15371d9 / xfs defaults 0 0
UUID=202e21ef-c8f9-44b2-8fd0-e9dee6be5df8 /boot xfs defaults 0 0
UUID=f249e917-5db3-40e4-8738-c7c17077e8d5 /home xfs defaults 0 0
UUID=738f0097-2ef4-42b3-8782-f96fc3eaa95d swap swap defaults 0 0
/dev/mapper/MySQL-lvol0 /data xfs defaults 0 0

最新文章

  1. JAVA动态加载JAR
  2. UML 用例图、顺序图、状态图、类图、包图、协作图、流程图
  3. 如何更高效地定制你的bootstrap
  4. PHP 学习笔记---基本语法
  5. python零碎知识点一
  6. Atitit.加密算法ati Aes的框架设计v2.2
  7. 111. Minimum Depth of Binary Tree
  8. [Java] java中的接口定义
  9. 小心!#define max(a,b) a&gt;b?a:b
  10. js深入研究之无法理解的js类代码,extend扩展
  11. 转:PHP变量作用域(花括号、global、闭包)
  12. KVC和KVO
  13. mybatis 详解(二)------入门实例(基于XML)
  14. 201521123101 《Java程序设计》第11周学习总结
  15. FastDfs上传图片
  16. 编写高性能.NET程序-《Concurrency in .NET》(1)- 为什么要读这本书?
  17. 【CDH学习之二】ClouderaManager安装
  18. Laravel policy 的应用
  19. Qt控件使用汇总
  20. 【python学习-2】python起步必备

热门文章

  1. C# 代码操作XML(增、删、改)
  2. WIN7系统插入蓝牙适配器经常断开问题
  3. [洛谷P3380]【模板】二逼平衡树(树套树)
  4. React获取组件实例
  5. NOIP2016Day2T2蚯蚓(队列+坑爹洛谷毁我青春)
  6. supervisor安装、配置和运行
  7. DOM学习控件定位和案例
  8. Codeforces Round #202 (Div. 2) B,C,D,E
  9. FreeRTOS - 如何根据FreeRTOS提供的功能(信号量、任务通知、队列等)设计程序
  10. js的数据类型--字符串