(相关资料图)
在优盘上新建文件系统(u盘如何新建文件夹)本文基于Ubuntu 18.04系统,在U盘中制作ext4文件系统。在嵌入式调试中,可以从U盘中挂载文件系统。
# 1、查看U盘设备目录root@ubuntu:/home/run/code# ls /dev/sdsda sda1 sdb sdb1 (U盘)# 2、卸载root@ubuntu:/home/run/code# umount /dev/sdb1# 3、格式化为ext4文件系统,并添加卷标‘rootfs’root@ubuntu:/home/run/code# mkfs.ext4 -L rootfs /dev/sdb1mke2fs 1.44.1 (24-Mar-2018)Creating filesystem with 7864059 4k blocks and 1966080 inodesFilesystem UUID: d20aee9e-3ada-4f3e-b806-9bbad7209362Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000Allocating group tables: doneWriting inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information:doneroot@ubuntu:/home/run/code## 4、重新拔插U盘# 5、拷贝已有文件系统映像ubuntu_rootfs.imgroot@ubuntu:/home/run/code# file ubuntu_rootfs.imgubuntu_rootfs.img: Linux rev 1.0 ext4 filesystem data, UUID=faf10ee9-7e64-4826-98cc-239708736642, volume name "rootfs" (extents) (64bit) (large files) (huge files)root@ubuntu:/home/run/code# mkdir testimgroot@ubuntu:/home/run/code# mount ubuntu_rootfs.img testimg/root@ubuntu:/home/run/code# cd testimg/root@ubuntu:/home/run/code/testimg# lsbin boot dev etc home lib lost+found media 电脑 opt proc root run sbin srv sys system tmp usr var vendorroot@ubuntu:/home/run/code/testimg# mount /dev/sdb1 /tmp/root@ubuntu:/home/run/code/testimg# cp -rf * /tmp/# 6、卸载root@ubuntu:/home/run/code/testimg# umount /tmp
如果原有U盘有多个分区,可以使用fdisk命令删除或创建分区,流程如下:
root@ubuntu:/home/run/code# fdisk /dev/sdcWelcome to fdisk (util-linux 2.31.1).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): m ## 1、帮助Help: Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition tableCommand (m for help): p ## 2、显示分区Disk /dev/sdc: 30 GiB, 32212254720 bytes, 62914560 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: gptDisk identifier: 23000000-0000-4C4A-8000-699000005ABBDevice Start End Sectors Size Type/dev/sdc1 16384 24575 8192 4M unknown/dev/sdc2 24576 32767 8192 4M unknown/dev/sdc3 32768 98303 65536 32M unknown/dev/sdc4 98304 163839 65536 32M unknown/dev/sdc5 163840 229375 65536 32M unknown/dev/sdc6 229376 4323327 4093952 2G unknown/dev/sdc7 4323328 62914495 58591168 28G unknownCommand (m for help): d ## 3、删除分区7-1Partition number (1-7, default 7): 7Partition 7 has been deleted.Command (m for help): dPartition number (1-6, default 6):Partition 6 has been deleted.Command (m for help): dPartition number (1-5, default 5):Partition 5 has been deleted.Command (m for help): dPartition number (1-4, default 4):Partition 4 has been deleted.Command (m for help): dPartition number (1-3, default 3):Partition 3 has been deleted.Command (m for help): dPartition number (1,2, default 2): dValue out of range.Partition number (1,2, default 2):Partition 2 has been deleted.Command (m for help): dSelected partition 1Partition 1 has been deleted.Command (m for help): p ## 4、显示分区Disk /dev/sdc: 30 GiB, 32212254720 bytes, 62914560 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: gptDisk identifier: 23000000-0000-4C4A-8000-699000005ABBCommand (m for help): n ## 5、新建分区1Partition number (1-128, default 1):First sector (34-62914526, default 2048):Last sector, +sectors or +size{K,M,G,T,P} (2048-62914526, default 62914526):Created a new partition 1 of type "Linux filesystem" and of size 30 GiB.Partition #1 contains a ext4 signature.Do you want to remove the signature? [Y]es/[N]o: yThe signature will be removed by a write command.Command (m for help): pDisk /dev/sdc: 30 GiB, 32212254720 bytes, 62914560 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: gptDisk identifier: 23000000-0000-4C4A-8000-699000005ABBDevice Start End Sectors Size Type/dev/sdc1 2048 62914526 62912479 30G Linux filesystemFilesystem/RAID signature on partition 1 will be wiped.Command (m for help): w ## 6、保存退出The partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.root@ubuntu:/home/run/code#
-
焦点速讯:美的集团:境外证券交易所同意KUKA终止上市并摘牌美的集团今日发布公告,公司拟通过全资子公司广东美的电气有...
-
苏宁易购海尔敲定2023年200亿合作目标据36氪消息,11月24日,苏宁易购与海尔召开年度战略对接会,...
-
焦点报道:美团王兴回应腾讯减持:双方仍保持合作、同时欢迎新投资者据第一财经消息,对于腾讯宣布派发美团股份,王兴表示无论在...
-
“20恒大02”展期通过,获过半数债权人同意据财联社消息,恒大地产公告,其旗下“20恒大02”于近期召开2...
-
中信建投:紫晶存储涉嫌欺诈发行等事项对公司的影响尚存在不确定性据报道,中信建投发布风险提示,上市公司紫晶存储称其因涉嫌...
-
【环球新视野】世界杯开赛前三天,京东超市牛奶乳品增超5成作为广大球迷期待已久的精神盛宴,卡塔尔世界杯开赛前三天,...
-
央行:12月5日全面降准0.25个百分点据财联社消息,为保持流动性合理充裕,促进综合融资成本稳中...
-
焦点速看:央行:此次全面降准共计释放长期资金约5000亿元据财联社消息,央行决定于2022年12月5日降低金融机构存款准备...
-
世界新消息丨蚂蚁数字科技业务出海新进展,在菲律宾发布多款数字科技产品鞭牛士报道近日,蚂蚁集团数字科技业务在菲律宾马尼拉举办客...
-
今日快讯:吴亦凡强奸、聚众淫乱一案宣判据北京朝阳法院,2022年11月25日上午,北京市朝阳区人民法院...
- 智联世界,元生无界!快手虚拟人IP亮相2022人工智能大会
2022-09-07 10:47:54
- 机器人界“奥林匹克”!2022世界机器人大会8月18日举行
2022-08-10 09:58:58
- 2025年全球人口将达到90亿!机器人将在农业领域大显身手
2022-07-14 09:41:10
- 中科院院士蒋华良:AI+分子模拟与药物研发将大有可为
2022-07-14 09:37:00
- “千垛之城荷你有约” 2022兴化市荷文化旅游节正式开幕
2022-07-07 09:28:34