rk3568 nvme硬盘分区,格式化,挂载测试
前言
环境介绍:
1.编译环境
Ubuntu 18.04.5 LTS
2.SDK
rk356x_linux
3.单板
迅为itop-3568开发板 + 自制底板
一、查看硬盘
插上硬盘上电,进入系统后通过命令lspci查看nvme硬盘识别情况
[root@RK356X:/]# lspci -k21:00.0 Class 0108: 1e4b:1202 nvme20:00.0 Class 0604: 1d87:3566 pcieport[root@RK356X:/]#可以看到能正常识别到nvme设备
21:00.0 Class 0108: 1e4b:1202 nvme
二、查看分区
在/dev下面查看硬盘分区情况
[root@RK356X:/]# ls /dev/nvme0nvme0 nvme0n1可以看到nvme硬盘已经分好一个区了nvme0n1
要是还想分区可以通过fdisk进行分区。
[root@RK356X:/]# fdisk /dev/nvme0n1Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT disklabel Building a new DOS disklabel. Changes will remaininmemory only,untilyou decide towritethem. After that the previous content won't be recoverable. The number of cylinders for this disk is set to 488386. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) 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 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 partition's systemidu change display/entryunitsvverify the partition table wwritetable to disk andexitx extra functionality(experts only)这里制作测试,一个区够用,不再进行分区。
分好区后可以通过fdisk -l查看分区情况
[root@RK356X:/]# fdisk -lFound valid GPT with protective MBR;using GPT Disk /dev/mmcblk0:30547968sectors, 2628M Logical sector size:512Disk identifier(GUID): f4420000-0000-426c-8000-368900004ad5 Partition table holds up to128entries First usable sector is34, last usable sector is30547934Number Start(sector)End(sector)Size Name116384245754096K uboot224576327674096K misc33276816383964.0M boot416384029491164.0M recovery529491236044732.0M backup63604482552627112.0G rootfs72552627225919487192M oem825919488305479032259M userdata Disk /dev/nvme0n1:477GB,512110190592bytes,1000215216sectors488386cylinders,64heads,32sectors/track Units: sectors of1*512=512bytes Disk /dev/nvme0n1 doesn't contain a valid partition table[root@RK356X:/]#这是识别到的nvme盘信息,就一个分区。
Disk /dev/nvme0n1: 477 GB, 512110190592 bytes, 1000215216 sectors
488386 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes
三、格式化
硬盘分好区后,要格式化才能正常挂载
系统自带了格式化工具mkfs.ext4,可以直接使用。
[root@RK356X:/]# mkfs.ext4 /dev/nvme0n1mke2fs1.46.5(30-Dec-2021)/dev/nvme0n1 contains a ext4filesystem last mounted on Thu Jan108:15:211970Proceed anyway?(y,N)y Discarding device blocks:doneCreating filesystem with1250269024k blocks and31260672inodes Filesystem UUID: 19d88471-cbb2-4cc6-a39f-f5d0c776607e Superblock backups stored on blocks:32768,98304,163840,229376,294912,819200,884736,1605632,2654208,4096000,7962624,11239424,20480000,23887872,71663616,78675968,102400000Allocating group tables:doneWriting inode tables:doneCreating journal(262144blocks):doneWriting superblocks and filesystem accounting information:done[root@RK356X:/]#四、 挂载
直接mount就行
[root@RK356X:/]# mount /dev/nvme0n1 /mnt[4152.556192]EXT4-fs(nvme0n1): mounted filesystem with ordered data mode. Opts[root@RK356X:/]# : (null)[root@RK356X:/]# ls /mnt/lost+found[root@RK356X:/]#查看系统挂载情况
[root@RK356X:/]# df -THFilesystem Type Size Used Avail Use% Mounted on /dev/root ext4 13G 844M 12G7% / devtmpfs devtmpfs1.1G01.1G0% /dev tmpfs tmpfs1.1G01.1G0% /dev/shm tmpfs tmpfs1.1G 263k1.1G1% /tmp tmpfs tmpfs1.1G 300k1.1G1% /run /dev/mmcblk0p7 ext2 193M 13M 170M7% /oem /dev/mmcblk0p8 ext22.4G 26k2.4G1% /userdata /dev/nvme0n1 ext4 503G 29k 478G1% /mnt[root@RK356X:/]#五、速度测试
10G 写入测试
time-pbash-c"dd if=/dev/zero of=/mnt/dd.log bs=1M count=10240"