如何制作ubuntu系统(使用Ubuntu制作ext4文件系统)
本文基于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/sdcWele 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 mand.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 mand.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#
相关内容
-
华硕电脑系统win10|华硕电脑系统win10系统
华硕电脑系统win10|华硕电脑系统win10系统,,华硕电脑系统win10...
-
金蝶担保机构业务管理系统
金蝶担保机构业务管理系统,,1.金蝶财务软件怎么使用?软件使用...
-
联想台式机怎么恢复出厂系统
联想台式机怎么恢复出厂系统,所示,如下图,如所示:首先关闭计算...
-
电脑系统城|电脑系统下载 win7
电脑系统城|电脑系统下载 win7,电脑系统城,不少朋友在使用电脑...
-
无法读取U盘中的数据
无法读取U盘中的数据,,核心提示:我有一个512MB的U盘,把它插在电...
-
主角电脑系统的小说|主角大脑里面电脑系统的小
主角电脑系统的小说|主角大脑里面电脑系统的小说,,1. 主角大脑...
-
电脑系统文字怎么修改|电脑系统文字怎么修改颜
电脑系统文字怎么修改|电脑系统文字怎么修改颜色,,1. 电脑系统...
-
金蝶系统的其他出入库核算|金蝶精斗云的云进销
金蝶系统的其他出入库核算|金蝶精斗云的云进销存软件有其他...
-
苹果系统的电脑好用吗|苹果电脑系统好用不
苹果系统的电脑好用吗|苹果电脑系统好用不,,苹果电脑系统好用...
-
怎样升级电脑cpu|怎样升级电脑系统版本
怎样升级电脑cpu|怎样升级电脑系统版本,,怎样升级电脑系统版本...
-
装电脑系统要多少钱|装个电脑系统要多少钱
装电脑系统要多少钱|装个电脑系统要多少钱,,装个电脑系统要多...
-
金蝶报表系统怎么取消隐藏|表格怎么取消隐藏
金蝶报表系统怎么取消隐藏|表格怎么取消隐藏,,1.表格怎么取消...
-
电脑系统升级到win10|电脑系统升级到win10之后
电脑系统升级到win10|电脑系统升级到win10之后无线网卡无法...
-
2021电脑系统在哪下载|2021年电脑最新系统
2021电脑系统在哪下载|2021年电脑最新系统,,1. 2021年电脑最新...
-
影子系统是什么影子系统安装卸载win10影子系统
影子系统是什么影子系统安装卸载win10影子系统崩溃修复教程,...