/dev directory. The naming of these block device files varies depending on the disk interface type, as shown below:Disk Interface Type | Disk Block Device File Name | Description | Example |
SCSI/SATA/SAS | /dev/sdX | X represents letters a-z, corresponding to storage devices in sequence. When the number of disks of this type exceeds 26, two letters are used, such as /dev/sdaa. | /dev/sda |
virtio-blk | /dev/vdX | X represents letters a-z, corresponding to storage devices in sequence. | /dev/vda |
NVMe | /dev/nvmeXnY | X represents the NVMe controller number (starting from 0), and Y represents the NVMe namespace number (starting from 1). A namespace typically corresponds to a storage device. | /dev/nvme0n1 |
IDE | /dev/hdX | X represents letters a-z, corresponding to storage devices in sequence. | /dev/hda |
/dev directory, as shown below:Disk Block Device File Name | Disk Partition Block Device File Name | Description | Example |
/dev/sdX | /dev/sdXN | N indicates the partition number (starting from 1). | /dev/sda1 |
/dev/vdX | /dev/vdXN | N indicates the partition number (starting from 1). | /dev/vda1 |
/dev/nvmeXnY | /dev/nvmeXnYpN | N indicates the partition number (starting from 1). | /dev/nvme0n1p1 |
/dev/hdX | /dev/hdXN | N indicates the partition number (starting from 1). | /dev/hda1 |
Partition Table | Maximum Number of Partitions | Maximum Partition Size |
MSDOS(MBR) | 4 primary partitions or 3 primary partitions and 1 extended partition (which can be divided into multiple logical partitions) | 2 TiB (sector size: 512 B) 16 TiB (sector size: 4 KB) |
GPT | 128 | 8 ZiB (sector size: 512 B) 64 ZiB (sector size: 4 KB) |
lsblk# Expected output# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS# sda 8:0 0 50G 0 disk# ├─sda1 8:1 0 1G 0 part /boot# └─sda2 8:2 0 49G 0 part# ├─os-root 253:0 0 30G 0 lvm /# └─os-home 253:1 0 19G 0 lvm /homeparted /dev/sda print# Expected output# Model: ATA QEMU HARDDISK (scsi)# Disk /dev/sda: 53.7GB# Sector size (logical/physical): 512B/512B# Partition Table: msdos# Disk Flags:## Number Start End Size Type File system Flags# 1 1049kB 1075MB 1074MB primary ext4 boot# 2 1075MB 53.7GB 52.6GB primary lvm
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTSsda 8:0 0 64G 0 disk├─sda1 8:1 0 50M 0 part /boot/efi├─sda2 8:2 0 512M 0 part /boot└─sda3 8:3 0 63.4G 0 part├─os-root 253:0 0 30G 0 lvm /└─os-home 253:1 0 33.4G 0 lvm /home
parted /dev/sda print
Model: ATA Fedora Linux-0 S (scsi)Disk /dev/sda: 68.7GBSector size (logical/physical): 512B/4096BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 1049kB 53.5MB 52.4MB fat16 EFI System Partition boot, esp2 53.5MB 590MB 537MB ext43 590MB 68.7GB 68.1GB lvm
lsblk can list block device information, as shown below:lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTSsda 8:0 0 60G 0 disk├─sda1 8:1 0 1M 0 part├─sda2 8:2 0 1G 0 part /boot└─sda3 8:3 0 59G 0 part├─os-root 253:0 0 39.6G 0 lvm /└─os-home 253:1 0 19.4G 0 lvm /homesdb 8:16 0 30G 0 disk├─sdb1 8:17 0 1G 0 part├─sdb2 8:18 0 1G 0 part├─sdb3 8:19 0 1K 0 part├─sdb4 8:20 0 26G 0 part└─sdb5 8:21 0 1G 0 partsr0 11:0 1 13.8G 0 rom
NAME: disk or partition device nameMAJ:MIN: major and minor device numbers of a disk or partitionRM: whether the device is removable. 0 indicates non-removable, and 1 indicates removable.SIZE: disk or partition capacityRO: whether the device is read-only. 0 indicates read-write, and 1 indicates read-only.TYPE: device type. disk indicates a disk, part indicates a partition, and lvm indicates a logical volume.MOUNTPOINTS: mount pointblkid
/dev/mapper/os-home: UUID="f30c7d4a-c97d-427e-ba4e-xxxxxxxxxxxx" BLOCK_SIZE="4096" TYPE="ext4"/dev/sr0: BLOCK_SIZE="2048" UUID="2023-05-08-xx-xx-xx-xx" LABEL="TencentOS Server" TYPE="iso9660" PTTYPE="PMBR"/dev/mapper/os-root: UUID="2985bd9c-facc-49eb-8752-xxxxxxxxxxxx" BLOCK_SIZE="4096" TYPE="ext4"/dev/sda2: UUID="57139a63-0e14-410b-ae05-xxxxxxxxxxxx" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="846b8e84-0d7e-xxxx-xxx"/dev/sda3: UUID="q6Vgxu-Wvpn-d3M9-c8Hk-dMT0-xxxx-xxxxx" TYPE="LVM2_member" PARTUUID="5d88c31f-ab83-46bd-xxxx-xxxxxx"/dev/sdb4: PARTUUID="1144xxxx-04"/dev/sdb2: PARTUUID="1144xxxx-02"/dev/sdb5: PARTUUID="1144xxxx-05"/dev/sdb1: PARTUUID="1144xxxx-01"/dev/sda1: PARTUUID="603c9161-aa71-4196-bbb8-xxxxxxxxxxxx"
parted <block-device> to enter the interactive interface, as shown below:parted <block-device>
help to view all supported subcommands, as shown below:help
quit to exit the interactive interface.quit
/dev/sdb disk. After entering the interactive interface, run help and then exit the interactive interface.parted /dev/sdb
GNU Parted 3.5Using /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) helpalign-check TYPE N check partition N for TYPE(min|opt) alignmenthelp [COMMAND] print general help, or help on COMMANDmklabel,mktable LABEL-TYPE create a new disklabel (partition table)mkpart PART-TYPE [FS-TYPE] START END make a partitionname NUMBER NAME name partition NUMBER as NAMEprint [devices|free|list,all] display the partition table, or available devices, or free space,or all found partitionsquit exit programrescue START END rescue a lost partition near START and ENDresizepart NUMBER END resize partition NUMBERrm NUMBER delete partition NUMBERselect DEVICE choose the device to editdisk_set FLAG STATE change the FLAG on selected devicedisk_toggle [FLAG] toggle the state of FLAG on selected deviceset NUMBER FLAG STATE change the FLAG on partition NUMBERtoggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBERunit UNIT set the default unit to UNITversion display the version number and copyright information of GNU Parted(parted) quit
<block-device> is not specified, the first disk is used by default, which is usually /dev/sda. You can confirm this from the command output.print subcommand to view partition information.parted <block-device>
print subcommand to display partition information of the current disk or all disks.print [devices|free|list,all]
print subcommand is optional. If no parameter is specified, the partition information of the current device is displayed by default. The parameters are described as follows:devices: displays all active disks.free: views the remaining capacity of the current disk.list,all: views partition information of all disks./dev/sda:parted /dev/sda
GNU Parted 3.5Using /dev/sdaWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) printModel: ATA QEMU HARDDISK (scsi)Disk /dev/sda: 64.4GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: pmbr_bootNumber Start End Size File system Name Flags1 1049kB 2097kB 1049kB bios_grub2 2097kB 1076MB 1074MB ext43 1076MB 64.4GB 63.3GB lvm
Model: ATA QEMU HARDDISK (scsi): disk type, manufacturer, model, and interface.Disk /dev/sda: 64.4GB: the block device file and capacity corresponding to the disk.Sector size (logical/physical): 512B/512B: sector size.Partition Table: gpt: partition table type.Disk Flags: pmbr_boot: a disk flag that appears only on disks with GPT partition tables, indicating that the disk has special attributes. In the example, pmbr_boot indicates that a protective MBR (PMBR) exists on the disk, supporting the BIOS boot method.Number: partition number.Start/End: the start and end positions of a partition.Size: partition capacity.File system: the type of file system on the partition.Name: the partition name, which appears only on disks with GPT partition tables and can be repeated.Flags: partition flags. In the example, bios_grub indicates a BIOS boot partition, which is required when the system disk uses a GPT partition table under BIOS boot.Type: the partition type, which appears only on disks with MSDOS partition tables. Its values are primary, extended, and logical, corresponding to primary partitions, extended partitions, and logical partitions respectively.parted <block-device> print
/dev/sda:parted /dev/sda print
Model: ATA QEMU HARDDISK (scsi)Disk /dev/sda: 64.4GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: pmbr_bootNumber Start End Size File system Name Flags1 1049kB 2097kB 1049kB bios_grub2 2097kB 1076MB 1074MB ext43 1076MB 64.4GB 63.3GB lvm
print command is compat, where input is in MB and output is presented in a human-readable format (such as kB, MB, or GB). This unit is decimal-based and has limited precision. If you need more precise capacity data, use the unit subcommand to change the display unit.unit <UNIT>
<UNIT> specifies the unit for displaying capacity. The following values are supported:s indicates a sector.kB, MB, GB, TB are based on the decimal system, where each unit is 1000 times larger than the previous one.compat, the default input unit is MB, and the output unit is in a human-readable format.cyl: cylinder.chs represents a disk location described as a triplet (cylinders, heads, sectors), corresponding to cylinders, heads, and sectors respectively. One cylinder contains 255 heads, and one head contains 2 sectors. The value ranges of the components are as follows: heads ranges from 0 to 254, and sectors ranges from 0 to 1.chs, the disk capacity is displayed as the triplet position of the last sector, where sectors is typically 1. The formula for calculating the total number of sectors on the disk is: total sectors = cylinders × 255 × 2 + heads × 2 + sectors + 1.%: percentage.kiB, MiB, GiB, TiB are based on the binary system, where each unit is 1024 times larger than the previous one.mklabel or mktable subcommand to create a partition table.parted <block-device>
mklabel LABEL-TYPE
gpt partition table on the block device /dev/sdb.parted /dev/sdb
GNU Parted 3.5Using /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) mklabel gpt(parted) quitInformation: You may need to update /etc/fstab.
parted <block-device> mklabel LABEL-TYPE
gpt partition table on the block device /dev/sdb.parted /dev/sdb mklabel gpt
/etc/fstab, parted will prompt Information: You may need to update /etc/fstab.. Update /etc/fstab promptly as prompted.mkpart subcommand to create a partition.parted <block-device>
unit <UNIT>
print free
mkpart PART-TYPE [FS-TYPE] START END
PART-TYPE: When the partition table is MSDOS, the available values are primary, extended, and logical, corresponding to primary partitions, extended partitions, and logical partitions respectively. A logical partition can be set only when an extended partition already exists. When the partition table is GPT, this option is set as the partition name, which can be any string.FS-TYPE: Optional. Sets the file system for the partition. It only sets the metadata value of the partition file system field and does not actually create a file system.START/END: the start and end positions of a partition. Supported units include s, B, kB, MB, GB, TB, compact, cyl, chs, %, kiB, MiB, GiB, and TiB. If no unit is specified, the default unit under the current UNIT is used.partprobe command. In some environments, the OS may not update in time after a partition is created, and the old partition information remains in memory. The partprobe command can notify the OS to rescan the disk partition table and load the new partition information.partprobe <block-device>
test-part on /dev/sdb, with the start position at 1 MiB and the end position at 1 GiB.parted /dev/sdb
GNU Parted 3.5Using /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) unit kiB(parted) print freeModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 31457280kiB 9Sector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags17.0kiB 31457263kiB 31457247kiB Free Space(parted) mkpart test-part 1MiB 1GiB(parted) print freeModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 31457280kiBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags17.0kiB 1024kiB 1007kiB Free Space1 1024kiB 1048576kiB 1047552kiB test-part1048576kiB 31457263kiB 30408688kiB Free Space(parted) quitpartprobe /dev/sdb
parted <block-device> mkpart PART-TYPE [FS-TYPE] START END
parted /dev/sdb unit MiB print free
Model: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 30720MiBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags0.02MiB 1.00MiB 0.98MiB Free Space1 1.00MiB 1024MiB 1023MiB test-part1024MiB 30720MiB 29696MiB Free Spaceparted /dev/sdb mkpart test-part2 1024MiB 2048MiBInformation: You may need to update /etc/fstab.partprobe /dev/sdbparted /dev/sdb unit MiB print freeModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 30720MiBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags0.02MiB 1.00MiB 0.98MiB Free Space1 1.00MiB 1024MiB 1023MiB test-part2 1024MiB 2048MiB 1024MiB test-part22048MiB 30720MiB 28672MiB Free Space
parted <block-device>
unit UNIT
print free
resizepart NUMBER END
NUMBER: number of the partition to be adjusted.END: the end position of the adjusted partition. END cannot be smaller than the start size of the partition.partprobe <block-device>
parted /dev/sdb
GNU Parted 3.5Using /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) unit MiB(parted) print freeModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 30720MiBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags0.02MiB 1.00MiB 0.98MiB Free Space1 1.00MiB 1024MiB 1023MiB test-part2 1024MiB 2048MiB 1024MiB test-part22048MiB 30720MiB 28672MiB Free Space(parted) resizepart 2 4096MiB(parted) print freeModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 30720MiBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags0.02MiB 1.00MiB 0.98MiB Free Space1 1.00MiB 1024MiB 1023MiB test-part2 1024MiB 4096MiB 3072MiB test-part24096MiB 30720MiB 26624MiB Free Space(parted) quitpartprobe /dev/sdb
parted <block-device> resizepart NUMBER END
parted /dev/sdb unit MiB print free
Model: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 30720MiBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags0.02MiB 1.00MiB 0.98MiB Free Space1 1.00MiB 1024MiB 1023MiB test-part2 1024MiB 2048MiB 1024MiB test-part22048MiB 30720MiB 28672MiB Free Spaceparted resizepart 2 4096MiBparted /dev/sdb resizepart 2 4096MiBInformation: You may need to update /etc/fstab.partprobe /dev/sdbparted /dev/sdb unit MiB print freeModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 30720MiBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags0.02MiB 1.00MiB 0.98MiB Free Space1 1.00MiB 1024MiB 1023MiB test-part2 1024MiB 4096MiB 3072MiB test-part24096MiB 30720MiB 26624MiB Free Space
parted <block-device>
rm NUMBER
partprobe <block-device>
parted /dev/sdb
GNU Parted 3.5Using /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) printModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 32.2GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 1049kB 1074MB 1073MB ext4 test-part2 1074MB 2147MB 1074MB ext4 test-part2(parted) rm 2(parted) printModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 32.2GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 1049kB 1074MB 1073MB ext4 test-part(parted) quitInformation: You may need to update /etc/fstab.partprobe /dev/sdb
parted <block-device> rm NUMBER
parted /dev/sdb print
Model: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 32.2GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 1049kB 1074MB 1073MB ext4 test-part2 1074MB 2147MB 1074MB ext4 test-part2parted /dev/sdb rm 2Information: You may need to update /etc/fstab.parted /dev/sdb printModel: ATA QEMU HARDDISK (scsi)Disk /dev/sdb: 32.2GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags:Number Start End Size File system Name Flags1 1049kB 1074MB 1073MB ext4 test-part
fdisk <block-device> to enter the interactive interface. Most fdisk operations need to be completed in the interactive interface, as shown below:fdisk <block-device>
Command (m for help):
m to view help information:Command (m for help): m
q to exit the interactive interface:Command (m for help): q
fdisk <block-device>
Command (m for help): p
/dev/sda.fdisk /dev/sda
Welcome to fdisk (util-linux 2.37.4).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.This disk is currently in use - repartitioning is probably a bad idea.It's recommended to umount all file systems, and swapoff all swappartitions on this disk.Command (m for help): printDisk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectorsDisk model: QEMU HARDDISKUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: gptDisk identifier: 3C81803B-8934-47FF-BE0B-37AE73EC68C0Device Start End Sectors Size Type/dev/sda1 2048 4095 2048 1M BIOS boot/dev/sda2 4096 2101247 2097152 1G Linux filesystem/dev/sda3 2101248 125827071 123725824 59G Linux LVM
Disk /dev/sda: the disk capacity, displayed in GiB, bytes, and sectors respectively.Disk model: the disk model.Units: the display unit.Sector size: sector size.Disklabel type: the partition table type. In fdisk, an MSDOS partition table is displayed as dos.Disk identifier: the disk identifier.Device: the partition block device file name.Start/End: the start and end sectors.Sectors: the total number of sectors in the partition.Size: partition size.Type: the partition type, corresponding to the partition flag in parted.fdisk -l [<block-device>]
<block-device> is not specified, all disk partition information is displayed.fdisk <block-device>
Command (m for help): g
Command (m for help): w
gpt partition table on the block device /dev/sdb.fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.4).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): gCreated a new GPT disklabel (GUID: AC247B3E-7137-6B42-8F85-7D570A41D7FE).The device contains 'dos' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.
fdisk <block-device>
Command (m for help): n
Command (m for help): w
partprobe <block-device>
/dev/sdb.fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.4).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): nPartition typep primary (0 primary, 0 extended, 4 free)e extended (container for logical partitions)Select (default p): pPartition number (1-4, default 1):First sector (2048-62914559, default 2048):Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62914559, default 62914559): +1GCreated a new partition 1 of type 'Linux' and of size 1 GiB.Command (m for help): nPartition typep primary (1 primary, 0 extended, 3 free)e extended (container for logical partitions)Select (default p): ePartition number (2-4, default 2):First sector (2099200-62914559, default 2099200):Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-62914559, default 62914559):Created a new partition 2 of type 'Extended' and of sizeGiB.Command (m for help): nAll space for primary partitions is in use.Adding logical partition 5First sector (2101248-62914559, default 2101248):Last sector, +/-sectors or +/-size{K,M,G,T,P} (2101248-62914559, default 62914559): +1GCreated a new partition 5 of type 'Linux' and of size 1 GiB.Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.partprobe /dev/sdb
/dev/sdb.fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.4).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): nPartition number (1-128, default 1):First sector (2048-62914526, default 2048):Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62914526, default 62914526): +1GCreated a new partition 1 of type 'Linux filesystem' and of size 1 GiB.Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.partprobe /dev/sdb
fdisk <block-device>
Command (m for help): p
Command (m for help): d
Command (m for help): w
partprobe <block-device>
fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.4).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): pDisk /dev/sdb: 30 GiB, 32212254720 bytes, 62914560 sectorsDisk model: QEMU HARDDISKUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0xe7cfb001Device Boot Start End Sectors Size Id Type/dev/sdb1 2048 2099199 2097152 1G 83 Linux/dev/sdb2 2099200 4196351 2097152 1G 83 Linux/dev/sdb3 4196352 8390655 4194304 2G 83 Linux/dev/sdb4 8390656 62914559 54523904 26G 5 Extended/dev/sdb5 8392704 10489855 2097152 1G 83 LinuxCommand (m for help): dPartition number (1-5, default 5): 2Partition 2 has been deleted.Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.partprobe /dev/sdb
Physical Memory (RAM) | Recommended swap Space Size (Without Hibernation) | Recommended swap Space Size (With Hibernation) |
Less than 2 GB | 2 times the RAM | 3 times the RAM |
2G ~ 8G | Equal to RAM | 2 times the RAM |
8G ~ 16G | At least 4 GB | 1.5 times the RAM |
Greater than 64 GB | At least 4 GB | Hibernation not recommended |
parted or fdisk command, such as /dev/sdb1:sdb 8:16 0 64G 0 disk└─sdb1 8:17 0 8G 0 part
mkswap /dev/sdb1
/etc/fstab:/dev/sdb1 swap swap defaults 0 0
systemctl daemon-reload
swapon -v /dev/sdb1
cat /proc/swaps
Filename Type Size Used Priority/dev/sdb1 partition 8388604 0 -2
free -h
total used free shared buff/cache availableMem: 7.3Gi 404Mi 6.5Gi 33Mi 444Mi 6.7GiSwap: 8.0Gi 0B 8.0Gi
dd if=/dev/zero of=/data/swapfile bs=1M count=8192
mkswap /data/swapfile
/etc/fstab:/data/swapfile swap swap defaults 0 0
systemctl daemon-reload
swapon -v /data/swapfile
cat /proc/swaps
Filename Type Size Used Priority/data/swapfile file 8388604 0 -2
free -h
total used free shared buff/cache availableMem: 7.3Gi 432Mi 75Mi 33Mi 6.8Gi 6.7GiSwap: 8.0Gi 0B 8.0Gi
swapoff -v /dev/sdb1
sdb1 partition.parted /dev/sdb rm 1
/etc/fstab.systemctl daemon-reload
cat /proc/swaps
Filename Type Size Used Priority
free -h
total used free shared buff/cache availableMem: 7.3Gi 421Mi 92Mi 33Mi 6.8Gi 6.7GiSwap: 0B 0B 0B
swapoff -v /data/swapfile
rm /data/swapfile
/etc/fstab.systemctl daemon-reload
cat /proc/swaps
Filename Type Size Used Priority
free -h
total used free shared buff/cache availableMem: 7.3Gi 421Mi 92Mi 33Mi 6.8Gi 6.7GiSwap: 0B 0B 0B
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários