linux服务器新增固态盘并挂载到指定目录

[root@hiacube-worker-1-0002 apache-cassandra-2.1.9]# fdisk -l    #查看磁盘

Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x000bcb4e

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048   209715166   104856559+  83  Linux

Disk /dev/vdb: 32.2 GB, 32212254720 bytes, 62914560 sectors     #/dev/vdb没有创建分区
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@hiacube-worker-1-0002 apache-cassandra-2.1.9]# fdisk /dev/vdb  #给/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 0x12a729d2.

Command (m for help): n            #输入n,选择分区类型 p:逻辑分区  e:扩展分区 
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p              #选择逻辑分区
Partition number (1-4, default 1): 1   #默认1即可
First sector (2048-62914559, default 2048):      #什么都不输入,直接回车
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-62914559, default 62914559): +30GB #分配30GB
Partition 1 of type Linux and of size 28 GiB is set

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@hiacube-worker-1-0002 apache-cassandra-2.1.9]# fdisk -l     #查看磁盘

Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x000bcb4e

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048   209715166   104856559+  83  Linux

Disk /dev/vdb: 32.2 GB, 32212254720 bytes, 62914560 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: 0x12a729d2

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048    58595327    29296640   83  Linux
[root@hiacube-worker-1-0002 apache-cassandra-2.1.9]# mkfs.ext4 /dev/vdb1   #格式化新硬盘刚刚分配的分区/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
1831424 inodes, 7324160 blocks
366208 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2155872256
224 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000

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

[root@hiacube-worker-1-0002 apache-cassandra-2.1.9]# mkdir /ssd     #在根目录下创建ssd路径
[root@hiacube-worker-1-0002 apache-cassandra-2.1.9]# mount /dev/vdb1 /ssd   #将新的分区挂载到/ssd路径
[root@hiacube-worker-1-0002 apache-cassandra-2.1.9]# df -h          #查看磁盘占用
Filesystem                            Size  Used Avail Use% Mounted on
/dev/vda1                              99G  3.0G   91G   4% /
devtmpfs                               16G     0   16G   0% /dev
tmpfs                                  16G     0   16G   0% /dev/shm
tmpfs                                  16G  8.6M   16G   1% /run
tmpfs                                  16G     0   16G   0% /sys/fs/cgroup
tmpfs                                 3.2G     0  3.2G   0% /run/user/0
192.168.0.2:/data/elasticsearch/repo   59G  4.6G   52G   9% /data/elasticsearch/repo
/dev/vdb1                              28G   45M   26G   1% /ssd

 

你可能感兴趣的:(Linux)