1、 在linux中新增IDE硬盘8,对其进行分区划分,两个基本分区分别为1G,1个交换分区为500MB,扩展分区2G,对其中一个分区进行磁盘配额限制,限制用户空间为100MB
时间: 2024-05-07 15:22:43 浏览: 147
linux磁盘分区以及配额
1. 首先需要安装IDE硬盘8,并使用fdisk命令进行分区划分:
```
fdisk /dev/hdb
```
2. 创建两个基本分区:
```
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-16777215, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-16777215, default 16777215): +1G
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (2099200-16777215, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-16777215, default 16777215): +1G
```
3. 创建一个交换分区:
```
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (3147776-16777215, default 3147776):
Using default value 3147776
Last sector, +sectors or +size{K,M,G} (3147776-16777215, default 16777215): +500M
```
4. 创建一个扩展分区:
```
Command (m for help): n
Partition type:
p primary (2 primary, 1 extended, 1 free)
e extended
Select (default p):
Using default response e
Partition number (2-4, default 4):
First sector (5244928-16777215, default 5244928):
Using default value 5244928
Last sector, +sectors or +size{K,M,G} (5244928-16777215, default 16777215): +2G
```
5. 将其中一个分区挂载到特定目录,并使用quota命令进行磁盘配额限制:
```
mkdir /mnt/part1
mount /dev/hdb1 /mnt/part1
echo "/dev/hdb1 /mnt/part1 ext4 defaults,usrquota 0 0" >> /etc/fstab
quotacheck -avugm
quotaon -avug
edquota -u username /mnt/part1
```
其中,username为需要进行磁盘配额限制的用户账号。在edquota命令中,可以设置该用户的磁盘配额限制。
阅读全文