海思机顶盒格式化 TF 卡为 ext4 文件系统

机顶盒1年前 (2024)更新 ypng
35 0 0

1. 查看磁盘分区信息

输入命令:cat /proc/partitions

root@hi3798mv100:~# cat /proc/partitions
major minor  #blocks  name

   1        0       4096 ram0
   1        1       4096 ram1
……
 179       16       2048 mmcblk0boot1
 179        8       2048 mmcblk0boot0
 179       32    7703552 mmcblk1
 179       33    7702528 mmcblk1p1

最后两条 mmcblk1 和 mmcblk1p1 表示我的TF卡的分区信息。

2. 卸载分区

输入命令:umount /mnt/mmcblk1p1

3. 使用fdisk工具对TF重新分区

输入命令:fdisk /dev/mmcblk1
ps:注意后面分区的名字,我之前就是因为这个名字输入错了所以好几次都是原格式,没有格式化成功!

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): o                               # 输入o设置新分区为msdos格式
Created a new DOS disklabel with disk identifier 0x02359008.

Command (m for help): n                               # 输入n建立新分区
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p                                        # 输入p表示新建的为主分区
Partition number (1-4, default 1):                                               
First sector (2048-15407103, default 2048):                              
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15407103, default 15407103): 

Created a new partition 1 of type 'Linux' and of size 7.4 GiB.

Command (m for help): w                               # 输入w保存分区信息
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

4. 执行格式化

输入命令:mkfs.ext4 /dev/mmcblk1p1

root@hi3798mv100:~# mkfs.ext4 /dev/mmcblk1p1
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 1925632 4k blocks and 481440 inodes
Filesystem UUID: f022a57f-4d88-4972-9be7-7b0c1be395ff
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

格式化完成

至此操作就完成了,输入命令:fdisk -l ,看一下格式化是否成功。

root@hi3798mv100:~# fdisk -l
Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk1p1       2048 15407103 15405056  7.4G 83 Linux

显示为 Linux 格式,格式化成功了。
整体步骤和大神的格式化U盘教程是一样的,只是要注意第三步名字的问题。

© 版权声明

相关文章

暂无评论

暂无评论...