Under linux partition the disk using fdisk

Reprinted from: https://blog.51cto.com/12185273/2048111

In the actual production server, you will encounter a lack of disk space, temporary mount disk expansion of capacity, if the increase is less than 2TB of disk space, you can use fdisk to complete, if your partition is larger than 2TB with parted; planning is generally recommended to use linux server lvm logical disk management. Then demonstrate how to use fdisk to partition the disk is formatted and the boot automatically mount.
4 steps to go:
add disk - Partition - Format and mount - set the boot automatically mount the
first to add a virtual disk 5G capacity,
Under linux partition the disk using fdisk
Under linux partition the disk using fdisk
execute fdisk -l View partition details, you can see more than a / dev / sdb 5g available space
Under linux partition the disk using fdisk
execution fdisk / dev / sdb its partition
n-- new partition
p-- new primary partition for the new extended partition e-- input
section number 1 input, to continue the transport
Under linux partition the disk using fdisk
input p to print the partition information, the ID of the back refers to the linux partition type codes
Under linux partition the disk using fdisk
linux partition type code 83
Under linux partition the disk using fdisk
commands can be entered unfamiliar m see help,
Under linux partition the disk using fdisk
enter w enter to save the partition information
Under linux partition the disk using fdisk
formatted partition
Linux kernel since 2.6.28 officially support the new file system ext4, before the file system It is ext3;; centos7 xfs file system format to
view the system kernel version and boot loader fstab file system type
Under linux partition the disk using fdisk
format the / dev / sdb1
mkfs.ext4 / dev / sdb1 Note: this is sdb1, sdb not
Under linux partition the disk using fdisk
see done representation formatting is complete
to create a mount directory
mkdir / dbfile
Mount: mount / dev / sdb1 / dbfile
unmounted: umount / dev / sdb1 / dbfile
Under linux partition the disk using fdisk
will be added to the mounted disk boot automatically mount
here I use uuid mount, more reliable; mainly worried if we add the other disks that may lead to zoning changes cause the system to fail to start;
blkid view disk uuid
vim / etc / fstab to add record screenshots
Under linux partition the disk using fdisk
added after the check for the next available normal
mount -a
Under linux partition the disk using fdisk
Figure that there is no problem, you can try to restart the system to see to see whether the boot automatically mount.
After the restart we enter the directory to create a file, touch a.sh said that it has successfully working properly mounted 5G hard drive. . .
Under linux partition the disk using fdisk

Guess you like

Origin blog.csdn.net/qq_36328915/article/details/89284774