我尝试创建新的交换分区,但尝试时出现错误
mkswap /dev/vda1p1
/dev/vda1p1: No such file or directory
请检查
-bash-4.2# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 253:0 0 30G 0 disk
├─vda1 253:1 0 28.1G 0 part /
└─vda2 253:2 0 1.9G 0 part [SWAP]
-bash-4.2# fdisk /dev/vda1
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-59006975, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-59006975, default 59006975): +100M
Partition 1 of type Linux and of size 100 MiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'
Command (m for help): p
Disk /dev/vda1: 30.2 GB, 30211571712 bytes, 59006976 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
Disk label type: dos
Disk identifier: 0x148f998d
Device Boot Start End Blocks Id System
/dev/vda1p1 2048 206847 102400 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
-bash-4.2# partprobe
-bash-4.2# mkswap /dev/vda1p1
/dev/vda1p1: No such file or directory
-bash-4.2# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 253:0 0 30G 0 disk
├─vda1 253:1 0 28.1G 0 part /
└─vda2 253:2 0 1.9G 0 part [SWAP]