zoukankan      html  css  js  c++  java
  • How to mount a disk from terminal

    Acknowledgement to posts on https://askubuntu.com/questions/125257/how-do-i-add-an-additional-hard-drive

    1. Partition

    1.1 Find your disk

    Run the following command to find your disk. Note that sudo is required or there won't be any output.

    sudo blkid

    1.2 Format your disk (1) - create a partition

    If it is already formatted, you should see entry like /dev/sdb1 with UUID and PARTUUID settings. (not formatted properly if only UUID or PARTUUID is shown!) For example, you need to format your hdd with output like this:

    ...
    /dev/sdb: UUID="the UUID" TYPE="ext4"
    ...

     If your disk is not formatted, create a new partition:

     sudo cgdisk /dev/sdb

    Follow the instructions of cgdisk. Choose [New] and press enter to create new partition from free space. The default options are ok. Then cgdisk has results like this

    Part. #     Size        Partition Type            Partition Name
    ----------------------------------------------------------------
                1007.0 KiB  free space
       1        7.3 TiB     Linux filesystem

    Choose [write] and press enter. Input "yes" after you see

    Are you sure you want to write the partition table to disk? (yes or no): yes

    And then press [Quit].

    1.3 Format your disk (2) - formating

    Format the partitioned disk

    sudo mkfs -t ext4 /dev/sdb1

    The formatting takes about one minute. Then after you run `sudo blkid` again, you should be able to see both UUID and PARTUUID like this

    ...
    /dev/sdb1: UUID="...123..." TYPE="ext4" PARTUUID="...456..."
    ...

    2. Mount

    After you are done creating your partitions (it will be just one ext4 data partition after running the commands above), you need to permanently mount it.

    2.1 Create a mount point

    sudo mkdir /hdd

    2.2 Edit /etc/fstab

    Open `/etc/fstab` file with `root` permissions.

    sudo vim /etc/fstab

    Add following to the end of the file:

    UUID=[the generated UUID]    /hdd    ext4    defaults    0    0

     2.3 Mount partition

    Last step and you're done!

    sudo mount /hdd
  • 相关阅读:
    Python-Pandas库-DataFrame处理excel/csv表格
    Python-Pandas库-数据结构Series用法总结
    Python-yaml文件处理
    Python-全局配置文件(conf.ini)的读取与写入
    Python-面向对象经典习题
    Python-异常处理
    浅谈postman和jmeter的用法与区别
    性能测试——常用指标的认识
    性能测试——监控工具Grafana的介绍与使用
    ios自动化测试之Java + testng +maven + appium 框架及脚本编写和运行
  • 原文地址:https://www.cnblogs.com/cxxszz/p/15737923.html
Copyright © 2011-2022 走看看