挂载xfs磁盘
# 磁盘初始化 [root@localhost ~]# 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): p Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0xfdf10f13 Device Boot Start End Blocks Id System 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-41943039, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): 10G Value out of range. Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G Partition 1 of type Linux and of size 10 GiB is set Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (20973568-41943039, default 20973568): Using default value 20973568 Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): Using default value 41943039 Partition 2 of type Linux and of size 10 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. # 磁盘格式化XFS [root@localhost ~]# mkfs.xfs /dev/sdb2 meta-data=/dev/sdb2 isize=512 agcount=4, agsize=655296 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=2621184, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@localhost ~]# mkfs.xfs /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=655360 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=2621440, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 f[root@localhost ~]# blkid /dev/sdb1 /dev/sdb1: UUID="bb907eb7-27a4-4851-801e-77e6e22c84b9" TYPE="xfs" [root@localhost ~]# blkid /dev/sdb2 /dev/sdb2: UUID="2595392c-1380-4e71-8c8a-dbd56b9f242e" TYPE="xfs" [root@localhost ~]# # 使用UUID,是为了防止服务器重启磁盘设备名会变化 [root@localhost ~]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Thu Mar 9 09:52:36 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/cl-root / xfs defaults 0 0 UUID=9f06433e-f33c-457a-912e-fcbb8d3daef3 /boot xfs defaults 0 0 /dev/mapper/cl-swap swap swap defaults 0 0 UUID="bb907eb7-27a4-4851-801e-77e6e22c84b9" /data xfs defaults 0 0 UUID="2595392c-1380-4e71-8c8a-dbd56b9f242e" /backup xfs defaults 0 0 # 挂载 [root@localhost ~]# mount -a # 检查 [root@localhost ~]# df -HT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/cl-root xfs 19G 1.5G 17G 9% / devtmpfs devtmpfs 501M 0 501M 0% /dev tmpfs tmpfs 512M 0 512M 0% /dev/shm tmpfs tmpfs 512M 7.0M 506M 2% /run tmpfs tmpfs 512M 0 512M 0% /sys/fs/cgroup /dev/sda1 xfs 1.1G 146M 919M 14% /boot tmpfs tmpfs 103M 0 103M 0% /run/user/0 /dev/sdb1 xfs 11G 34M 11G 1% /data /dev/sdb2 xfs 11G 34M 11G 1% /backup