【Linux】分区与格式化
来源:互联网 发布:软件开发 模型 编辑:程序博客网 时间:2024/05/29 14:56
Linux分区主要是使用fdisk,格式化使用mkfs。
查看所有磁盘和分区: fdisk -l
操作某个磁盘
进入某个磁盘操作模式: fdisk /dev/sdb
输入m会出现命令类表,简洁而强大
Command (m for help): m
Command action
输入p查看当前sd卡的分区(partition)信息
Command (m for help): p
Disk /dev/sdb: 7948 MB, 7948206080bytes
245 heads, 62 sectors/track, 1021cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512bytes
Sector size (logical/physical): 512bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes /512 bytes
Disk identifier: 0x00000000
DeviceBoot
/dev/sdb1
/dev/sdb2
其中,需要记住的是他的容量7948206080 bytes之后会用到。
同时也留意他的heads和setcors/track
删除分区
输入d删除(delete)所有sd卡分区。因为有2个分区,需要删除2次
Command (m for help): d
Partition number (1-4): 1
Command (m for help): d
Selected partition 2
建立扇区
如果SD卡不是255 heads, 63sectors/track,按照以下步骤建立扇区
输入x进入扩展命令列表
Command (m for help): x
Expert command (m for help):
输入n显示扩展命令列表
Command action
输入h设置heads = 255
Expert command (m for help): h
Number of heads (1-256, default 245):255
输入s设置sectors/track = 63
Expert command (m for help): s
Number of sectors (1-63, default 62):63
输入c设置cylinder = 966
Expert command (m for help): c
Number of cylinders (1-1048576, default1021): 966
cylinder计算方法
cylinder = SD卡容量(bytes) / heads /sectors / 512(bytes)
cylinder = 7948206080 / 255 /63 / 512 =966.3 = 966
输入r返回(return)普通命令
Expert command (m for help): r
Command (m for help):
输入p再次查看当前sd卡的分区信息。
此时你会看到heads, sectors/track,cylinder都已经更新了
Command (m for help): p
Disk /dev/sdb: 7948 MB, 7948206080bytes
255 heads, 63 sectors/track, 966cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512bytes
Sector size (logical/physical): 512bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes /512 bytes
Disk identifier: 0x00000000
DeviceBoot
建立分区
输入n新建(new)一个分区
输入p选择新建一个主分区
输入1创建分区1
输入分区1的‘First sector’和‘Last sector’
Command (m for help): n
Partition type:
Select (default p): p
Partition number (1-4, default 1):1
First sector (2048-15523839, default2048): 2048
Last sector, +sectors or +size{K,M,G}(2048-15523839, default 15523839):
Using default value 15523839
输入t改变分区系统ID,
一般windows的用,则输入分区类型码cFAT32,
而linux的为默认的分区类型码83EXT3
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c(W95 FAT32 (LBA))
输入a激活分区的bootable标志
Command (m for help): a
Partition number (1-4): 1
输入w将建立完成对分区表写入sd卡,并退出
Command (m for help): w
The partition table has beenaltered!
Calling ioctl() to re-read partitiontable.
WARNING: If you have created ormodified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
格式化分区
windows的分区格式化命令(其中LABEL为卷标)
sudo mkfs.msdos -F32 /dev/sdb1 -nLABEl1
linux的分区格式化命令
sudo mkfs.ext3 /dev/sdb2 -L LABEL2
完成
需要注意的是,有时需要在Windows再次格式化第一个引导分区LABEL1才能成功引导Linux。(不要使用快速格式化)
- Linux-分区与格式化
- 【Linux】分区与格式化
- Linux分区与格式化
- Linux格式化分区与挂载分区
- linux分区与格式化(ubuntu)
- Linux——系统分区之分区与格式化
- Linux分区格式化
- linux分区,格式化
- linux硬盘 格式化 分区
- Linux 硬盘,格式化,分区。
- Linux分区格式化
- Linux 硬盘,格式化,分区
- Linux分区、格式化、挂载
- Linux分区格式化
- Linux.分区、格式化、挂载
- Linux 分区和格式化
- Ubuntu 分区与格式化
- 系统分区与格式化
- 冒泡排序
- 【Linux】Xserver的粗解
- 二级路由器设置教程
- share sdk WeChat unionid
- 【Linux】dd命令操作磁盘与镜像
- 【Linux】分区与格式化
- 【Debian】服务的建立与删除
- Opencv学习之--进度条控制视频
- 【Jsp】Ajax提交数据不刷新页面
- 读取文件夹里的图片,能够显示出图片的文件名和个数(不仅是图片,还可以是其他文件)
- 【MySql】异常:The server time zone value 'EDT' is
- 【2017/4/14】oracle10g的密码文件管理
- 【Linux】abobe flash player 安装
- 【Git】GitLab安装与配置