Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to partition linux

Shulou Source: shulou.com Published: 2022-06-02 21:29:15 09月22日 Update

How to partition linux? In response to this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more small partners who want to solve this problem find a simpler and easier way.

1. The hard disk must be partitioned, created file system (formatted) and mounted to store data;

2. A hard disk can only have up to 4 primary partitions (1 extended partition is equivalent to 1 primary partition);

There can be at most one extended partition and multiple logical partitions, but there can be at most 12 logical partitions. Extended partitions are equivalent to containers of logical partitions.

1. Create a partition

1. Enter the fdisk interface and list all commands

fdisk /dev/sda

2. Display hard disk partition information

command(m for help):p

3. Create a primary partition

command(m for help): n #Created

We need to assign the start and end cylinders of partition 3. This can be done directly by entering the default start cylinder or by entering a number to specify the start cylinder.

4. Delete the primary partition

command(m for help): d #Delete partition number (1-4): 3 #Delete partition 3 command (m for help): p #See results

Note: do not delete sda1 and sda2!

5, save exit

command(m for help): w #Save and exit command (m for help): q #Exit without saving

Creating a File System (Format)

1. After creating a partition, refresh it several times

partx -a /dev/sda #Refresh partition

2. Create a file system on a partition

mkfs -t ext3/dev/sda5 #(-t ext3 specifies file system format)

III. Mount

1. Create a new mount directory

mkdir /mnt/kk

2. Short-term mount

mount /dev/sda5 /mnt/kk

3. View partition mount

mount -s #View all the partitions that have been mounted. The answer to how to partition linux is shared here. I hope the above content can be helpful to everyone. If you still have a lot of doubts, you can pay attention to the industry information channel to learn more.

Tags: Files systems formats hard drives logic questions situations more help answers easy easy information content commands multiple containers guys buddies numbers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information OPPO Reno Shulou Technology Huawei