linux磁盘起点不是2048,Linux如何将未分配的硬盘挂载出来

情景说明

客户给了几台服务器,说500G硬盘,但到手操作的时候,使用命令查看,发现只有不到200的硬盘

[root@localhost ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 50G 6.8G 44G 14% /

devtmpfs 63G 0 63G 0% /dev

tmpfs 63G 88K 63G 1% /dev/shm

tmpfs 63G 272M 63G 1% /run

tmpfs 63G 0 63G 0% /sys/fs/cgroup

/dev/mapper/centos-home 48G 6.7G 41G 15% /home

/dev/sda1 497M 158M 340M 32% /boot

tmpfs 13G 24K 13G 1% /run/user/0

再使用fdisk查看,发现的确是500G硬盘,但挂载的只有100多

[root@localhost ~]# fdisk -l

Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 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: 0x000a3e10

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 1026047 512000 83 Linux

/dev/sda2 1026048 209715199 104344576 8e Linux LVM

Disk /dev/mapper/centos-root: 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 /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 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/mapper/centos-home: 50.9 GB, 50944016384 bytes, 99500032 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

解决办法

询问了运维同事,给出了不关机新建分区的办法,如下:

(1)使用fdisk进入待分区的磁盘中(fdisk -l可以查看只有一块硬盘):

fdisk /dev/sda

(2)新增一个主分区:p --> n --> 三次enter默认 --> p --> w

(3)刷新sda分区表:partprobe

(4)对刚分好分区的磁盘格式化:mkfs.ext3 /dev/sda3

(5)创建挂载点:mkdir /test

(6)查看UUID:blkid

(7)更改/etc/fstab文件,如:echo "/dev/sda3 /test ext3 defaults 1 1 " >> /etc/fstab

(8)挂载文件系统:mount -a

再次使用fdisk能看到多了一个分区

[root@localhost ~]# fdisk -l

Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 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: 0x000a3e10

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 1026047 512000 83 Linux

/dev/sda2 1026048 209715199 104344576 8e Linux LVM

/dev/sda3 209715200 1048575999 419430400 83 Linux

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值