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