美文网首页阿里云程序员
centos7 挂载新磁盘

centos7 挂载新磁盘

作者: 风静花犹落 | 来源:发表于2020-07-18 14:12 被阅读0次

查看磁盘

[root@localhost ~]# fdisk -l

Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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 label type: dos
Disk identifier: 0x000c81ed

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048   104857566    52427759+  83  Linux

Disk /dev/vdb: 2199.0 GB, 2199023255552 bytes, 4294967296 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

磁盘/dev/vdb尚有2199GB未分配

查看分区

[root@localhost ~]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  7.8G     0  7.8G   0% /dev
tmpfs          tmpfs     7.8G     0  7.8G   0% /dev/shm
tmpfs          tmpfs     7.8G  488K  7.8G   1% /run
tmpfs          tmpfs     7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/vda1      ext4       50G  2.0G   45G   5% /
tmpfs          tmpfs     1.6G     0  1.6G   0% /run/user/0

磁盘/dev/vdb实际并没有挂载

磁盘分区

注意:

# 执行"fdisk /dev/vdb"后,出现"Command (m for help)"提示时,依次输入下面指令
n -> p -> 1 -> 回车 -> 回车 -> w

详情:

[root@localhost ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.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
Building a new DOS disklabel with disk identifier 0x11e106cf.

WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID 
partition table format (GPT).


Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-4294967295, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): 
Using default value 4294967294
Partition 1 of type Linux and of size 2 TiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

说明:

n:添加新分区

p:设为主分区

1: 分区序号

两个回车指是开始和结束的磁盘大小;

w:写入磁盘

格式分区

[root@localhost ~]# mkfs.ext4 /dev/vdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
134217728 inodes, 536870655 blocks
26843532 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
16384 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000, 214990848, 512000000

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

挂载磁盘

mkdir /mnt
mount /dev/vdb1 /mnt

确认磁盘

[root@localhost ~]# fdisk -l 

Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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 label type: dos
Disk identifier: 0x000c81ed

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048   104857566    52427759+  83  Linux

Disk /dev/vdb: 2199.0 GB, 2199023255552 bytes, 4294967296 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 label type: dos
Disk identifier: 0x11e106cf

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048  4294967294  2147482623+  83  Linux

确认分区

[root@localhost ~]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  7.8G     0  7.8G   0% /dev
tmpfs          tmpfs     7.8G     0  7.8G   0% /dev/shm
tmpfs          tmpfs     7.8G  492K  7.8G   1% /run
tmpfs          tmpfs     7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/vda1      ext4       50G  2.0G   45G   5% /
tmpfs          tmpfs     1.6G     0  1.6G   0% /run/user/0
/dev/vdb1      ext4      2.0T   81M  1.9T   1% /mnt

开机启动

echo "/dev/vdb1 /mnt ext4 defaults 0 0" >> /etc/fstab

相关文章

  • centos7 挂载新磁盘

    查看磁盘 磁盘/dev/vdb尚有2199GB未分配 查看分区 磁盘/dev/vdb实际并没有挂载 磁盘分区 注意...

  • 在新买的磁盘如何挂载到我们的服务器上呢

    1.查看目前磁盘 2.格式化新磁盘 3.挂载磁盘需要先创建一个目录 4.挂载磁盘 5.为了避免重启机器时重新挂载,...

  • Linux中初始化一个新磁盘

    Linux中挂载一个新磁盘后,创建分区并自动挂载的方法: 在线扩容一个已有磁盘

  • Centos7创建LVM磁盘管理

    转载请注明出处,谢谢。 环境介绍 在centos7下需要挂载两个新的磁盘。为了方便后续的扩容方便,决定将这其设置为...

  • Linux挂载磁盘空间

    Linux挂载磁盘空间 (1)查看磁盘空间 (2)查看硬盘及分区信息 (3)格式化新分区 (4)将磁盘挂载在/po...

  • centos7 挂载磁盘

    查看一下可用磁盘 /dev/sdb 就是我们要挂载的磁盘 进行磁盘分区 再次查看磁盘分区 如图所示磁盘分区成功,...

  • linux 挂载磁盘与分区lvm逻辑卷

    linux磁盘分区与挂载 1.1查看分区挂载情况,命令: 1.2创建新的磁盘分区 1.3保存分区表 1.4查看创建...

  • fuse挂载Ceph磁盘

    本文主要记录在centos 7上面如何通过fuse挂载ceph磁盘到本地。 CentOS7(测试于CentOS 7...

  • Mac

    解决Mac挂载ntfs磁盘readonly 找到磁盘设备号 弹出磁盘 以读写权限重新挂载磁盘

  • ubuntu 挂载新磁盘

    查看空闲磁盘 可以看到 sdc是空闲的。 创建分区 如果把整个盘作为新的分区的话。输入n 一直回车即可。最后输入w...

网友评论

    本文标题:centos7 挂载新磁盘

    本文链接:https://www.haomeiwen.com/subject/kagxkktx.html