Mount the disk in a directory under Ubuntu 18.04

Introduction

Record the implementation of mounting a certain disk to the directory you want under the Ubuntu 18.04 desktop version system. Refer to the online tutorial for the content. Here is the record of your own operation.

View all current disk information

Command: sudo fdisk -l

As can be seen from the listed information, the two hard drives in the computer are sda and sdb. sdb installs win10 system and software under win10 for solid state drive, sda installs Linux system, sda3 and sda4 are used for file storage under win10, with the logo of "microsoft basic data"; the rest are for Linux Used, sda1 and sda2 are used as Linux file storage, with the "Linux basic data" logo. Now we are ready to mount sda2 to the /home directory, which is still used as a storage disk and can expand the space of /home.

Create mount point

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

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 the desktop version of the system, you can uninstall the disk by opening the file manager -> show other locations -> right-click the corresponding disk -> uninstall option to complete the current disk uninstallation; or through the command line operation.
First use the command to view the current disk mounting situation

df -kh

Then execute the uninstall command

sudo umount /dev/sda2

Use the command again to view the current disk mounting situation 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 complete the disk mounting, you need to edit the /etc/fstab file, use the command as

sudo gedit /etc/fstab

Add at the end according to the content format of the /etc/fstab file: 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 is 0 means no backup, and the last column must be 2 Or 0 (unless the boot partition is 1)

Disk mount

Execute command to mount disk

sudo mount -a

You can check the disk mount point again through the command, and the mount directory of the /dev/sda2 disk has become the new folder directory of bytes.

Recommended Posts

Mount the disk in a directory under Ubuntu 18.04
Expand the disk size of Ubuntu under VMware
Resolve the problems encountered in the linux environment under ubuntu
Encountered in the process of building a virtual environment in ubuntu
How to map shared disk to window in linux under Ubuntu
Deploy the mail system under Ubuntu 19.10
How to extend the root directory of LVM under Ubuntu system
The locate file search command in Ubuntu16.04
Build the C++ compilation environment under ubuntu
Install Ubuntu 18.04 in the virtual machine VMware
Build a python development environment under Ubuntu
Disable the TinkPad touch screen in Ubuntu
Docker those things in the Ubuntu environment
Explain the list under Python multithreading in detail
Centos7.5 expands the space size under the root directory
Install the old version of seurat under Ubuntu
The solution to the failure to install .deb under Ubuntu 16.04
How to open the ubuntu system in win10
Install Python3 environment in a brand new Ubuntu
Problems encountered in pip tool installation under Ubuntu
Publish the node.js project under Ubuntu to heroku
The consequences of uninstalling python in ubuntu, very
Add a new project to SVN under Ubuntu
Introduction to the use of Hanlp in ubuntu
Turn off and turn on the firewall in ubuntu
Centos7 adjusts the size of the root directory mount partition
[Linux] ubuntu install configuration vsftpd and lock the directory
Install win7 and archlinux on hard disk under ubuntu
Installation and use of GDAL in Python under Ubuntu
Install ubuntu dual system under win10 (no U disk)
How to create a Python virtual environment in Ubuntu 14.04