Linux 创建磁盘 以及磁盘分区管理

查看磁盘信息

[root@ZZSRV2 ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000af460

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1026047      512000   83  Linux

/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

Disk /dev/mapper/centos_zzsrv1-swap: 2181 MB, 2181038080 bytes, 4259840 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_zzsrv1-root: 40.2 GB, 40240152576 bytes, 78594048 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@ZZSRV2 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan

[root@ZZSRV2 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan

[root@ZZSRV2 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan

[root@ZZSRV2 ~]# fdisk -l 再次查看磁盘信息,最下面就会看到新加的磁盘sdb

Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x000af460

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1026047      512000   83  Linux

/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

Disk /dev/mapper/centos_zzsrv1-swap: 2181 MB, 2181038080 bytes, 4259840 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_zzsrv1-root: 40.2 GB, 40240152576 bytes, 78594048 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/sdb: 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

将磁盘分区(这里是将磁盘分一个区)

[root@ZZSRV2 ~]# 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 0x7d9737a7.

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-41943039, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):  →分区的大小不可以超过磁盘的大小

Using default value 41943039

Partition 1 of type Linux and of size 20 GiB is set

Command (m for help): p

Disk /dev/sdb: 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: 0x7d9737a7

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    41943039    20970496   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

创建PV

[root@ZZSRV2 ~]# pvscan

PV /dev/sda2   VG centos_zzsrv1   lvm2 [39.51 GiB / 0    free]

Total: 1 [39.51 GiB] / in use: 1 [39.51 GiB] / in no VG: 0 [0   ]

[root@ZZSRV2 ~]# pvcreate /dev/sdb1

Physical volume "/dev/sdb1" successfully created

[root@ZZSRV2 ~]# pvscan

PV /dev/sda2   VG centos_zzsrv1   lvm2 [39.51 GiB / 0    free]

PV /dev/sdb1                      lvm2 [20.00 GiB]

Total: 2 [59.51 GiB] / in use: 1 [39.51 GiB] / in no VG: 1 [20.00 GiB]

创建VG

[root@ZZSRV2 ~]# vgscan

Reading all physical volumes.  This may take a while...

Found volume group "centos_zzsrv1" using metadata type lvm2

[root@ZZSRV2 ~]# vgcreate VG /dev/sdb1

Volume group "VG" successfully created

[root@ZZSRV2 ~]# vgscan

Reading all physical volumes.  This may take a while...

Found volume group "VG" using metadata type lvm2

Found volume group "centos_zzsrv1" using metadata type lvm2

[root@ZZSRV2 ~]# vgdisplay VG

--- Volume group ---

VG Name               VG

System ID

Format                lvm2

Metadata Areas        1

Metadata Sequence No  1

VG Access             read/write

VG Status             resizable

MAX LV                0

Cur LV                0

Open LV               0

Max PV                0

Cur PV                1

Act PV                1

VG Size               20.00 GiB

PE Size               4.00 MiB

Total PE              5119  →记着这个数字

Alloc PE / Size       0 / 0

Free  PE / Size       5119 / 20.00 GiB

VG UUID               qHpcWT-mjRd-xcsT-QBac-XM94-b1H4-P2NQdF

创建一个LV,使用VG的全部PE

[root@ZZSRV2 ~]# lvscan

ACTIVE            '/dev/centos_zzsrv1/swap' [2.03 GiB] inherit

ACTIVE            '/dev/centos_zzsrv1/root' [37.48 GiB] inherit

LV的名称为LV1

[root@ZZSRV2 ~]# lvcreate -n LV1 -l 5119 VG

Logical volume "LV1" created

[root@ZZSRV2 ~]# lvscan

ACTIVE            '/dev/VG/LV1' [20.00 GiB] inherit

ACTIVE            '/dev/centos_zzsrv1/swap' [2.03 GiB] inherit

ACTIVE            '/dev/centos_zzsrv1/root' [37.48 GiB] inherit

[root@ZZSRV2 ~]# lvdisplay /dev/VG/LV1

--- Logical volume ---

LV Path                /dev/VG/LV1

LV Name                LV1

VG Name                VG

LV UUID                2OHuKM-6wyj-7TFr-lJCT-ZfzH-OcKd-f6oLr8

LV Write Access        read/write

LV Creation host, time ZZSRV2.localdomain, 2014-08-20 10:31:10 +0800

LV Status              available

# open                 0

LV Size                20.00 GiB

Current LE             5119

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     8192

Block device           253:2

[root@ZZSRV2 ~]# vgdisplay VG

--- Volume group ---

VG Name               VG

System ID

Format                lvm2

Metadata Areas        1

Metadata Sequence No  2

VG Access             read/write

VG Status             resizable

MAX LV                0

Cur LV                1

Open LV               0

Max PV                0

Cur PV                1

Act PV                1

VG Size               20.00 GiB

PE Size               4.00 MiB

Total PE              5119

Alloc PE / Size       5119 / 20.00 GiB

Free  PE / Size       0 / 0   →注意这儿,已经没有剩余空间,说明全部的空间已经被使用

VG UUID               qHpcWT-mjRd-xcsT-QBac-XM94-b1H4-P2NQdF

linux创建磁盘pv报错,Linux 磁盘管理相关推荐

  1. linux安装多路径报错,Linux操作系统配置多路径通用教程(适用于(RHEL,CentOS,SuSE等)...

    Linux操作系统配置多路径通用教程(适用于(RHEL,CentOS,SuSE等) 猫先生 • 2019 年 06 月 01 日 一,安装软件 1,执行以下命令,检查当前系统中是否已经安装多路径工具: ...

  2. linux 复制硬盘 启动报错,linux挂载硬盘报错(you must specify the filesystem type)

    今天自己的虚拟机磁盘用完成,于是想加一磁盘,当挂载时发现报错you must specify the filesystem type.(注:我的系统环境是lcentos6.3装在virtualbox的 ...

  3. linux线程超过1024报错,Linux定位c++程序运行异常的经历《实操》

    对于c++程序来说,以segment fault为代表的程序异常行为千奇百怪,没有一套比较丰富的工具集去对付他们,在处理实际问题时就会显得捉襟见肘.本文列举几种程序异常的定位方法. 子线程创建不出来 ...

  4. linux安装vnc服务报错,Linux安装vnc server

    操作系统: centos7.6 需求: 安装并配置vnc server 参考: https://blog.csdn.net/absenceoftrace/article/details/5188203 ...

  5. linux重启was控制台报错,Linux非WAS部署,启动报错Cannot run program \lsb_release\

    Linux非WAS部署,启动报错Cannot run program "lsb_release" 已确认 tools.jar 文件是当前 linux 中的 jdk 下的 jar 文 ...

  6. linux安装多路径报错,linux多路径软件rdac安装方法

    RDAC安装方法 首先把rdac的源文件拷贝到服务器上,rdac可以从管理软件SANtricity中的光盘中取得Rdac的安装需要系统装好make,gcc等编译工具,此外还需要安装kernel-dev ...

  7. linux u盘 启动报错,linux U盘启动系统的绘制

    brw-r----- 1 root disk 8, 32 10-16 15:50 /dev/sdc brw-r----- 1 root disk 8, 36 10-16 15:50 /dev/sdc4 ...

  8. linux进入vi编辑报错,Linux Vi编辑器的使用及C编程

    实验3  Vi编辑器的使用及C编程 一.实验要求 (1)掌握Vi的三种运行模式及切换方法: (2)掌握使用Vi的各种操作命令进行文本文件的编辑: (3)用Vi编写Linux下C程序,掌握gcc编译. ...

  9. linux 修改用户密码 报错,linux中修改用户密码报错 passwd:Authentication token manipulation error...

    出现"passwd:Authentication token manipulation error"这种问题需要考虑以下情况: 1.错误出现在输入完新密码后 问题:/etc/pas ...

最新文章

  1. SQL时间相关 - SQL日期,时间比较
  2. java 编写小工具 尝试 学习(四)
  3. Linux 内核网络协议栈 ------sk_buff 结构体 以及 完全解释 (2.6.16)
  4. rocketmq 初探(三)
  5. 大富由天定,小富靠算计!
  6. 企业应该如何选型ERP?
  7. 使用 CSS3 实现 3D 图片滑块效果
  8. lamda表达式修改数据_正则表达式学习教程
  9. 卡尔曼滤波/扩展卡尔曼/粒子滤波算法,dashgo d1与kinect 粒子滤波/EKF扩展卡尔曼滤波融合IMU(heneywell_HG112)+GPS(和芯星通UB482)+stm32室外定位
  10. C#.NET生成条形码(Code39和Code128)
  11. Ruby语言的特别之处
  12. R语言利用openxlsx包输出EXCEL报告
  13. 读《霍乱时期的爱情》第一章有感
  14. 计算机科学学院参加些什么比赛,计算机科学学院召开2019年冬季越野赛动员大会...
  15. linux黑屏无法唤醒,解决笔记本CentOS7合盖后黑屏无法唤醒
  16. vue子元素点击事件与父元素点击事件冲突 子元素点击事件不触发
  17. Python批量压缩图片
  18. IPD-货架技术和CBB
  19. [GKCTF2020]CheckIN详解
  20. 国家信息化计算机教育证书是国家职业资格证书吗

热门文章

  1. Oracle RAC环境下如何定位并杀掉最终阻塞的会话
  2. 实例解析:MySQL性能瓶颈排查定位,实现毫秒级完成180秒的任务
  3. 云图说|将源端MongoDB业务搬迁至华为云DDS的几种方式
  4. C语言内存泄露很严重,如何应对?
  5. 【华为云技术分享】STM32L476移植华为LiteOS系列教程------背景知识 1
  6. 盘点 8 种最坑的 SQL 错误用法
  7. 【华为云技术分享】如何做一个优秀软件-可扩展的架构,良好的编码,可信的过程
  8. 开发者如何学好 MongoDB
  9. 【华为云实战开发】15.Maven依赖的JAR包下载慢?赶紧看过来
  10. 索引体积_MySQL入门之索引