gparted to create a partition / mkfs to format the partition as a filesystem

gparted command:

(parted) mkpart part-type fs-type start end
part-type is one of primary, extended or logical, and is meaningful only for MBR partition tables.
fs-type is an identifier chosen among those listed by entering help mkpart as the closest match to the file system that you will use.
The mkpart command does not actually create the file system: the fs-type parameter will simply be used by parted to set a 1-byte code that is used by boot loaders to “preview” what kind of data is found in the partition, and act accordingly if necessary. See also Wikipedia:Disk partitioning#PC partition types.
Tip: Most Linux native file systems map to the same MBR partition type code (0x83), so it is perfectly safe to e.g. use ext2 for an ext4-formatted partition.
start is the beginning of the partition from the start of the device. It consists of a number followed by a unit, for example 1MiB means start at 1 MiB.
end is the end of the partition from the start of the device (not from the start value). It has the same syntax as start, for example 100% means end at the end of the device (use all the remaining space).

gparted practice:

Background: I installed debian on vmware, intended to separate the back part of the experiment linux from scratch

step 1:

First, use the following query fdisk -l disk usage now, my situation is:

root@peng:/home/peng# fdisk -l
Disk /dev/sda: 70 GiB, 75161927680 bytes, 146800640 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: 0x4f34802b

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048 103811071 103809024 49.5G 83 Linux
/dev/sda2       103811072 104857599   1046528  511M  5 Extended
/dev/sda5       103813120 104857599   1044480  510M 82 Linux swap / Solaris

Step 2:

Parameter 1: Do you want to operate on which device, I / dev / sda
Parameter 2: using the generated partition mkpart
Parameter 3: Select the primary partition primary
parameters 4: file system selection ext4
parameters 5: disk starting point for selection after 50G, the system will automatically help you assign a suitable location
parameter 6: end of the partition bother pointed out, I want all the rest, so here fill 100%

parted /dev/sda mkpart primary ext4 50G 100%
Step 3 formatted partition ext4 format:

mkfs /dev/sda3 -t ext4

Published 43 original articles · won praise 2 · Views 3376

Guess you like

Origin blog.csdn.net/songpeng26/article/details/105180694