Linux调整分区大小的方法有很多,介绍一种使用fdisk命令调整分区大小的方法:使用fdisk -l命令查看当前系统的分区情况,例如:
Linux调整分区大小的方法有很多,介绍一种使用fdisk命令调整分区大小的方法:
1. 首先,使用fdisk -l命令查看当前系统的分区情况,例如:
[root@localhost ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
2 heads, 4 sectors/track, 5242880 cylinders, total 41943040 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 identifier: 0x000d4e3c
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 41943039 20458496 8e Linux LVM
2. 然后,使用fdisk /dev/sda命令进入fdisk编辑模式,例如:
[root@localhost ~]# fdisk /dev/sda
Command (m for help):
3. 在fdisk编辑模式中,输入p命令查看当前分区情况,例如:
Command (m for help): p
Disk /dev/sda: 21.5 GB, 21474836480 bytes
2 heads, 4 sectors/track, 5242880 cylinders, total 41943040 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 identifier: 0x000d4e3c
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 41943039 20458496 8e Linux LVM
4. 输入d命令删除要调整的分区,例如:
Command (m for help): d
Partition number (1-4): 2
5. 输入n命令新建分区,并设置分区大小,例如:
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G
6. 输入w命令保存分区信息,例如:
Command (m for help): w
The partition table has been altered!
7. 最后,使用fdisk -l命令查看分区情况,例如:
[root@localhost ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
2 heads, 4 sectors/track, 5242880 cylinders, total 41943040 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
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(53条)