linux系统,CentOs7加新硬盘

1,打开Vmware软件,添加一块新的硬盘,然后一直下一步。

  

 2、通过CRT等终端软件,连接到机器

  [root@Mysql ~]# lsblk    //检查一下硬盘分区信息

  [root@Mysql ~]# lsblk
  NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
  sda 8:0 0 20G 0 disk
  ├─sda1 8:1 0 1G 0 part /boot
  └─sda2 8:2 0 19G 0 part
  ├─centos-root 253:0 0 17G 0 lvm /
  └─centos-swap 253:1 0 2G 0 lvm [SWAP]
  sdb 8:16 0 100G 0 disk
  └─sdb1 8:17 0 100G 0 part /root/back
  sr0 11:0 1 918M 0 rom

  可以看到我预挂载的盘名为sdb,大小100G

3、fdisk sdb 进行分区,输入m可以看到帮助信息 

  [root@Mysql ~]# fdisk /dev/sdb
  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.


  Command (m for help): m
  Command action
  a toggle a bootable flag
  b edit bsd disklabel
  c toggle the dos compatibility flag
  d delete a partition
  g create a new empty GPT partition table
  G create an IRIX (SGI) partition table
  l list known partition types
  m print this menu
  n add a new partition
  o create a new empty DOS partition table
  p print the partition table
  q quit without saving changes
  s create a new empty Sun disklabel
  t change a partition's system id
  u change display/entry units
  v verify the partition table
  w write table to disk and exit
  x extra functionality (experts only)

  Command (m for help):

4、输入 n 然后 e 是扩展分区,p 是主分区,我们输入 p

  

 5、格式化分区 

  [root@Mysql ~]# mkfs.ext4 /dev/sdb1
  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
  6553600 inodes, 26214144 blocks
  1310707 blocks (5.00%) reserved for the super user
  First data block=0
  Maximum filesystem blocks=2174746624
  800 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

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

6、挂载分区 

[root@Mysql ~]# mount /dev/sdb1 /root/back/
[root@Mysql ~]# df -Th
  Filesystem Type Size Used Avail Use% Mounted on
  /dev/mapper/centos-root xfs 17G 3.3G 14G 20% /
  devtmpfs devtmpfs 898M 0 898M 0% /dev
  tmpfs tmpfs 910M 0 910M 0% /dev/shm
  tmpfs tmpfs 910M 9.5M 901M 2% /run
  tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
  /dev/sda1 xfs 1014M 146M 869M 15% /boot
  tmpfs tmpfs 182M 0 182M 0% /run/user/0
  /dev/sdb1 ext4 99G 61M 94G 1% /root/back

 7、写入配置文件

  [root@Mysql ~]# vi /etc/fstab

  

  /dev/sdb1挂载到 /back ,硬盘格式为ext4  后面的部分参照上面的配置就好了。 

付出是用来忘记的,回报时悄然而至的。不要让梦想,只是梦想!!!
原文地址:https://www.cnblogs.com/SliverLee/p/11856715.html