几品飞车|XFS文件系统的备份、恢复、修复

XFS文件系统是硅谷图形公司(Silicon Graphics Inc,简称SGI)开发的用于IRIX(一个UNIX操作系统)的文件系统 , 后将XFS移植到Linux操作系统上 。 XFS是高级日志文件系统 , 其特点极具伸缩性 , 同时也很健壮 。 2000年5月XFS通过GNU通用公共许可证移植到Linux系统上 , 通过十多年的不断修改已经成为一款非常成熟的文件系统 。 在多项针对XFS的性能测试上 , XFS都取得了不俗的成绩 , 高并发环境下甚至已经超过ext4 。
一、XFS文件系统的备份与恢复
XFS文件系统提供了整个分区备份的工具xfsdump供用户使用 , 用户可以在不借助第三方软件的情况下对XFS文件系统上的数据实施备份 。
创建XFS分区及测试文件
[root@localhost ~]# ls /dev/sd*/dev/sda/dev/sda1/dev/sda2/dev/sdb[root@localhost ~]# fdisk /dev/sdbWelcome 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): pDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x08a5199dDevice BootStartEndBlocksIdSystemCommand (m for help): nPartition type:pprimary (0 primary, 0 extended, 4 free)eextendedSelect (default p): pFirst sector (2048-41943039, default 2048): Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +1GPartition 1 of type Linux and of size 1 GiB is setCommand (m for help): pDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x08a5199dDevice BootStartEndBlocksIdSystem/dev/sdb120482099199104857683LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.[root@localhost ~]# partprobeWarning: Unable to open /dev/sr0 read-write (Read-only file system)./dev/sr0 has been opened read-only.[root@localhost ~]# ls /dev/sd*/dev/sda/dev/sda1/dev/sda2/dev/sdb/dev/sdb1[root@localhost ~]# mkfs.xfs -f /dev/sdb1meta-data=http://kandian.youth.cn/dev/sdb1isize=512agcount=4, agsize=65536 blks=sectsz=512attr=2, projid32bit=1=crc=1finobt=0, sparse=0data=bsize=4096blocks=262144, imaxpct=25=sunit=0swidth=0 blksnaming=version 2bsize=4096ascii-ci=0 ftype=1log=internal logbsize=4096blocks=2560, version=2=sectsz=512sunit=0 blks, lazy-count=1realtime =noneextsz=4096blocks=0, rtextents=0[root@localhost ~]# blkid /dev/sdb1/dev/sdb1: UUID="61a5e59d-92d3-458d-ac09-7d945469cda6" TYPE="xfs" [root@localhost ~]# mkdir /file[root@localhost ~]# echo "/dev/sdb1 /file xfs defaults 0 0" >> /etc/fstab [root@localhost ~]# mount -a[root@localhost ~]# df -hFilesystemSizeUsed Avail Use% Mounted on/dev/mapper/rhel-root17G1.9G16G12% /devtmpfs901M0901M0% /devtmpfs912M0912M0% /dev/shmtmpfs912M8.7M903M1% /runtmpfs912M0912M0% /sys/fs/cgroup/dev/sr03.8G3.8G0 100% /yum/dev/sda11014M143M872M15% /boottmpfs183M0183M0% /run/user/0/dev/sdb11014M33M982M4% /file[root@localhost ~]# cd /file/[root@localhost file]# ls[root@localhost file]# touch file{1..100}[root@localhost file]# lsfile1file16file23file30file38file45file52file6file67file74file81file89file96file10file17file24file31file39file46file53file60file68file75file82file9file97file100file18file25file32file4file47file54file61file69file76file83file90file98file11file19file26file33file40file48file55file62file7file77file84file91file99file12file2file27file34file41file49file56file63file70file78file85file92file13file20file28file35file42file5file57file64file71file79file86file93file14file21file29file36file43file50file58file65file72file8file87file94file15file22file3file37file44file51file59file66file73file80file88file95


推荐阅读