Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to mount a disk in a directory in Ubuntu18.04

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to mount a disk in a directory in Ubuntu18.04. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Brief introduction

Record Ubuntu18.04 desktop version of the system to achieve a disk mounted to the desired directory, the content refer to the online tutorials, here for your own operation records.

View all current disk information

Command: sudo fdisk-l

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

Create a mount point

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

Cd / home/ user name

Mkdir folder name

Unmount disk

To mount an existing disk to a directory, you need to unmount the disk from the system. For desktop systems, you can uninstall the existing disk by opening File Manager-> Show other locations-> right-clicking the corresponding disk-> uninstall option, or through the command line operation.

First use the command to view the current disk mount

Df-kh

Then execute the uninstall command

Sudo umount / dev/sda2

Use the command again to check the current disk mount 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 mount, you need to edit the / etc/fstab file, using the command

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 02 save exit.

The first column is UUID, the second column is mount directory (this directory must be a blank directory), the third column is file system type, the fourth column is 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 view the disk mount point again with the command, and the mount directory of the / dev/sda2 disk has been changed to the byte new folder directory.

Thank you for reading! This is the end of this article on "how to mount a disk in a directory in Ubuntu18.04". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report