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

JS implements the rock-paper-scissors game

This article example shares the specific code of ...

Basic learning tutorial of table tag in HTML

Table label composition The table in HTML is comp...

How to install Docker on Windows Server 2016

Recently Microsoft released Windows Server 2016, ...

Markup validation for doctype

But recently I found that using this method will c...

Basic operations of mysql learning notes table

Create Table create table table name create table...

Getting Started Guide to MySQL Sharding

Preface Relational databases are more likely to b...

WeChat Mini Program User Authorization Best Practices Guide

Preface When developing WeChat applets, you often...

Detailed steps for installing JDK and Tomcat on Linux cloud server (recommended)

Download and install JDK Step 1: First download t...

How to set the height of the autosize textarea in Element UI

After setting textarea input in Element UI to aut...

Analysis of the use and principle of Docker Swarm cluster management

Swarm Cluster Management Introduction Docker Swar...

Summary of some HTML code writing style suggestions

Omit the protocol of the resource file It is reco...

MySQL index coverage example analysis

This article describes MySQL index coverage with ...