partition, mount partition

Extended partition, primary partition, logical partition

gpt

 

partition

[root@localhost ~]# fdisk -l


[root@localhost ~]# fdisk /dev/vdb


Command (m for help): m ### View help


Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d delete a partition                  ##### delete a partition

   g   create a new empty GPT partition table

   G   create an IRIX (SGI) partition table

   l   list known partition types

   m   print this menu

   n add a new partition                ##### New partition

   o   create a new empty DOS partition table

   p print the partition table              ##### Display partition table information

   q   quit without saving changes        ######退出

   s   create a new empty Sun disklabel

   t change a partition's system id            ##### Modify the partition id

   u   change display/entry units

   v   verify the partition table

   w write table to disk and exit            ##### Write the current operation to the hard disk partition table

   x   extra functionality (experts only)

Command (m for help):  n ##### Create new partition

Partition type:                              #### Create partition type

   p primary (0 primary, 0 extended, 4 free)    ##### primary partition

   e extended                             ###### Extended partition

Select (default p):  p #### Select the partition type as the primary partition    

Partition number (1-4, default 1): 1 ##### Determine the partition id

First sector (2048-20971519, default 2048):        ##### Partition start block location, use default

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +100M

                                     ####### Partition end block location, set with + size{K,M,G} 

Partition 1 of type Linux and of size 100 MiB is set


 

 

The second and third partitions also use the primary steps, and the following is the fourth partition

Command (m for help): n                

Partition type:

   p   primary (3 primary, 0 extended, 1 free)

   e   extended

Select (default e): e #### Select the partition type as the primary partition  

 

Selected partition 4

First sector (616448-20971519, default 616448):

Using default value 616448

Last sector, +sectors or +size{K,M,G} (616448-20971519, default 20971519):

Using default value 20971519

Partition 4 of type Extended and of size 9.7 GiB is set

 Since partition 4 is a logical partition, the actual partitions created later are all in partition 4, so the remaining space is given to 4




New partition 5


 

 

Command (m for help): p                        ##### Display partition table information  

 


 

Command (m for help) : wq ##### Save and exit


[root@localhost ~]# cat /proc/partitions ##### Check if the device is recognized by the system

major minor  #blocks  name

 


 

Format the partition before mounting it

[root@localhost ~]# mkfs.xfs /dev/vdb1 ### Format in sequence

                                              /dev/vdb1 , 2 , 3 , 5 (cannot format 4 ,

                                           Because the fourth is a container, the logical partition is gone after formatting)


[root@localhost ~]# blkid

/dev/vda1: UUID="9bf6b9f7-92ad-441b-848e-0257cbb883d1" TYPE="xfs"

/dev/vdb5: UUID="329d5e83-34a1-4f6d-aba9-961a12878106" TYPE="xfs"

/dev/vdb2: UUID="98d75a71-1710-4295-ad89-9a48401d6c07" TYPE="xfs"

/dev/vdb3: UUID="242f919f-5cc4-4ad0-85cf-2b4b893c1cc4" TYPE="xfs"

/dev/vdb1: UUID="ed8df2c1-1ba5-470b-b1e8-df44be724e35" TYPE="xfs"


Partition format complete

[root@localhost ~]# mount /dev/vdb1 /mnt/               mount

[root@localhost ~]# df


 

 

 

 

Use the parted tool to operate the disk

[root@localhost ~]# parted /dev/vdb


Use tab to display optional formatting


 

After the change, view and discover, /dev/vdb format is gpt

Create partitions again, 128 can be created at this time

 

 

To format /dev/vdb1, you need to add -f to format it successfully


mount /dev/vdb1 to /mnt/




Unmount the mounted disk partition

umount  /mnt/

 

 

The above mounts are temporary

permanent mount

vim /etc/fstab

 

/dev/vdb1     /mnt xfs defaults 0 0

 

/dev/vdb1     /mnt        xfs       defaults                0      0

The device        mount point   file system type  mount parameter          is not backed up   and not detected

 man 5 fstab   to view


df view

mount -a

df check that /dev/vdb1 is mounted

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326073466&siteId=291194637