客戶給了幾臺服務器,說500G硬盤,但到手操做的時候,使用命令查看,發現只有不到200的硬盤centos
[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
詢問了運維同事,給出了不關機新建分區的辦法,以下:app
(1)使用fdisk進入待分區的磁盤中(fdisk -l能夠查看只有一塊硬盤):運維
fdisk /dev/sda
ide
(2)新增一個主分區:p --> n --> 三次enter默認 --> p --> w
code
(3)刷新sda分區表:partprobe
it
(4)對剛分好分區的磁盤格式化:mkfs.ext3 /dev/sda3
test
(5)建立掛載點:mkdir /test
sed
(6)查看UUID:blkid
map
(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