当前位置: 首页 > news >正文

Linux运维笔记-云服务器数据盘挂载

1.查看要挂载的空间

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# fdisk -l
 2 
 3 Disk /dev/vda: 42.9 GB, 42949672960 bytes
 4 255 heads, 63 sectors/track, 5221 cylinders
 5 Units = cylinders of 16065 * 512 = 8225280 bytes
 6 Sector size (logical/physical): 512 bytes / 512 bytes
 7 I/O size (minimum/optimal): 512 bytes / 512 bytes
 8 Disk identifier: 0x00053156
 9 
10    Device Boot      Start         End      Blocks   Id  System
11 /dev/vda1   *           1        5222    41942016   83  Linux
12 
13 Disk /dev/vdb: 107.4 GB, 107374182400 bytes
14 16 heads, 63 sectors/track, 208050 cylinders
15 Units = cylinders of 1008 * 512 = 516096 bytes
16 Sector size (logical/physical): 512 bytes / 512 bytes
17 I/O size (minimum/optimal): 512 bytes / 512 bytes
18 Disk identifier: 0x00000000

 

2.添加分区

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# fdisk /dev/vdb 
 2 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
 3 Building a new DOS disklabel with disk identifier 0x65cce73f.
 4 Changes will remain in memory only, until you decide to write them.
 5 After that, of course, the previous content won't be recoverable.
 6 
 7 Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 8 
 9 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
