How to mount a new disk on a Linux cloud server

How to mount a new disk on a Linux cloud server

background

A new server was added in the company, and a 2T hard disk was mounted. After logging in through ssh, it was found that it was not mounted. What should I do?

(I don’t want to go to Baidu every time to find out how to mount it, so I’ll sort it out)

View Status

# Check the disk status and find a new disk /dev/vdb
fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006b766

  Device Boot Start End Blocks Id System
/dev/vda1 * 1 5222 41942016 83 Linux

Disk /dev/vdb: 2147.5 GB, 2147483648000 bytes
16 heads, 63 sectors/track, 4161015 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb9876eee
# Use lsblk to view [root@ecs-9054 tmp]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 40G 0 disk
└─vda1 252:1 0 40G 0 part /
vdb 252:16 0 2T 0 disk

# View the format [root@ecs-9054 tmp]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
vd
└─vda1 ext4 e10f3c70-e806-4633-a7cb-3d5aa3d9df5e /
vdb

Partitioning and formatting

# Partition the data disk. Follow the prompts and enter: n, p, 1, press Enter twice, wq
# Enter n to add a new partition # Enter p to create a new primary partition # Specify the partition number, just enter 1 # Specify the starting sector, the default is fine, it is not recommended to change # Specify the ending sector, which represents the partition size. You can use K, M, G to specify the partition size. By default, all are allocated fdisk /dev/vdb

# Now find the newly added /dev/vdb1
fdisk -l

# Format the specified partition mkfs.ext4 /dev/vdb1

Mount

# Temporarily mount the partition, which will become invalid after reboot # Mount it in the /data directory mount /dev/vdb1 /data

# Unmount /data

# Permanent mount: Write new partition information # The first partition to be mounted, such as /dev/sdb1
# The mount point of the second partition, for example, mount it to /root/RepositoryDisk# The format of the third partition should be the same as the format specified when you formatted the partition yourself# For the fourth partition, just defaults and keep it consistent with the system# For the fifth partition, keep it consistent with the system, just enter 0# For the sixth partition, keep it consistent with the system, just enter 0#
# Append the following text to the /etc/fstab file echo /dev/vdb1 /data ext4 defaults,noatime 0 0 >> /etc/fstab

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Linux server partitioning and mounting
  • Alibaba Cloud Server Linux System Mounting Data Disk Graphic Tutorial

<<:  Mysql optimization techniques for querying dates based on time

>>:  Detailed explanation of object literals in JS

Recommend

Implementation of React star rating component

The requirement is to pass in the rating data for...

64-bit CentOs7 source code installation mysql-5.6.35 process sharing

First install the dependent packages to avoid pro...

Research on Web Page Size

<br />According to statistics, the average s...

50 Beautiful FLASH Website Design Examples

Flash enabled designers and developers to deliver...

JS Asynchronous Stack Tracing: Why await is better than Promise

Overview The fundamental difference between async...

HTML code that can make IE freeze

We simply need to open any text editor, copy the f...

WeChat applet custom menu navigation to achieve staircase effect

Design Intentions When developing a page, you oft...

How to use the Linux nl command

1. Command Introduction nl (Number of Lines) adds...

How to position the header at the top using CSS sticky layout

Application scenarios: One of the new requirement...

HTML background color gradient effect achieved through CSS style

Effect screenshots: Implementation code: Copy code...

SQL serial number acquisition code example

This article mainly introduces the sql serial num...

Detailed explanation of MySQL 8.0.18 commands

Open the folder C:\web\mysql-8.0.11 that you just...

The most complete 50 Mysql database query exercises

This database query statement is one of 50 databa...

MySQL column to row conversion tips (share)

Preface: Because many business tables use design ...