Aliyun CentOS method to mount a new data disk
- 2020-06-23 02:33:18
- OfStack
Mount the new disk under The Aliyun Linux server and mount the new hard disk under your own native Linux environment is basically the same. The basic steps include: check the hard disk identification, partition, formatting, mount and so on. This article documents the detailed commands and steps for installing and mounting a new disk under the Aliyun CentOS server.
fdisk-l view the disk list
[[email protected] /]# fdisk -l
disk /dev/vda : 42.9 GB, 42949672960 Bytes, 83886080 A sector
Units = sector of 1 * 512 = 512 bytes
Sector size ( logic / physical ) : 512 byte / 512 byte
I/O The size of the ( The minimum / The best ) : 512 byte / 512 byte
Disk label Type: dos
Disk identifier: 0x635e6c7d
equipment Boot Start End Blocks Id System
/dev/vda1 2048 83886079 41942016 83 Linux
disk /dev/vdb : 107.4 GB, 107374182400 Bytes, 209715200 A sector
Units = sector of 1 * 512 = 512 bytes
Sector size ( logic / physical ) : 512 byte / 512 byte
I/O The size of the ( The minimum / The best ) : 512 byte / 512 byte
Found that the /dev/vdb device is not in use
Partition fdisk/dev/vdb
Please input n p 1 , and then enter it twice, then enter it again wq , waiting for completion.
[[email protected] /]# fdisk /dev/vdb
Welcome to use fdisk (util-linux 2.23.2) .
Changes stay in memory until you decide to write them to disk.
Before using write command 3 Think.
Device does not contain a recognized partition table
Use the disk identifier 0xe9d7e5a8 Create a new DOS Disk label.
The command ( The input m Get help ) : n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4 , the default 1) : 1
The starting sector (2048-209715199 By default, 2048) :
Default values will be used 2048
Last sector , + sector or +size{K,M,G} (2048-209715199 By default, 209715199) :
Default values will be used 209715199
partition 1 Has been set to Linux Type and size is set to 100 GiB
The command ( The input m Get help ) : wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
Synchronizing disk.
fdisk -l revisits the disk list
[[email protected] /]# fdisk -l
disk /dev/vda : 42.9 GB, 42949672960 Bytes, 83886080 A sector
Units = sector of 1 * 512 = 512 bytes
Sector size ( logic / physical ) : 512 byte / 512 byte
I/O The size of the ( The minimum / The best ) : 512 byte / 512 byte
Disk label Type: dos
Disk identifier: 0x635e6c7d
equipment Boot Start End Blocks Id System
/dev/vda1 2048 83886079 41942016 83 Linux
disk /dev/vdb : 107.4 GB, 107374182400 Bytes, 209715200 A sector
Units = sector of 1 * 512 = 512 bytes
Sector size ( logic / physical ) : 512 byte / 512 byte
I/O The size of the ( The minimum / The best ) : 512 byte / 512 byte
Disk label Type: dos
Disk identifier: 0xe9d7e5a8
equipment Boot Start End Blocks Id System
/dev/vdb1 2048 209715199 104856576 83 Linux
Format partition ES26en. ext4 /dev/vdb1
[[email protected] /]# mkfs.ext4 /dev/vdb1
mke2fs 1.42.9 (28-Dec-2013)
File system label =
OS type: Linux
The block size =4096 (log=2)
Block size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214144 blocks
1310707 blocks (5.00%) reserved for the super user
The first 1 A data block =0
Maximum filesystem blocks=2174746624
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: complete
Are written to the inode table : complete
Creating journal (32768 blocks): complete
Writing superblocks and filesystem accounting information: complete
This data disk is formatted into ext4 file format.
Mount the device to the specified directory
mount /dev/vdb1 /home
Take the example of mounting to the /home directory.
Save to file system table /etc/fstab
When the system reboots, the system automatically reads information from this file and automatically mounts the file system specified in this file to the specified directory.
echo /dev/vdb1 /home ext4 defaults 0 0 >> /etc/fstab
At this point, all Settings are complete.