空白硬盘(不分区)挂载方式

1、查看所有硬盘状况

fdisk -l

Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 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
Disklabel type: dos
Disk identifier: 0x586e0d2f

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 83886046 83883999  40G 83 Linux


Disk /dev/vdc: 1 TiB, 1099511627776 bytes, 2147483648 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

2、格式化新加硬盘

mkfs.ext4 /dev/vdc

# 使用ext4格式化空白硬盘 filesystem ext4
mke2fs 1.42.13 (17-May-2015)
/dev/vdc contains a ext4 file system
    last mounted on Thu Dec 14 07:16:20 2017
Proceed anyway? (y,n) y
Creating filesystem with 268435456 4k blocks and 67108864 inodes
Filesystem UUID: 9c12e85e-6f1f-4bfe-afa6-13fa0b37657c
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000, 214990848

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

3、修改/etc/fstab

vi /etc/fstab

uuid 是硬盘的唯一标识,而/dev/vda(b,c,d,e)是根据磁盘连接顺序来接入的,序号可能发生改变,uuid通过 blkid 查看
添加一行:

UUID=9c12e85e-6f1f-4bfe-afa6-13fa0b37657c /var/lib/elasticsearch ext4 defaults 0 0

4、使/etc/fstab生效

mount -a

你可能感兴趣的:(linux)