10          switch off the mode (command 'c') and change display units to
11          sectors (command 'u').
12 
13 Command (m for help): n
14 Command action
15    e   extended
16    p   primary partition (1-4)
17 1
18 Invalid partition number for type `1'
19 Command action
20    e   extended
21    p   primary partition (1-4)
22 p
23 Partition number (1-4): 1
24 First cylinder (1-208050, default 1): 
25 Using default value 1
26 Last cylinder, +cylinders or +size{K,M,G} (1-208050, default 208050): 
27 Using default value 208050
28 
29 Command (m for help): wq
30 The partition table has been altered!
31 
32 Calling ioctl() to re-read partition table.
33 Syncing disks.

fdisk 对应分区 相继输入 n, p, 1,  wq

3.查看当前分区情况

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# fdisk -l
 2 
 3 Disk /dev/vda: 42.9 GB, 42949672960 bytes
 4 255 heads, 63 sectors/track, 5221 cylinders
 5 Units = cylinders of 16065 * 512 = 8225280 bytes
 6 Sector size (logical/physical): 512 bytes / 512 bytes
 7 I/O size (minimum/optimal): 512 bytes / 512 bytes
 8 Disk identifier: 0x00053156
 9 
10    Device Boot      Start         End      Blocks   Id  System
11 /dev/vda1   *           1        5222    41942016   83  Linux
12 
13 Disk /dev/vdb: 107.4 GB, 107374182400 bytes
14 16 heads, 63 sectors/track, 208050 cylinders
15 Units = cylinders of 1008 * 512 = 516096 bytes
16 Sector size (logical/physical): 512 bytes / 512 bytes
17 I/O size (minimum/optimal): 512 bytes / 512 bytes
18 Disk identifier: 0x65cce73f
19 
20    Device Boot      Start         End      Blocks   Id  System
21 /dev/vdb1               1      208050   104857168+  83  Linux

 

4.格式化分区

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# mkfs.ext3 /dev/vdb1 
 2 mke2fs 1.41.12 (17-May-2010)
 3 Filesystem label=
 4 OS type: Linux
 5 Block size=4096 (log=2)
 6 Fragment size=4096 (log=2)
 7 Stride=0 blocks, Stripe width=0 blocks
 8 6553600 inodes, 26214292 blocks
 9 1310714 blocks (5.00%) reserved for the super user
10 First data block=0
11 Maximum filesystem blocks=4294967296
12 800 block groups
13 32768 blocks per group, 32768 fragments per group
14 8192 inodes per group
15 Superblock backups stored on blocks: 
16     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
17     4096000, 7962624, 11239424, 20480000, 23887872
18 
19 Writing inode tables: done                            
20 Creating journal (32768 blocks): done
21 Writing superblocks and filesystem accounting information: done
22 
23 This filesystem will be automatically checked every 31 mounts or
24 180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

5.挂载硬盘

 1 #创建要挂载的目录
 2 mkdir /data
 3 
 4 #挂载分区
 5 mount /dev/vdb1 /data/
 6 
 7 #写入分区信息
 8 echo "/dev/vdb1  /data ext3    defaults    0  0" >> /etc/fstab
 9 
10 #查看分许信息
11 cat /etc/fstab

 

转载于:https://www.cnblogs.com/coder-ct/p/6483622.html

相关文章:

  • 大端模式与小端模式、网络字节顺序与主机字节顺序
  • Azure实践系列 2:Azure AD中的用户管理
  • 数据类型和逻辑运算符的一点整理
  • java Stack类 Vector类
  • 事件绑定的几种常见方式
  • Connection Quality Indicator-Citrix VDA连接质量诊断工具
  • spark 02 操作算子
  • 轻松使用二进制安装Mysql5.6
  • rman RMAN-06059: expected archived log not found
  • Window下JDK、Tomcat、eclipse安装与配置
  • Remove Untagged Images From Docker
  • Error creating bean with name 'adminUserController': Injection of autowired dependencies failed;
  • [技术选型] spring boot
  • 学习JavaScript数据结构与算法 — 树
  • shell第一列相同即判断为重复,只取其中一条数据
  • __proto__ 和 prototype的关系
  • Android Studio:GIT提交项目到远程仓库
  • android图片蒙层
  • flutter的key在widget list的作用以及必要性
  • gops —— Go 程序诊断分析工具
  • js
  • js中forEach回调同异步问题
  • python docx文档转html页面
  • springboot_database项目介绍
  • Travix是如何部署应用程序到Kubernetes上的
  • V4L2视频输入框架概述
  • vue+element后台管理系统,从后端获取路由表,并正常渲染
  • Vultr 教程目录
  • web标准化(下)
  • 从零开始学习部署
  • 基于 Babel 的 npm 包最小化设置
  • 前端每日实战:61# 视频演示如何用纯 CSS 创作一只咖啡壶
  • 深入体验bash on windows,在windows上搭建原生的linux开发环境,酷!
  • 使用Gradle第一次构建Java程序
  • 突破自己的技术思维
  • 关于Android全面屏虚拟导航栏的适配总结
  • 如何在招聘中考核.NET架构师
  • ​什么是bug?bug的源头在哪里?
  • (MATLAB)第五章-矩阵运算
  • (二)丶RabbitMQ的六大核心
  • (附源码)ssm高校社团管理系统 毕业设计 234162
  • (三分钟)速览传统边缘检测算子
  • (四) 虚拟摄像头vivi体验
  • (一)kafka实战——kafka源码编译启动
  • (源码版)2024美国大学生数学建模E题财产保险的可持续模型详解思路+具体代码季节性时序预测SARIMA天气预测建模
  • (转)Spring4.2.5+Hibernate4.3.11+Struts1.3.8集成方案一
  • .Net CoreRabbitMQ消息存储可靠机制
  • .net wcf memory gates checking failed
  • .net 无限分类
  • .netcore 如何获取系统中所有session_如何把百度推广中获取的线索(基木鱼,电话,百度商桥等)同步到企业微信或者企业CRM等企业营销系统中...
  • .net反编译的九款神器
  • .NET中使用Protobuffer 实现序列化和反序列化
  • /var/lib/dpkg/lock 锁定问题
  • /使用匿名内部类来复写Handler当中的handlerMessage()方法
  • @property @synthesize @dynamic 及相关属性作用探究