【LINUX学习】磁盘分割之新建与删除
2023-09-14 08:57:16 时间
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 522 4088542+ 83 Linux
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesnt contain a valid partition table
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 131 1052226 82 Linux swap / Solaris
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
---也可以指定设备,
[root@localhost /]# fdisk -l /dev/sdc
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 131 1052226 82 Linux swap / Solaris
[root@localhost /]# fdisk -l /dev/sda
Disk /dev/sda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 522 4088542+ 83 Linux
---创建一个主分区,如果使用默认值,会在建立第一个分区时就将整个磁盘使用完。
[root@localhost /]# fdisk /dev/sdd
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-391, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): =直接按enter键默认391
Using default value 391
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 391 3140676 83 Linux
Command (m for help): n --继续添加
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 2
No free sectors available---没有可用空间了!
--删除刚才建立的那个分区。
Command (m for help): d
Selected partition 1
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
--新建分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): +50M
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 2
First cylinder (8-391, default 8):
Using default value 8
Last cylinder or +size or +sizeM or +sizeK (8-391, default 391): +2^H
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 3
First cylinder (11-391, default 11):
Using default value 11
Last cylinder or +size or +sizeM or +sizeK (11-391, default 391):
Using default value 391
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
/dev/sdd3 11 391 3060382+ 83 Linux
--删除第三个分区
Command (m for help): d
Partition number (1-4): 3
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 7 56196 83 Linux
/dev/sdd2 8 10 24097+ 83 Linux
--删除第二个分区
Command (m for help): d
Partition number (1-4): 2
Command (m for help):m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition 删除一个分区
l list known partition types
m print this menu
n add a new partition 新增一个分区
o create a new empty DOS partition table
p print the partition table
q quit without saving changes 不保存,离开
s create a new empty Sun disklabel
t change a partitions system id
u change display/entry units
v verify the partition table
w write table to disk and exit 写入并保存
x extra functionality (experts only)
Command (m for help): d
Selected partition 1 --只有一个分区,系统帮我们选择
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): q
[root@localhost /]#
相关文章
- Linux 学习 step by step (2)
- 【LINUX学习】例行命令的建立
- Linux进程间通信(二):信号集函数 sigemptyset()、sigprocmask()、sigpending()、sigsuspend()
- Linux学习之CentOS(十三)--CentOS6.4下Mysql数据库的安装与配置
- linux文件完整性监控(FIM)
- 【刷题】面筋-Linux-创建多级目录命令mkdir -p
- Linux - 查看文件信息的三个命令
- linux软件的安装和卸载
- Linux c基础学习
- linux学习之VNC远程控制(二)
- Linux系统与windows系统文件同步
- EasyRTMP实现的一套简单、高效、易用的全平台(Windows/Linux/ARM/Android/iOS)RTMP直播推送库
- linux(ubuntu) 安装 node.js
- linux(ubuntu20.10):用apt方式安装php7.4.9
- golang执行Linux shell命令完整场景下的使用方法
- Linux parted分区工具使用示例
- Linux学习笔记-文件处理和权限命令
- 【Linux 内核 内存管理】虚拟地址空间布局架构 ④ ( 内存描述符 mm_struct 结构体成员分析 | hiwater_rss | start_code | start_brk )
- 学习笔记 | Linux系列教程之文本三剑客 - awk、grep、sed从入门到实战
- 查看 kali linux 系统版本
- Linux的top命令学习【转载】
- linux达人养成计划学习笔记(五)—— 关机和重启命令
- 【Deepin 20 Beta系统】Linux系统安装Matlab R2019b详解
- 【黑马程序员新版Linux学习笔记】(二)Linux用户和权限 —— 操作演示