Ubuntu挂载硬盘分区

查看硬盘信息

cat /proc/partitions

example

   7        0      91140 loop0
   7        1      18412 loop1
 259        0  524288000 nvme0n1
 259        1   20971520 nvme1n1
 259        2   20970479 nvme1n1p1

分区,选择文件系统

mkfs.ext4 /dev/nvme0n1

ps:ext4 为常用,fat,msdos为windows的文件系统

mkfs         mkfs.btrfs   mkfs.ext2    mkfs.ext4    mkfs.minix   mkfs.ntfs    mkfs.xfs
mkfs.bfs     mkfs.cramfs  mkfs.ext3    mkfs.fat     mkfs.msdos   mkfs.vfat

example

mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 131072000 4k blocks and 32768000 inodes
Filesystem UUID: 67c848cd-7343-47d0-85d7-50f1b47e575d
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
    102400000

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

新建文件夹,挂载硬盘

mkdir -p /mnt/sdb/
mount /dev/nvme0n1 /mnt/sdb/

查看挂载信息

df -h

example

Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.1G  760K  3.1G   1% /run
/dev/nvme1n1p1   20G  1.1G   19G   6% /
tmpfs            16G     0   16G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/loop0       90M   90M     0 100% /snap/core/7713
/dev/loop1       18M   18M     0 100% /snap/amazon-ssm-agent/1480
tmpfs           3.1G     0  3.1G   0% /run/user/1000
/dev/nvme0n1    492G   73M  467G   1% /mnt/sdb
ls /mnt/sdb

example

root@ip-172-31-33-18:/mnt/sdb# ls
lost+found

推荐阅读更多精彩内容