查看目前有哪些磁盘 执行命令:fdisk -l [root@dics-no ~]# fdisk -l Disk /dev/vda: 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 label type: dos Disk identifier: 0x0009480d Device Boot Start End Blocks Id System /dev/vda1 * 3129344 104857566 50864111+ 83 Linux Disk /dev/vdb: 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 [root@dics-no ~]# 目前有两块磁盘:/dev/vda 和 /dev/vdb 查看已挂在的磁盘有哪些 执行命令:df -h [root@dics-no ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 49G 1.9G 47G 4% / devtmpfs 16G 0 16G 0% /dev tmpfs 16G 0 16G 0% /dev/shm tmpfs 16G 8.4M 16G 1% /run tmpfs 16G 0 16G 0% /sys/fs/cgroup tmpfs 3.2G 0 3.2G 0% /run/user/0 [root@dics-no ~]# 执行df -h 后可以看到,已经挂载的磁盘为/dev/vda(即界面上显示的/dev/vda1),/dev/vdb目前尚未挂载 选择未挂载的磁盘进行挂载前的的准备 执行命令: fdisk /dev/vdb [root@dics-no ~]# fdisk /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 0xe1eccf6a. Command (m for help): 输入n回车后,根据提示,输入默认(每次提示default后面的值)值即可。最后出现Command(m for help): 时,输入w后回车 Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-1048575999, default 2048): 2048 Last sector, +sectors or +size{K,M,G} (2048-1048575999, default 1048575999): 1048575999 Partition 1 of type Linux and of size 500 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. 查看要挂载的目录所在的磁盘的文件格式 执行命令:df -T [root@dics-no iflytek]# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/vda1 xfs 50853868 1900516 48953352 4% / devtmpfs devtmpfs 16382332 0 16382332 0% /dev tmpfs tmpfs 16391056 0 16391056 0% /dev/shm tmpfs tmpfs 16391056 8524 16382532 1% /run tmpfs tmpfs 16391056 0 16391056 0% /sys/fs/cgroup tmpfs tmpfs 3278212 0 3278212 0% /run/user/0 [root@dics-no iflytek]# 我要挂载的目录在根目录上,上图可以看到根目录是在/dev/vda1上面的,它的文件格式为xfs。 格式化要挂载的磁盘分区(保持和挂载的位置的文件格式一致,即上一步说的文件格式) 执行命令: mkfs -t xfs -C /dev/vdb1 注:xfs为文件系统格式 /dev/vdb1 为要挂载的分区 [root@dics-no iflytek]# mkfs -t xfs -C /dev/vdb1 meta-data=/dev/vdb1 isize=256 agcount=4, agsize=32767936 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 data = bsize=4096 blocks=131071744, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =internal log bsize=4096 blocks=63999, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@dics-no iflytek]# 挂载分区 执行命令: mount /dev/vdb1 /iflytek [root@dics-no iflytek]# mount /dev/vdb1 /iflytek [root@dics-no iflytek]# [root@dics-no iflytek]# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/vda1 xfs 50853868 1900516 48953352 4% / devtmpfs devtmpfs 16382332 0 16382332 0% /dev tmpfs tmpfs 16391056 0 16391056 0% /dev/shm tmpfs tmpfs 16391056 8524 16382532 1% /run tmpfs tmpfs 16391056 0 16391056 0% /sys/fs/cgroup tmpfs tmpfs 3278212 0 3278212 0% /run/user/0 /dev/vdb1 xfs 524030980 32928 523998052 1% /iflytek [root@dics-no iflytek]# 然后执行df -T查看是否有/dev/vdb1的分区挂载到iflytek上面 至此,新磁盘挂载完成。 (责任编辑:IT) |