linux系统硬盘分区笔记.doc
文本预览下载声明
linux系统硬盘分区
[root@localhost ~]# fdisk -l 查看当前磁盘分配
Disk /dev/sda: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System/dev/sda1 * 1 25 200781 83 Linux/dev/sda2 26 793 6168960 83 Linux/dev/sda3 794 924 1052257+ 83 Linux/dev/sda4 925 26105 Extended/dev/sda5 925 1055 1052226 83 Linux/dev/sda6 1056 1186 1052226 82 Linux swap / Solaris/dev/sda7 1187 2610 83 Linux
Disk /dev/sdb: 5368 MB, 5368709120 bytes255 heads, 63 sectors/track, 652 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesnt contain a valid partition table
可以看到sdb 没有使用
# fdisk /dev/sdb#m 菜单
Command (m for help): mCommand 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 注:l是列出分区类型,以供我们设置相应分区的类型;
m print this menu 注:m 是列出帮助信息; n add a new partition 注:添加一个分区; o create a new empty DOS partition table p print the partition table 注:p列出分区表; q quit without saving changes 注:不保存退出; s create a new empty Sun disklabel t change a partitions system id 注:t 改变分区类型; u change display/entry units v verify the partition table w write table to disk and exit 注:把分区表写入硬盘并退出; x extra functionality (experts only) 注:扩展应用,专家功能;
#p 查无分区
Device Boot Start End Blocks Id System
#n 添加#p 扩展为e;主分区为p#1 创建第一块分区#回车 取默认值回车#+1024M 设置第一块分区为 1G
Partition number (1-4): 1First cylinder (1-652, default 1):回车Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-652, default 652): +1024M
#P 查看到 创建了sdb1的分区
Device Boot Start End Blocks Id System/dev/sdb1 63 2008124 1004031 83 Linux
#w 保存
继续分剩下的 4G空间# fdisk /dev/sdb
#P 查看
Device Boot Start End Blocks Id System/dev/sdb1 1 125 1004031 83 Linux
可以看到 从磁柱1开始到磁柱125结束
下次分区要从126开始
#n 添加分区
#p 主分区 primary
#2 创建第二块分区
#回车 看到default为 126 默认值变为从126开始, 直接回车#回车 使用剩下全部空间,直接回车
#p 查看下 sdb1 1-125 sdb2 126-6
显示全部