add partition
时间: 2023-11-11 20:03:48 浏览: 91
ADD磁盘分区工具
5星 · 资源好评率100%
To add a partition in a Linux system, you can follow these steps:
1. Open a terminal and run the following command to list all available disks and partitions:
```
sudo fdisk -l
```
2. Identify the disk and partition where you want to add a new partition. Note the device name (e.g. /dev/sda) and partition number (e.g. /dev/sda1).
3. Run the following command to start the partitioning tool for the specified device:
```
sudo fdisk /dev/sda
```
Replace /dev/sda with the actual device name.
4. Type "n" to create a new partition.
5. Choose the partition type and size.
6. Type "w" to write the changes to the disk and exit.
7. Format the new partition with a file system of your choice, e.g. ext4:
```
sudo mkfs -t ext4 /dev/sda2
```
Replace /dev/sda2 with the new partition device name.
8. Create a mount point for the new partition:
```
sudo mkdir /mnt/new_partition
```
9. Mount the new partition:
```
sudo mount /dev/sda2 /mnt/new_partition
```
Replace /dev/sda2 with the new partition device name and /mnt/new_partition with the desired mount point.
10. Add an entry to /etc/fstab to automatically mount the new partition at boot time:
```
/dev/sda2 /mnt/new_partition ext4 defaults 0 2
```
Replace /dev/sda2 and /mnt/new_partition with the actual device name and mount point, respectively.
阅读全文