红色字体为需要输入的命令:
ubuntu:$ umount /dev/sdc1
ubuntu:$ umount /dev/sdc2
ubuntu:$ sudo fdisk /dev/sdc
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
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
u change display/entry units
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 table
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-15523839, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-15523839, default 15523839): +500M
Created a new partition 1 of type 'Linux' and of size 500 MiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (1026048-15523839, default 1026048):
Last sector, +sectors or +size{K,M,G,T,P} (1026048-15523839, default 15523839):
Created a new partition 2 of type 'Linux' and of size 6.9 GiB.
Command (m for help): a
Partition number (1,2, default 2): 1
The bootable flag on partition 1 is enabled now.
Command (m for help): t
Partition number (1,2, default 2): 1
Partition type (type L to list all types): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
Command (m for help): t
Partition number (1,2, default 2): 2
Partition type (type L to list all types): 83
Changed type of partition 'Linux' to 'Linux'.
Command (m for help): p
Disk /dev/sdc: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7422f324
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 1026047 1024000 500M c W95 FAT32 (LBA)
/dev/sdc2 1026048 15523839 14497792 6.9G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
ubuntu:$ sudo mkfs.vfat -F 32 -n boot /dev/sdc1
mkfs.fat 3.0.28 (2015-05-16)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
ubuntu:$ sudo mkfs.ext4 -L rootfs /dev/sdc2
mke2fs 1.42.13 (17-May-2015)
/dev/sdc2 contains a ext4 file system labelled 'rootfs'
last mounted on /media/lanxinhua/rootfs on Fri Nov 26 09:57:06 2021
Proceed anyway? (y,n) y
Creating filesystem with 1812224 4k blocks and 453376 inodes
Filesystem UUID: 04a8382f-d690-4ee7-a77d-fa942c0adce9
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done



