Linux添加新磁盘及挂载
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
·
目录
文章目录
查看磁盘
以 root用户登录,执行fdisk -lu查看所有磁盘信息
$ fdisk -lu

创建分区
进入磁盘/dev/sdb命令: fdisk /dev/sdb 输入m 查看命令帮助如下:
$ fdisk /dev/sdb
root@lt-PC:/# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x886fa276.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
输入 n 进行分区:

一定记得输入w才能保存分区更改
查看新增分区 /dev/sdb1
$ fdisk -l

格式化
$ mkfs.ext4 /dev/sdb1

挂载
建立/opt/app目录
$ mkdir /opt/app
挂载
$ mount /dev/sdb1 /opt/app
查看
$ df -h

配置开机自动挂载
$ vim /etc/fstab
后面追加一行:
/dev/sdb1(磁盘分区) /opt/app(挂载目录) ext4(文件格式)defaults 0 0
关注我

A beautiful web dashboard for Linux
最近提交(Master分支:3 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)