Mount the disk in a directory under Ubuntu 18.04

Mount the disk in a directory under Ubuntu 18.04

Introduction

This article records how to mount a disk to the desired directory in Ubuntu 18.04 desktop system. Please refer to the online tutorial for the content. This is my own operation record.

View all current disk information

Command: sudo fdisk -l



From the listed information, we can see that the two hard drives in the computer are sda ​​and sdb. sdb is the solid-state drive with win10 system and win10 software installed, sda is installed with Linux system, sda3 and sda4 are used for file storage under win10, with the "Microsoft Basic Data" logo; the remaining disks are used for Linux, sda1 and sda2 are used as Linux file storage, with the "Linux Basic Data" logo. Now we are going to mount sda2 to the /home directory, still as a storage disk, to expand the space of /home.

Create a mount point

In /home/ username Create a mount point, that is, create an empty folder. Since you are using the desktop version system, you can do it in /home/ username Create a new folder directly in the directory, or use the command line to create it

cd /home/ username
mkdir Folder Name

Unmount Disk

If you want to mount an existing disk to a directory, you need to unmount the disk from the system first. For desktop systems, you can uninstall the disk by opening the file manager -> Show other locations -> right-clicking the corresponding disk -> Uninstall option to complete the uninstallation of the current existing disk; or you can operate through the command line.
First use the command to view the current disk mount status

df -kh


Then execute the uninstall command

sudo umount /dev/sda2

Use the command again to check the current disk mount status and you can see that /dev/sda2 is no longer mounted.


Disk Mount

First use the command to view the UUID of /dev/sda2

sudo blkid /dev/sda2


To mount the disk, you need to edit the /etc/fstab file and use the command

sudo gedit /etc/fstab

According to the content format of the /etc/fstab file, add at the end: UUID=96d37587-bd18-4ab0-80e5-02d80ffa0b6a /home/liniuniu/usrdisk ext4 defaults 0 2 Save and exit.

The first column is UUID, the second column is the mount directory (the directory must be a blank directory), the third column is the file system type, the fourth column is the parameter, the fifth column 0 means no backup, and the last column must be 2 or 0 (unless the boot partition is 1)

Disk Mount

Execute the command to mount the disk

sudo mount -a

You can use the command to check the disk mount point again. The mount directory of the /dev/sda2 disk has become the newly created folder directory of Byte.

Summarize

The above is what I introduced to you about mounting the disk in a certain directory under Ubuntu 18.04. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • How to mount a 3T hard disk or a disk larger than 2T in Ubuntu
  • How to control the permissions of ordinary users when mounting ext4 formatted hard disk in Ubuntu 16.04
  • Detailed steps for Azure to mount a data disk to a Ubuntu virtual machine
  • Ubuntu is set to automatically mount all hard disk partitions at startup

<<:  Detailed explanation of the process of querying user permissions using mysql statements

>>:  The implementation of Youda's new petite-vue

Recommend

Why is it not recommended to use index as key in react?

1. Compare the old virtual DOM with the new virtu...

Sample code for implementing mysql master-slave replication in docker

Table of contents 1. Overview 1. Principle 2. Imp...

Understanding and application of JavaScript ES6 destructuring operator

Table of contents Preface The role of deconstruct...

How to use cc.follow for camera tracking in CocosCreator

Cocos Creator version: 2.3.4 Demo download: https...

JS achieves five-star praise case

This article shares the specific code of JS to ac...

MySQL full backup and quick recovery methods

A simple MySQL full backup script that backs up t...

js realizes the magnifying glass function of shopping website

This article shares the specific code of js to re...

MySQL backup and recovery design ideas

background First, let me explain the background. ...