如何新增加磁盘分区挂载

新增磁盘和分区挂载我们先要了解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 20:07
下一篇 2018-03-26 20:08

相关推荐

  • 网卡名称更改

    网卡是计算机进行网络通信的必须的设备。在CentOS6及其更早的系统中,网卡设备在系统中的名称命名为eth#(#为0,1,2…之类的数字)。在内核版本为3.0.0及其以后的Linux发行版中,网卡设备在系统中名称变得很长,变得不好识别以及不利于管理。为了更好的管理,我们将新的网络设备命名改为传统的命名。 网卡名称更改 在CentOS系统中操作 在RHEL7系…

    Linux干货 2016-11-23
  • 高级文件系统之逻辑卷和btrfs文件系统

    逻辑卷管理器快照 逻辑卷可以实现对分区的动态的扩展,快照可以看成是特殊的逻辑卷,它是在生成快照是存在的逻辑卷的准确拷贝。 快照只有在它们和原来的逻辑卷不同时才会消耗空间:     在生成快照时会分配给他一定的空间,但只有在原来的逻辑卷或者快照有所改变时才会使用这些空间     当…

    Linux干货 2016-09-02
  • N21沉舟17周作业

    1、结合图形描述LVS的工作原理; NAT模型 NAT模型其实就是通过网络地址转换来实现负载均衡的,它的工作方式几乎跟iptables 中的DNAT一模一样的,NAT模型的工作方式: 1.用户请求VIP(也就是是CIP请求VIP) 2,Director Server 收到用户的请求后,发现源地址为CIP请求的目标地址为VIP,那么Dorector Serve…

    Linux干货 2016-11-14
  • 关于大型网站技术演进的思考(十)–网站静态化处理—动静整合方案(2)

    原文出处: 夏天的森林    上篇文章我简要的介绍了下网站静态化的演进过程,有朋友可能认为这些知识有点过于稀松平常了,而且网站静态化的技术基点也不是那么高深和难以理解,因此它和时下日新月异的web前端技术相比,就显得不伦不类了。其实当我打算写本系列的之前我个人觉得web前端有一个点是很多人都知道重要,但是有常常低估它作用的,那就…

    2015-03-11
  • 第五周小练习

    1显示当前系统上root,fedora或user1用户的默认shell egrep "^(root|user1|fedora)" /etc/passwd|cut -d ':' -f 1,7 2找出/etc/rc.d/init.d/functions文件中某个单…

    Linux干货 2016-12-12
  • 谷歌三大核心技术(一)The Google File System中文版

    摘要 我们设计并实现了Google GFS文件系统,一个面向大规模数据密集型应用的、可伸缩的分布式文件系统。GFS虽然运行在廉价的普遍硬件设备上,但是它依然了提供灾难冗余的能力,为大量客户机提供了高性能的服务。 虽然GFS的设计目标与许多传统的分布式文件系统有很多相同之处,但是,我们的设计还是以我们对自己的应用的负载情况和技术环境的分析为基础的,不管现在还是…

    Linux干货 2015-04-13

评论列表(1条)

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

    哇塞膜拜膜拜