How to mount mechanical hard disk on Linux

4 篇文章 0 订阅

See this article on my own blog https://dyingdown.github.io/2020/01/29/Mount-mechanical-hard-disk-on-Linux/

I’ve met a new problem recently: I switched into Linux but my Blog folder is under my mechanical hard disk. I want my Blog folder available to be achieved by command not manually. So to make this come true, I learned a word mount. By using mount, you can use my blog folder by command. There are three steps:

  1. create a new folder
  2. mount the disk
  3. make it mount automatically as long as booting Linux

What is mount

First, you need to know that all the things in Linux is represented as file directory. Your mechanical hard disk is not a folder. So you need to make it a folder in Linux. It’s like you wrap the disk using a folder, make it looks like a folder so that Linux can access it. That is how I understand Mount.

Mounting is a process by which the operating system makes files and directories on a storage device (such as hard drive, CD-ROM, or network share) available for users to access via the computer’s file system.[1]

In general, the process of mounting comprises operating system acquiring access to the storage medium; recognizing, reading, processing file system structure and metadata on it; before registering them to the virtual file system (VFS) component. ——Wikipedia

And the folder you use to wrap you disk is called Mount point.

Create a new directory

You can make it anywhere.
Take mine for example. I set the directory under /home/o_oyao directory.

See recent directory

type to see what directory you are in now.

pwd

I got:

/home/o_oyao

Create an new directory

using mkdir to create and rmdir to delete.
I want my directory under home/o_oyao and it’s name is Yao, so I typed:

mkdir Yao

There is no notification to show that you have successfully created the directory, to make sure it works, you can type command “ls” (no double quotes), to see all the directories.
If you want your dierectory to be somewhere else, check Absolute path and Relative path to see how to do.

Temporary mount

First type the following command to see what is the name of your disk.

df -h


So my disk name is sda2. Because the size of my disk is very large compared to other section.

So the command is:

sudo mount /dev/sda2 Yao

Now you open the directory you created, you can see all the things in your disk are now in the directory.

Permanent mount

Check the type of your file system

gparted

And it opens a new window.

So my type is “ntfs”. Yours might be “ext4”

Add a statement

type the following command:

sudo gedit /etc/fstab

open this file, and add a piece of data in it. If you know how to use vim, you can also type.

sudo vim /etc/fstab

I got this:

(UUID is the unique id of the file system, it can also be represented as directory)

add a new statement

/dev/sda2 /home/o_oyao/Yao ntfs defaults 0 2

It looks Like this:

Save it.

Restart

All done! Restart computer and check whether it works.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值