当前位置: 首页 > article >正文

ubuntu22.04磁盘挂载(多磁盘和单磁盘挂载)

多磁盘挂载到同一个目录

# 如果没有安装逻辑卷管理系统工具
sudo apt install lvm2


# 查看磁盘分区
sudo fdisk -l


# 新建物理卷
sudo pvcreate /dev/nvme0n1 /dev/nvme1n1 


# 查看现有物理卷信息
sudo  pvdisplay

# 新建物理卷
sudo vgcreate dnyjy_vg  /dev/nvme0n1 /dev/nvme1n1


# 新建逻辑卷
sudo lvcreate -n dnyjy_lv -l 100%FREE dnyjy_vg

user@user:~$ sudo lvcreate -n dnyjy_lv -l 100%FREE dnyjy_vg
  Logical volume "dnyjy_lv" created.
user@user:~$ sudo fdisk -l
Disk /dev/loop0: 59.75 MiB, 62652416 bytes, 122368 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 59.77 MiB, 62676992 bytes, 122416 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 77.38 MiB, 81137664 bytes, 158472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 33.71 MiB, 35344384 bytes, 69032 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme0n1: 1.75 TiB, 1920383410176 bytes, 3750748848 sectors
Disk model: RP2A21T9RK004LX                         
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme1n1: 1.75 TiB, 1920383410176 bytes, 3750748848 sectors
Disk model: RP2A21T9RK004LX                         
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 893.75 GiB, 959656755200 bytes, 1874329600 sectors
Disk model: MR9560-8i       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disklabel type: gpt
Disk identifier: 510C23CC-F528-412B-940F-9E9C4553B9DA

Device       Start        End    Sectors   Size Type
/dev/sda1     2048    2203647    2201600     1G EFI System
/dev/sda2  2203648    4300799    2097152     1G Linux filesystem
/dev/sda3  4300800 1874327551 1870026752 891.7G Linux filesystem


Disk /dev/mapper/dnyjy_vg-dnyjy_lv: 3.49 TiB, 3840757727232 bytes, 7501479936 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

# 格式化分区 ext4

sudo mkfs.ext4  /dev/mapper/dnyjy_vg-dnyjy_lv

user@user:~$ sudo mkfs.ext4  /dev/mapper/dnyjy_vg-dnyjy_lv
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done                            
Creating filesystem with 937684992 4k blocks and 234422272 inodes
Filesystem UUID: dbbfcfd7-7162-4ed6-9dab-13cdac888a27
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done


# 挂载到目录
 sudo mount /dev/mapper/dnyjy_vg-dnyjy_lv /home/
# 查看
df -h


# 在/etc/fstab末尾添加挂载信息,实现自动挂载:

sudo vi /etc/fstab

/dev/mapper/dnyjy_vg-dnyjy_lv ext4 defaults 0 0


 单磁盘挂载

sudo fdisk -l

sudo mkfs -t ext4 /dev/nvme0n1

 sudo mount -t ext4 /dev/nvme0n1 /home

sudo vim /etc/fstab 文本最后增加“/dev/nvme0n1 /home ext4 defaults 0 0”

备注:如果重复以上步骤挂载第二块磁盘,那第一个挂载的磁盘会被覆盖,通过df -h可查看到


http://www.kler.cn/a/323887.html

相关文章:

  • STM32 学习笔记-----STM32 的启动过程
  • 前后端、网关、协议方面补充
  • SystemVerilog学习——构造函数new
  • MYSQL 精通索引【快速理解】
  • js像循环数组那样循环一个数字,Array.from()
  • 单片机智能家居火灾环境安全检测
  • 讯飞星火编排创建智能体学习(一)最简单的智能体构建
  • 什么是触发器(Trigger)?触发器何时会被触发?
  • MYSQL(学习笔记)
  • K8s flink-operator 例子
  • [大语言模型-论文精读] Diffusion Model技术-通过时间和空间组合扩散模型生成复杂的3D人物动作
  • k8s中,服务的自动注册、自动感知、负载均衡,三个功能的含义及测试验证
  • 前端面试题(十)
  • 树脂法提纯牛胆汁
  • 三相自激感应发电机瞬态过程仿真分析
  • 工具探讨?
  • 【计算机网络 - 基础问题】每日 3 题(二十八)
  • FortiOS SSL VPN 用户访问权限配置
  • HBase 性能优化的高频面试题及答案
  • 网络资源模板--Android Studio 宿舍管理系统
  • 线上报名小程序怎么做
  • Spring--boot自动配置原理案例--阿里云--starter
  • C高级(Day21)
  • 【吊打面试官系列-MySQL面试题】实践中如何优化 MySQL?
  • 基于单片机的指纹打卡系统
  • 视频分割怎么弄?国内外Top 7视频剪辑软件大盘点,新媒体必看!