!
也想出现在这里? 联系我们
广告位
当前位置:首页>教程分享>服务器教程>centos6/7使用fdisk扩展分区容量教程

centos6/7使用fdisk扩展分区容量教程

本文档主要对/dev/sdb1这个分区扩展,做任何操作之前都需要提前做好备份保存,这hi是一个习惯,虽然扩展分区大小不会导致数据丢失,但是安全起见,请提前做好备份;
卸载磁盘分区
[root@localhost ~]# umount /dev/sdb1
 centos6/7使用fdisk扩展分区容量教程
若提示磁盘忙,使用fuser找出将正在使用磁盘的程序并结束掉;
1:fuser -m -v /data
2:fuser -m -v -i -k /data
使用fdisk工具先删除/dev/sdb1分区,然后创建新分区,注意开始的磁柱号要和原来的一致(是保证数据不丢失的关键步骤)!结束的磁柱号默认回车使用全部磁盘。
[root@localhost ~]# 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.
 
 
Command (m for help): p  (查看分区表信息)
 
Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 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: 0x7efdf11b
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   104857599    52427776   83  Linux
 
Command (m for help): d  (删除分区,因为我默认只有一个,所以默认删除第一个,如果有多个,可以指定1,2,3..)
Selected partition 1   Partition 1 is deleted
 
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): 1 (和之前的分区好一致
First sector (2048-104857599, default 2048): 2048 (需要和之前的分区的起始磁盘柱号一致,特别重要!!!)
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599):
Using default value 104857599
Partition 1 of type Linux and of size 50 GiB is set
 
Command (m for help): wq (保存退出,如果操作有无可以直接退出不保存)
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
 
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
 
创建分区成功之后重启一下啊;
 
然后检查分区信息:[root@localhost ~]# e2fsck -f /dev/sdb1
 centos6/7使用fdisk扩展分区容量教程
重新挂载、查看分区大小、数据
[root@localhost ~]# mount /dev/sdb1 /data
[root@localhost ~]# df -hal 

给TA打赏
共{{data.count}}人
人已打赏
服务器教程

数据库导入时“#1273 – Unknown collation: ‘utf8mb4_unicode_ci’”解决

2021-4-17 22:00:05

服务器教程

网站打开提示500调试显示错误方法

2021-4-17 22:00:37

声明 本站上的部份代码及教程来源于互联网,仅供网友学习交流,若您喜欢本文可附上原文链接随意转载。无意侵害您的权益,请发送邮件至 [email protected] 或点击右侧 私信:吉吉国王 反馈,我们将尽快处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
OneEase