如何新增加磁盘分区挂载

新增磁盘和分区挂载我们先要了解fdisk的参数以及菜单的操作说明,下面是fdisk的参数说明:
 fdisk参数说明:
m :显示菜单和帮助信息
a :活动分区标记/引导分区
d :删除分区
l :显示分区类型
n :新建分区
p :显示分区信息
q :退出不保存
t :设置分区号
v :进行分区检查
w :保存修改
x :扩展应用,高级功能
1  查看磁盘分区:
[root@localhost ~]# fdisk -l     
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002faa0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 52 204800 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 52 26109 209304576 83 Linux
Disk /dev/sdb: 21.5 GB, 21474836480 bytes       # (新增加硬盘 未分区)
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
·
2   新增加硬盘分区
root@localhost ~]# fdisk /dev/sdb            #(进到磁盘分区)
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xd4339e72.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
Command (m for help): n            #(输入新加硬盘分区命令n 说明:n为添加磁盘分命令)
Command action          #(e为扩展分区 p主分区)
e extended
p primary partition (1-4)
p
Partition number (1-4): 1        #(输入1 增加第一块磁盘分区表)
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): (默认大小)
Using default value 2610 sectors (command ‘u’).
Command (m for help): w      #(输入w 保存退出)
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3  确认新增加磁盘分区
[root@localhost ~]# fdisk -l      (查看新增加磁盘分区结果)
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002faa0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 52 204800 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 52 26109 209304576 83 Linux
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd4339e72
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 83 Linux             #(成功分区)
4   格式化磁盘
[root@localhost ~]# mkfs.ext4 /dev/sdb1             #(格式化新加磁盘/dev/sdb1 )
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 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, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5   创建磁盘挂载节点
[root@localhost /]# mkdir data
6   挂载磁盘
root@localhost /]# mount /dev/sdb1 data
7   自动挂载
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# vim /etc/fstab
# /etc/fstab
# Created by anaconda on Tue Mar 13 18:59:31 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=85ea0a44-7e35-43e7-bb61-a191f9a89065 / ext4 defaults 1 1
UUID=02777557-2f20-4794-8f83-78bf35b46575 /boot ext4 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdb1 /data
输入reboot关机重启
      注 :以上红色字体为步骤说明  黄色字体为命令   紫色 字体为备注说明。

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/93020

(3)
xiangyangxiangyang
上一篇 2018-03-26
下一篇 2018-03-26

相关推荐

  • keepalived+nginx 模型示例

    原理为: 调度器 利用 keepalived 保持高可用性,实现对系统的监控和VIP 的floating NGINX 利用upstream模块进行调度 关键点: keepalived 对NGINX 状态的监控: //利用配置文件中设定的脚本对调度器的nginx 进程的监控 实验步骤: 基于上一篇LVS-DR架构来做,具体LVS-DR架构请参考上一篇 先设置主…

    2017-05-13
  • centos7上实现corosync V2 + pacemaker + pcs | crmsh备忘录

    1、集群配置的前提: 一、时间同步(ntpdate做crontab定时任务) 二、主机名和IP相互解析 三、基于ssh密钥主机互信 #ssh-keygen -t rsa #ssh-copy-id -i   集群的全生命周期管理工具: pcs: agent(pcsd) crmsh: agentless (pssh)     2、安…

    2017-11-15
  • 什么叫Linux

    什么叫linux:     Linux是一套免费使用和自由传播的类Unix操作系统,它主要用于基于Intel x86系列CPU的计算机上。这个系统是由全世界各地的成千上万的程序员设计和实现的。其目的是建立不受任何商品化软件的版权制约的、全世界都能自由使用的Unix兼容产品。 谁编写的linux: Linux的出现,最早…

    Linux干货 2017-03-27
  • Linux_创建文件系统及挂载文件系统流程详解

    Linux 创建文件系统及挂载文件系统流程详解 摘要:本文对新增硬盘,切割硬盘,创建硬盘分区,为硬盘分区创建文件系统,以及加载文件系统的流程做总结性论述;主要是为初学者弄清楚这一操作过程;本文涉及fdisk、mkfs、mount … … 等工具;对/etc/fstab 进行了解说;还有磁盘扫描工具fsck 等介绍; +++++++++…

    Linux干货 2016-01-18
  • linux中nmcli命令使用及网络配置

      Red Hat Enterprise Linux 7 与 CentOS 7 中默认的网络服务由 NetworkManager 提供,这是动态控制及配置网络的守护进程,它用于保持当前网络设备及连接处于工作状态,同时也支持传统的 ifcfg 类型的配置文件。  NetworkManager 可以用于以下类型的连接:Ethernet,VLA…

    Linux干货 2016-09-10
  • 【招聘福利】深圳/系统运维工程师/薪资弹性,可面谈

    深圳市鑫顺诺科技有限公司 有意向的学员,请联系magedu-小助手QQ:1522609717 职位职能: 系统运维工程师岗位职责:1、公司日常机房网络和办公室网络管理调优、日常办公电脑维护。2、管理、维护网站服务器运行状态,处理系统运行故障;3、负责服务器集群的操作系统安装、升级、定制、部署与维护工作;4、负责服务器集群的系统监控和自动化脚本的设计与部署;5…

    Linux干货 2015-11-06

评论列表(1条)

  • 兜兜
    兜兜 2018-03-26 20:13

    哇塞膜拜膜拜