近期我们部门给服务器新装了centos系统,用SSD做了系统盘后,还需要挂载几块SAS硬盘做数据盘,最终效果是将SAS硬盘挂载到/home路径下。
挂载步骤:
步骤1、配置RAID模式
因为有4块SAS物理硬盘,所以先将这4块硬盘配置成RAID5,生成一块虚拟硬盘。(注:具体要配置成RAID0、RAID1、RAID5还是RAID10,要看实际的物理硬盘数量、以及自己的实际需求,在上篇博文里有关于RAID的简单介绍服务器重装思路)
配置方法:重启设备,进入RAID配置界面,然后选定要配置的RAID模式(0、1、5、10等),然后选定要将哪几块物理硬盘组成虚拟硬盘。
注意:dell和hp的具体操作细节、界面不同,但是思路都一致,可以根据自己情况网上查教程。
步骤2、开机后挂载
流程:
(1)开机进入系统;
(2)fdisk -l命令查询现有磁盘情况;
(3)找到未挂载的虚拟硬盘,看清楚是sda、还是sdb;
(4)格式化未挂载的虚拟硬盘;
(5)mount命令挂载硬盘;
(6)挂载信息写入系统文件,使得以后重启设备也不会丢失挂载信息。
以下为具体的挂载过程:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 63G 12M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda3 848G 5.6G 800G 1% /
/dev/sda2 477M 135M 313M 31% /boot
/dev/sda1 200M 12M 189M 6% /boot/efi
tmpfs 13G 8.0K 13G 1% /run/user/42
tmpfs 13G 20K 13G 1% /run/user/0
[root@localhost ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 960.2 GB, 960163569664 bytes, 1875319472 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk label type: gpt
Disk identifier: 5BD1B4B5-0CBE-454D-A5D0-C8EE04FB2F3F
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 1435647 500M Microsoft basic
3 1435648 1808209919 861.6G Microsoft basic
4 1808209920 1875318783 32G Linux swap
Disk /dev/sdb: 2400.4 GB, 2400442998784 bytes, 4688365232 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
[root@localhost ~]# mkfs.ext4 /dev/sdb
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=64 blocks, Stripe width=64 blocks
146513920 inodes, 586045654 blocks
29302282 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2734686208
17885 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, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 960.2 GB, 960163569664 bytes, 1875319472 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk label type: gpt
Disk identifier: 5BD1B4B5-0CBE-454D-A5D0-C8EE04FB2F3F
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 1435647 500M Microsoft basic
3 1435648 1808209919 861.6G Microsoft basic
4 1808209920 1875318783 32G Linux swap
Disk /dev/sdb: 2400.4 GB, 2400442998784 bytes, 4688365232 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 63G 11M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda3 848G 5.6G 800G 1% /
/dev/sda2 477M 135M 313M 31% /boot
/dev/sda1 200M 12M 189M 6% /boot/efi
tmpfs 13G 24K 13G 1% /run/user/0
[root@localhost ~]# cd /home/
[root@localhost home]# ls
hisense
[root@localhost home]# mkdir /tmp/home
[root@localhost home]# cp -ardp /home/* /tmp/home/
[root@localhost home]# mount /dev/sdb /home
[root@localhost home]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 63G 11M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda3 848G 5.6G 800G 1% /
/dev/sda2 477M 135M 313M 31% /boot
/dev/sda1 200M 12M 189M 6% /boot/efi
tmpfs 13G 24K 13G 1% /run/user/0
/dev/sdb 2.2T 85M 2.1T 1% /home
[root@localhost home]# ls
hisense
[root@localhost home]# cd
[root@localhost ~]# cd /home/
[root@localhost home]# ls
lost+found
[root@localhost home]# rm -rf lost+found/
[root@localhost home]# ls
[root@localhost home]# cp /tmp/home/* /home/ -ardp
[root@localhost home]# ls
hisense
[root@localhost home]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 12M 63G 1% /dev/shm
tmpfs 63G 11M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda3 848G 5.7G 800G 1% /
/dev/sda2 477M 135M 313M 31% /boot
/dev/sda1 200M 12M 189M 6% /boot/efi
tmpfs 13G 36K 13G 1% /run/user/0
/dev/sdb 2.2T 89M 2.1T 1% /home
[root@localhost home]# vim /etc/fstab
[root@localhost home]# blkid
/dev/sda1: SEC_TYPE="msdos" UUID="FDFB-0669" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="61f50c86-9c0c-4ae8-b3f1-b7bda44a902b"
/dev/sda2: UUID="17e6d41f-65f7-4a20-b655-5ab432a6cfd0" TYPE="ext4" PARTUUID="7e67db35-49f3-4ec6-a756-419b43081531"
/dev/sda3: UUID="14dfb99e-f25d-4fcc-88dd-7e254cbccd2d" TYPE="ext4" PARTUUID="6040bbf2-2bb5-469a-86c1-0387d07543ea"
/dev/sda4: UUID="233830e5-0859-4405-b147-553925ac0701" TYPE="swap" PARTUUID="63f1f587-2901-4035-86d2-38b98053e019"
/dev/sdb: UUID="20518a41-319e-4f3e-972d-a0de2499e89a" TYPE="ext4"
[root@localhost home]# blkid | tail -1
/dev/sdb: UUID="20518a41-319e-4f3e-972d-a0de2499e89a" TYPE="ext4"
[root@localhost home]# blkid | tail -1 >> /etc/fstab
[root@localhost home]# vim /etc/fstab
[root@localhost home]#
[root@localhost home]#
[root@localhost home]#
[root@localhost home]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether d4:f5:ef:0d:d6:dc brd ff:ff:ff:ff:ff:ff
3: eno6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether d4:f5:ef:0d:d6:dd brd ff:ff:ff:ff:ff:ff
4: eno7: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether d4:f5:ef:0d:d6:de brd ff:ff:ff:ff:ff:ff
5: eno8: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether d4:f5:ef:0d:d6:df brd ff:ff:ff:ff:ff:ff
6: enp1s0f4u4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 42:c3:96:d7:f0:31 brd ff:ff:ff:ff:ff:ff
7: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:f2:d9:e2 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
8: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:f2:d9:e2 brd ff:ff:ff:ff:ff:ff
[root@localhost home]#
[root@localhost home]#
[root@localhost home]#
[root@localhost home]#
[root@localhost home]# cd
[root@localhost ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=65736484k,nr_inodes=16434121,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_prio,net_cls)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuacct,cpu)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda3 on / type ext4 (rw,relatime,seclabel,stripe=64,data=ordered)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16706)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
/dev/sda2 on /boot type ext4 (rw,relatime,seclabel,stripe=256,data=ordered)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=13150492k,mode=700)
gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sdb on /home type ext4 (rw,relatime,seclabel,stripe=64,data=ordered)
[root@localhost ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=65736484k,nr_inodes=16434121,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_prio,net_cls)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuacct,cpu)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda3 on / type ext4 (rw,relatime,seclabel,stripe=64,data=ordered)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=16706)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
/dev/sda2 on /boot type ext4 (rw,relatime,seclabel,stripe=256,data=ordered)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=13150492k,mode=700)
gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sdb on /home type ext4 (rw,relatime,seclabel,stripe=64,data=ordered)
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 12M 63G 1% /dev/shm
tmpfs 63G 11M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda3 848G 5.7G 800G 1% /
/dev/sda2 477M 135M 313M 31% /boot
/dev/sda1 200M 12M 189M 6% /boot/efi
tmpfs 13G 36K 13G 1% /run/user/0
/dev/sdb 2.2T 89M 2.1T 1% /home
[root@localhost ~]#