关于 Linux下硬盘分区的操作步骤分享
Admin 2021-03-15 群英行业资讯
要掌握Linux硬盘的分区,就要知道MBR、扩展分区和逻辑分区的概念,今天小编就给大家介绍下Linux硬盘分区的详细步骤,有兴趣的朋友不妨来了解下吧。
1、查看硬盘大小,并分区。
[root@colud ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x000c16ac
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 1306 9971712 8e Linux LVM
Disk /dev/sdb: 59.1 GB, 59055800320 bytes
255 heads, 63 sectors/track, 7179 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: 0xda4662fa
Device Boot Start End Blocks Id System
2、对空白盘分区
使用fdisk命令管理/dev/sdb,进去以后输入“n”执行增加分区,选择“P”创建主分区,填写分区编号,选择分区大小First cylinder起始柱面默认即可,然后写上去分区想分多大,可以使用+100M,10G,20G等直接写明需要多大的分区,Last cylinder如果也用默认即是整个磁盘分一个分区,最后使用“w”保存下分区即可。命令操作如下所示,当有多块磁盘时按照步骤重复分区就可以了:
[root@colud ~]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-7179, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-7179, default 7179): +20G
Command (m for help): p
Disk /dev/sdb: 59.1 GB, 59055800320 bytes
255 heads, 63 sectors/track, 7179 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: 0xda4662fa
Device Boot Start End Blocks Id System
/dev/sdb1 1 2612 20980858+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
常见的分区格式有ext2、ext3、ext4、xfs等格式,此处可以使用ext4格式来对分区进行格式化,需要其他格式的根据你的实际情况决定就可以。
命令为:mkfs.ext4 /dev/sdb1 ,此处的sdb1是刚分出来的新分区。
[root@colud ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1313760 inodes, 5245214 blocks
262260 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=0
161 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
对分区挂载步骤如下:
创建挂载点:mkdir /data
手动挂载分区:moutn /dev/sdb1 /data
将挂载信息写入分区表,方便系统启动自动挂载:
vi /etc/fstab 然后在最后一行写入挂载信息:
/dev/sdb1 /data ext4 defaults 0 0
上面就是Linux硬盘分区的详细步骤介绍了,Linux系统在进行硬盘分区的时候有几个地方需要特别注意,按照本文介绍的步骤操作。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
云计算和虚拟化技术的快速发展,云计算和大数据逐渐成为大家讨论的话题,云计算分为公有云和私有云等,公有云就是我们常说的云服务器或者云主机,许多刚入行的站长对私有云不清楚,接下来小编来谈谈什么是私有云以及私有云的优势。
企业上云,现在已是大势所趋,冠状病毒疫情更像是催化剂将此任务转变为紧急任务。云上企业和落后者之间的距离在一夜之间扩大到成为了鸿沟。很多企业已经意识到,云计算是实现可扩展运营、具有成本效益的基础设施和竞争优势的门票,并且可以通过超扩展服务访问最新、最出色的数字技术。
云计算作为互联网时代最火热的技术之一,对于各行各业的发展来说都有独特的意义,互联网在不断发展,而云计算也一样。而云计算的发展也会直接影响行业的发展趋势,那么,云计算发展对哪些行业影响比较大?云计算发展对行业的影响都有哪些?
新加坡云服务器哪一家最好这个问题,大家都必须好好开展掌握,终究这类服务器大家使用的情况下都必须很多的時间,因此要是没有选择好得话,很有可能会在未来的一段时间都给自己提供不便,而在这个层面而言群英网络显而易见是现阶段销售市场之中用户评价不错,人气值也较高的一个品牌,往往它家的新加坡云服务器这般获得好评,主要是拥有那样的好多个层面的缘故。
很多人在面对轻量云服务器与云服务器ecs的时候总是分不清楚两者之间的差异,都会认为这是一个差不多的东西。其实不然,轻量云服务器和云服务器ecs是两种不同的产品,那么我们该怎么区分?轻量云服务器与云服务器ecs的不同之处在哪里呢?