How to remount the data disk after initializing the system disk in Linux

How to remount the data disk after initializing the system disk in Linux

Remount the data disk after initializing the system disk in a Linux instance

In a Linux instance, reinitializing the system disk will not change the contents of the data disk, but the mount information of the data disk will be lost. Therefore, after Linux restarts, follow the steps below to create a new mount point information and mount the data disk partition.

Note: In this document, it is assumed that before initializing the system disk, the data disk partition name mounted on the instance is /dev/vdb1 and the mount point name is /InitTest.

Check the data disk mounting information: Run the mount command. The returned result does not contain information about /dev/vdb1.

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=497476k,nr_inodes=124369,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/vda1 on / type ext4 (rw,relatime,data=ordered)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=9791)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=101620k,mode=700)

To view the data disk partition information, run the fdisk -l command.

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008d73a
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83884031 41940992 83 Linux
Disk /dev/vdb: 25.8 GB, 25769803776 bytes, 50331648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xfe6d77c1
Device Boot Start End Blocks Id System
/dev/vdb1 2048 50331647 25164800 83 Linux

Recreate the mount point of the data disk partition: run the command

mkdir /InitTest

Note: The mount point name here must be consistent with the mount point name of /dev/vdb1 before the system disk is initialized. You can view the original mount point name by running the cat /etc/fstab command.

Remount the data disk partition: Run the command

mount /dev/vdb1 /InitTest

View the mount result: Run the command

df -h

Check whether /dev/vdb1 can be automatically mounted:

Unmount /dev/vdb1: Run the command

umount /dev/vdb1

View the mount information: Run the mount command. If the uninstallation is successful, there will be no /dev/vdb1 information in the returned result.

Automatically mount /dev/vdb1: Run the command

mount -a

View the mount information: Run the mount command. If the automatic mounting is successful, the returned result will contain information about /dev/vdb1.

The above is all the content of this introduction. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Linux CentOS server installation and initial configuration tutorial
  • Solution to the error in initializing MySQL database on Linux
  • How to initialize Linux partitions as physical volumes and add physical volumes to volume groups
  • A brief analysis of the initialization configuration of the Linux system
  • Share a simple Linux server initialization Shell script

<<:  Detailed explanation of the implementation of regular backup of MySQL database tables

>>:  How to write asynchronous tasks in modern JavaScript

Blog    

Recommend

Windows Server 2016 Standard Key activation key serial number

I would like to share the Windows Server 2016 act...

What to do if you forget the initial password of MySQL on MAC

The solution to forgetting the initial password o...

How to implement on-demand import and global import in element-plus

Table of contents Import on demand: Global Import...

Apply provide and inject to refresh Vue page method

Table of contents Method 1: Call the function dir...

How to locate MySQL slow queries

Preface I believe that everyone has had experienc...

Detailed description of the function of new in JS

Table of contents 1. Example 2. Create 100 soldie...

Complete steps to achieve high availability with nginx combined with keepalived

Preface In order to meet the high availability of...

Encapsulate the navigation bar component with Vue

Preface: Fully encapsulating a functional module ...

Analysis of JavaScript's event loop mechanism

Table of contents Preface: 1. Reasons for the eve...

IE6 BUG and fix is ​​a preventive strategy

Original article: Ultimate IE6 Cheatsheet: How To...

Use a table to adjust the format of the form controls to make them look better

Because I want to write a web page myself, I am al...

Sample code for implementing history in vuex

I have recently been developing a visual operatio...

How to achieve 3D dynamic text effect with three.js

Preface Hello everyone, this is the CSS wizard - ...

How to insert weather forecast into your website

We hope to insert the weather forecast into the w...