xfs_repair 原理

合集下载

xfs文件恢复原理

xfs文件恢复原理

xfs文件恢复原理
XFS(eXtended File System)是一种高性能的日志式文件系统,广泛用于许多Linux发行版中。

文件删除后,可以通过恢复工
具来恢复文件。

XFS文件系统的恢复原理主要包括以下几个步骤:
1. 寻找已经删除的文件
被删除的文件并没有真正删除,而是标记为可被覆盖。

因此,恢复文件的第一步是在文件系统中寻找被删除的文件。

2. 扫描文件系统
恢复工具会扫描整个XFS文件系统,包括未分配的数据块和
元数据区域,以寻找被删除文件的相关信息。

3. 恢复文件
一旦找到被删除的文件,恢复工具会尝试恢复文件。

如果文件块中的数据没有被覆盖,那么工具就可以直接恢复文件。

如果数据块已被覆盖,那么工具则会尝试重组文件,或是通过其他方式来恢复文件。

需要注意的是,XFS文件系统的日志功能可以帮助最小化文
件恢复所需的时间和努力。

这个功能在文件系统被意外意外关
机或出现其他意外情况时,可以快速地恢复数据,并使文件系统重新运行起来。

一次Linux下testdisk+gdisk恢复XFS文件系统及数据的经历

一次Linux下testdisk+gdisk恢复XFS文件系统及数据的经历

一次Linux下testdisk+gdisk恢复XFS文件系统及数据的经历硬盘之前状况,用gdisk进行硬盘分区(SATA标准,3.6T容量),1.6T+2.0T两个分区,然后用mkfs.xfs格式化分区,最后结果就是,GPT分区表+两个XFS文件系统的硬盘(/dev/sdb,/dev/sdb1,/dev/sdb2)我已无法确定引起这次硬盘错误的原因,但我确实这么做过:原因一,从另一个硬盘的/home挂载点复制了大量数据到/dev/sdb1,然后我就将硬盘的数据线和电源线都拔掉了,这个动作在系统运行和关闭的两种情况下都做过,(SATA 硬盘是否安全的支持热插拔?)原因二,在这次准备复制数据的之前,我没有将硬盘固定,也没有平放在台面(有一点斜度),然后开机,(胡乱的猜想着斜坡加载技术)下面进入正题:1,硬盘错误引起分区无法读取,挂载,开始纳闷哪里出了问题2,运行gdisk -l /dev/sdb,显示如下有警告信息及注意事项,虽然这里的标记GPT:damaged说明GPT有问题,但最后还是显示出了有分区的信息存在,(GPT分区表信息应该没有彻底损坏,不然怎么读取到两个分区的信息的呢),两个分区里Code标记都变成了0700(Microsoft basic data),正常的应该是8300(Linux filesystem),这个标记应该说明的是XFS文件系统的superblock信息毁了,这是后来经过XFS文件系统工具xfs_repair知道的详细分区情况,但是是得出来的结果有问题的gdisk检测到五个问题,(惊讶,这么多的问题)3,进行到这里,我着急了,于是寻求帮助首先,尝试了xfs_repair /dev/sdb,这个命令进行了几次,因为中途中断过,这个修复时间是比较长的,几小时(差不多3,4小时?)后得到的结果却是无法检测验证到有效的备份superblock信息,(失败,心都凉了)然后,找到testdisk工具,大略的看了下说明就上手做(英文实在是差,仔细地看也不明白),第一次进行Analyse后,完全不知道做什么,就直接退出然后就去测试查看,运行lsblk,gdisk,没有任何改变,(此刻是没抱什么希望的),输出的日志文件testdisk.log也完全看不懂,但我在日志文件里看到了有XFS这三个字母的身影,(此时心中还是有一丝喜悦的)4,继续网上搜索,寻求答案,(辛辛苦苦建立的文件数据啊,那个心情真是无奈啊)使用testdisk进行第二次Analyse(分析目前分区结构及搜寻丢失的分区),经过6小时的分析与搜索后,我大胆的进行了第二个动作,转换分区类型,(当时的想法是inode及data block里记录的信息应该是不会丢失或被覆盖的),于是我选择了Linux reserved(谷歌翻译了一下,“Linux保留”,这里是没有Linux filesystem 的,找来找去也没找到更合适的了),再进入子菜单选择了XFS(还有XFS2,XFS3,XFS4,这里是比较疑惑的,网上没有找到任何答案),至此点击写入,然后退出。

处理CentOS 7启动错误

处理CentOS 7启动错误

■ 新疆 马小川 乔卿丞笔者一台服务器因非正常掉电而关机了。

而当再启动该设备时,无法正常所示。

该服务器安装的系统是Centos7,了解到,服务器文件系统出现了错误,而造成文件系统出现错误的原因,应该是非正常关机造成的系统文件损坏。

该服务器系统因无法正常启动,而进入了紧急模式。

紧急模式是图1 服务器的系统无法正常启动并提示报错统中设备每个设备号图2 查看LVM设备的信息又分为主设备号和次设备号。

其中主设备号用来区分不同种类的设备,而次设备号用来区分同一类型的多令“cat /以查询到设备号为。

以此可以说明此计CentOS系统的swap分区,都设备号253)root分区和分区的分设备号分别是就是虚拟磁盘中的逻辑分区。

就是分设备号为1的“dm-0”就是系“dm-1”就区。

这个“ls –l /印证。

在/目录中可以查看逻辑分区的映射情况,如图3本文中服务器报送的错图3 查看逻辑分区的映射情况就是根分区,时出现错误,启动。

造成根分区挂载错误的原因,应该是由于该服务器非正常掉电造成了根分区文件损坏。

由于了XFS文通过日志很好的保护系统数据的完整性。

因此,件出现了损坏,进行修复。

修复的方法是使用XFS文件系统的修复工具“xfs_repair”修复方法如下通过repair –L进行修复。

该命令中加入参数“-L”的日志清零,dev/dm-0。

执行命令后,重启计算机,入系统。

故障处理完毕。

在本例中,启动过程中出现了故障,从而造成无法进入系统。

那么Linux图4 查看系统的挂载硬盘情况统上按照同样的进行安装,想问题多程相当曲首先笔者将补丁包上传%Weblogic_Home%\utils\录下,然%Weblogic_Home%\按住Shift再点击鼠标右键,在弹出的窗口中选择“在此项。

窗口中执查看当前补丁-prod_dir =% Weblogic_Home%\wl ser-status= app器启动故学习和了解到了中使用的XFS文件逻辑盘卷管理器。

Linux-使用镜像进入救援模式修复系统

Linux-使用镜像进入救援模式修复系统

Linux-使⽤镜像进⼊救援模式修复系统前⾔遇到内核⽂件损坏或者是grub 引导程序丢失等错误,出现截图的报错信息. 当前修复的环境为vmware 虚拟机, 系统版本为Centos7.41.修复过程1.1. 挂载ISO镜像⾄虚拟机中此时虚拟机处于关闭状态1.2. 虚拟机设置启动项为虚拟机右键-->电源--> 打开时进⼊固件-->选择Boot--> 将CD-ROM Drive 项调整⾄第⼀位 --> 按F10保存重启1.3.根据步骤进⼊救援模式Troublesbooting --> Rescure a CentOS system --> 等待⼀段时间 --> 按"1 continue 继续进⾏"1.4.2.报错1# 进⾏根的切换 该命令如报错,请拉⾄最下查看信息2chroot /mnt/sysimage 3# 将光盘挂载⾄/mnt ⽬录中4mount /dev/sr0 /mnt 5# 强制安装内核6rpm -ivh /mnt/Packages/kernel-3.10.0-693.e17.x86__64.rpm --force 7# 安装grup ⽬录8grub2-install /dev/sda 9# 查看/boot 下内核以及grub ⽬录已经⽣成10# 进⼊到grub2⽬录安装grub.cfg 11cd /boot/grub212grub2-mkconfig -o grub.cfg 13# 安装完毕后重启操作系统在切换根⽬录的时候报错导致⽆法继续修复内核和grub 引导程序修复建议⾄此,系统正常打开.如有疑问,可留下评论.——— EOF ———1> chroot /mnt/sysimage 2you don't have any Linux partitions the system will reboot automatically when you exit from the shell31# 查看系统卷组2> lvm vgscan 3> lvm lvscan 4# 激活逻辑卷5>lvm vgchange -ay 67# 修复根分区逻辑8> fsck /dev/centos/root -L 9# 如果提⽰是xfs ⽂件系统,需要⽤xfs_repair 修复,则运⾏: 10# xfs_repair /dev/centos/root 然后会跑⼀堆⽇志11# 最后提⽰: release dirty buffer! done!本⽂作者:风吹蛋⽣⼂版权声明:本作品采⽤知识共享署名-⾮商业性使⽤-禁⽌演绎 2.5 中国⼤陆进⾏许可。

xfs_repair文档

xfs_repair文档

NAMExfs_repair − repair an XFS filesystemSYNOPSISxfs_repair[−dfLnPv][−m maxmem][−c subopt=value][−o subopt[=value]][−t interval][−l logdev][−r rtdev]devicexfs_repair −VDESCRIPTIONxfs_repair repairs corrupt or damaged XFS filesystems (see xfs(5)). Thefilesystem is specified using the device argument which should be the device name of the disk partition or volume containing the filesystem.If given the name of a block device,xfs_repair will attempt to find the raw device associated with the spec-ified block device and will use the raw device instead.Regardless, the filesystem to be repaired must be unmounted, otherwise, the resulting filesystem may be inconsistent or corrupt.OPTIONS−f Specifies that the filesystem image to be processed is stored in a regular file at device(see the mkfs.xfs −dfile option). This might happen if an image copy of afilesystem has been copied orwritten into an ordinary file.This option implies that any external log or realtime section is also inan ordinary file.−L Force Log Zeroing.Forces xfs_repair to zero the log even if it is dirty (contains metadata changes). When using this option the filesystem will likely appear to be corrupt, and can cause theloss of user files and/or data.−l logdevSpecifies the device special file where the filesystem’s external log resides. Only for those filesys-tems which use an external log.See the mkfs.xfs −l option, and refer to xfs(5) for a detaileddescription of the XFS log.−r rtdevSpecifies the device special file where the filesystem’s realtime section resides. Only for thosefilesystems which use a realtime section.See the mkfs.xfs −r option, and refer to xfs(5) for adetailed description of the XFS realtime section.−n No modify mode. Specifies that xfs_repair should not modify the filesystem but should only scan the filesystem and indicate what repairs would have been made.−P Disable prefetching of inode and directory blocks. Use this option if you find xfs_repair gets stuck and stops proceeding. Interrupting a stuck xfs_repair is safe.−m maxmemSpecifies the approximate maximum amount of memory,in meg a bytes, to use for xfs_repair.xfs_repair has its own internal block cache which will scale out up to the lesser of the process’svirtual address limit or about 75% of the system’s physical RAM.This option overrides these lim-its.NOTE:These memory limits are only approximate and may use more than the specified limit.−c subopt=valueChange filesystem parameters. Refer to xfs_admin(8) for information on changing filesystemparameters.−o subopt[=value]Override what the program might conclude about the filesystem if left to its own devices.The subopt ions supported are:ihash=ihashsizeoverrides the default inode cache hash size. The total number of inode cacheentries are limited to 8 times this amount. The default ihashsize is 1024 (for atotal of 8192 entries).bhash=bhashsizeoverrides the default buffer cache hash size. The total number of buffer cacheentries are limited to 8 times this amount. The default size is set to use up theremainder of 75% of the system’s physical RAM size.ag_stride=ags_per_concat_unitThis creates additional processing threads to parallel process AGs that span mul-tiple concat units. This can significantly reduce repair times on concat basedfilesystems.force_geometryCheck the filesystem even if geometry information could not be validated.Geometry information can not be validated if only a single allocation group andexist and thus we do not have a backup superblock available, or if there are twoallocation groups and the two superblocks do not agree on the filesystem geome-try.Only use this option if you validated the geometry yourself and know whatyou are doing.If In doubt run in no modify mode first.−t intervalModify reporting interval. During long runs xfs_repair outputs its progress every 15 minutes.Reporting is only activated when ag_stride is enabled.−v Verbose output.−d Repair dangerously.Allow xfs_repair to repair an XFS filesystem mounted read only.This is typi-cally done on a root fileystem from single user mode, immediately followed by a reboot.−V Prints out the current version number and exits.Checks PerformedInconsistencies corrected include the following:1. Inode and inode blockmap (addressing) checks: bad magic number in inode, bad magic numbersin inode blockmap blocks, extents out of order,incorrect number of records in inode blockmapblocks, blocks claimed that are not in a legal data area of the filesystem, blocks that are claimed bymore than one inode.2. Inode allocation map checks: bad magic number in inode map blocks, inode state as indicated bymap (free or in-use) inconsistent with state indicated by the inode, inodes referenced by thefilesystem that do not appear in the inode allocation map, inode allocation map referencing blocksthat do not appear to contain inodes.3. Size checks: number of blocks claimed by inode inconsistent with inode size, directory size notblock aligned, inode size not consistent with inode format.4. Directory checks: bad magic numbers in directory blocks, incorrect number of entries in a direc-tory block, bad freespace information in a directory leaf block, entry pointing to an unallocated(free) or out of range inode, overlapping entries, missing or incorrect dot and dotdot entries,entries out of hashvalue order,incorrect internal directory pointers, directory type not consistentwith inode format and size.5. Pathname checks: files or directories not referenced by a pathname starting from the filesystemroot, illegal pathname components.6. Link count checks: link counts that do not agree with the number of directory references to theinode.7. Freemap checks: blocks claimed free by the freemap but also claimed by an inode, blocksunclaimed by any inode but not appearing in the freemap.8. Super Block checks: total free block and/or free i-node count incorrect, filesystem geometryinconsistent, secondary and primary superblocks contradictory.Orphaned files and directories (allocated, in-use but unreferenced) are reconnected by placing them in the lost+found directory.The name assigned is the inode number.Disk Errorsxfs_repair aborts on most disk I/O errors. Therefore, if you are trying to repair a filesystem that was dam-aged due to a disk drive failure, steps should be taken to ensure that all blocks in the filesystem are readable and writeable before attempting to use xfs_repair to repair the filesystem. A possible method is using dd(8) to copy the data onto a good disk.lost+foundThe directory lost+found does not have to already exist in the filesystem being repaired.If the directory does not exist, it is automatically created if required.If it already exists, it will be checked for consistency and if valid will be used for additional orphaned files. Invalid lost+found directories are removed and recre-ated. Existing files in a valid lost+found are not removed or renamed.Corrupted SuperblocksXFS has both primary and secondary superblocks.xfs_repair uses information in the primary superblock to automatically find and validate the primary superblock against the secondary superblocks before pro-ceeding. Should the primary be too corrupted to be useful in locating the secondary superblocks, the pro-gram scans the filesystem until it finds and validates some secondary superblocks.At that point, it gener-ates a primary superblock.QuotasIf quotas are in use, it is possible that xfs_repair will clear some or all of the filesystem quota information.If so, the program issues a warning just before it terminates.If all quota information is lost, quotas are dis-abled and the program issues a warning to that effect.Note that xfs_repair does not check the validity of quota limits. It is recommended that you check the quota limit information manually after xfs_repair.Also, space usage information is automatically regener-ated the next time the filesystem is mounted with quotas turned on, so the next quota mount of the filesys-tem may take some time.DIAGNOSTICSxfs_repair issues informative messages as it proceeds indicating what it has found that is abnormal or any corrective action that it has taken. Most of the messages are completely understandable only to those who are knowledgeable about the structure of the filesystem.Some of the more common messages are explained here.Note that the language of the messages is slightly different if xfs_repair is run in no-mod-ify mode because the program is not changing anything on disk.No-modify mode indicates what it would do to repair the filesystem if run without the no-modify flag.disconnected inode ino,moving to lost+foundAn inode numbered ino was not connected to the filesystem directory tree and was reconnected tothe lost+found directory.The inode is assigned the name of its inode number (ino). If alost+found directory does not exist, it is automatically created.disconnected dir inode ino,moving to lost+foundAs above only the inode is a directory inode.If a directory inode is attached to lost+found,all ofits children (if any) stay attached to the directory and therefore get automatically reconnectedwhen the directory is reconnected.imap claims in-use inode ino is free, correcting imapThe inode allocation map thinks that inode ino is free whereas examination of the inode indicatesthat the inode may be in use (although it may be disconnected).The program updates the inodeallocation map.imap claims free inode ino is in use, correcting imapThe inode allocation map thinks that inode ino is in use whereas examination of the inode indi-cates that the inode is not in use and therefore is free.The program updates the inode allocationmap.resetting inode ino nlinks from x to yThe program detected a mismatch between the number of valid directory entries referencing inode ino and the number of references recorded in the inode and corrected the the number in the inode. fork-type fork in ino ino claims used block bnoInode ino claims a block bno that is used (claimed) by either another inode or the filesystem itself for metadata storage. The fork-type is either data or attr indicating whether the problem lies in the portion of the inode that tracks regular data or the portion of the inode that stores XFS attributes. If the inode is a real-time (rt) inode, the message says so.Any inode that claims blocks used by the filesystem is deleted.If two or more inodes claim the same block, they are both deleted.fork-type fork in ino ino claims dup extent ...Inode ino claims a block in an extent known to be claimed more than once.The offset in the inode, start and length of the extent is given. The message is slightly different if the inode is a real-time (rt) inode and the extent is therefore a real-time (rt) extent.inode ino−bad extent ...An extent record in the blockmap of inode ino claims blocks that are out of the legal range of the filesystem. The message supplies the start, end, and file offset of the extent. The message is slightly different if the extent is a real-time (rt) extent.bad fork-type fork in inode inoThere was something structurally wrong or inconsistent with the data structures that map offsets to filesystem blocks.cleared inode inoThere was something wrong with the inode that was uncorrectable so the program freed the inode.This usually happens because the inode claims blocks that are used by something else or the inode itself is badly corrupted. Typically,this message is preceded by one or more messages indicating why the inode needed to be cleared.bad attribute fork in inode ino,clearing attr forkThere was something wrong with the portion of the inode that stores XFS attributes (the attribute fork) so the program reset the attribute fork.As a result of this, all attributes on that inode are lost. correcting nextents for inode ino,was x−counted yThe program found that the number of extents used to store the data in the inode is wrong and cor-rected the number.The message refers to nextents if the count is wrong on the number of extents used to store attribute information.entry name in dir dir_ino not consistent with .. value (xxxx)in dir ino ino,junking entry name in directory inode dir_inoThe entry name in directory inode dir_ino references a directory inode ino.Howev e r, the .. entry in directory ino does not point back to directory dir_ino,so the program deletes the entry name in directory inode dir_ino.If the directory inode ino winds up becoming a disconnected inode as a result of this, it is moved to lost+found later.entry name in dir dir_ino references already connected dir ino ino,junking entry name in directory inode dir_inoThe entry name in directory inode dir_ino points to a directory inode ino that is known to be a child of another directory.Therefore, the entry is invalid and is deleted.This message refers to an entry in a small directory.If this were a large directory,the last phrase would read "will clear entry".entry references free inode ino in directory dir_ino,will clear entryAn entry in directory inode dir_ino references an inode ino that is known to be free. The entry istherefore invalid and is deleted.This message refers to a large directory.If the directory weresmall, the message would read "junking entry ...".EXIT STATUSxfs_repair −n(no modify node) will return a status of 1 if filesystem corruption was detected and 0 if no filesystem corruption was detected.xfs_repair run without the −n option will always return a status code of 0.BUGSThe filesystem to be checked and repaired must have been unmounted cleanly using normal system admin-istration procedures (the umount(8) command or system shutdown), not as a result of a crash or system reset. If the filesystem has not been unmounted cleanly,mount it and unmount it cleanly before running xfs_repair.xfs_repair does not do a thorough job on XFS extended attributes. The structure of the attribute fork will be consistent, but only the contents of attribute forks that will fit into an inode are checked. This limitation will be fixed in the future.The no-modify mode (−n option) is not completely accurate.It does not catch inconsistencies in the freespace and inode maps, particularly lost blocks or subtly corrupted maps (trees).The no-modify mode can generate repeated warnings about the same problems because it cannot fix the problems as they are encountered.If a filesystem fails to be repaired, a metadump image can be generated with xfs_metadump(8) and be sent to an XFS maintainer to be analysed and xfs_repairfixed and/or improved.SEE ALSOdd(1),mkfs.xfs(8),umount(8),xfs_admin(8),xfs_check(8),xfs_metadump(8),xfs(5).。

017文件xfs_repair恢复,xfs_dump恢复,lvm动态扩容

017文件xfs_repair恢复,xfs_dump恢复,lvm动态扩容

017⽂件xfs_repair恢复,xfs_dump恢复,lvm动态扩容xfs_repairdd命令dd if=/dev/zero of=/dev/sdb bs=500M count=1if : 从哪⾥读⽂件of : 写⼊到哪⾥bs : 写⼊500Mcount : 写⼀块模拟⽂件系统出问题1、直接向硬盘中写数据,*不能测试向分区写数据2、卸载之后重新挂载[root@localhost ~]# mount /dev/sdc1 /root/testmount: mount /dev/sdc1 on /root/test failed: Structure needs cleaning3、对⽂件系统进⾏修复xfs_repair [磁盘或分区路径]注: xfs_repair修改硬盘之后,硬盘数据丢失,所以对重要的数据要进⾏数据备份⽂件系统的备份与恢复备份:另外再保存⼀份恢复:将以前保存的数据进⾏还原touch 1.txtecho aaaa > 1.txtcp 1.txt 2.txtrm 1.txtcp 2.txt 1.txt1.log 1T = 1024G全量备份和增量备份全量备份:将需要备份的⽂件全部复制⼀份增量备份:在原来备份基础上,把新增数据重新备份⼀份备份与恢复的命令xfsdump : 备份的命令xfsrestore : 恢复的命令# 备份的步骤1、安装备份命令[root@localhost test]# yum install xfsdump -y2、备份的等级0 全量备份1 ~ 9 增量备份(等级)3、备份的参数-L :记录每次备份的地⽅-M :注释,此次备份的注释-l :指定备份的等级-f :备份的⽂件名称-I :查看备份信息4、备份的条件(限制)1、必须使⽤root权限2、只能备份已经挂载的内容3、只能备份xfs⽂件系统4、只能够⽤xfsrestore来恢复5、备份的命令格式xfsdump -L [信息] -M [备注] -l [级别] -f [源⽂件] [⽬标⽬录]xfsdump -L sdb1_bak -M "sbd1_from_xxx" -l 0 -f sdb1_from_bak_1 /root/oldboy6、数据恢复xfsrestore7、恢复数据的参数-f : 指定备份的⽂件路径8、恢复的格式xfsrestore -f [备份的⽂件] [恢复的⽬标⽬录][root@localhost oldboy]# xfsrestore -f /root/sdb1_from_bak_3 /root/oldboy/LVM1、什么是lvm你如何保证你的硬盘空间恰好够⽤?如果你的硬盘你不够⽤了怎么扩容?LVM是⽂件系统管理⼯具/root/oldboy ---> lv[5G]/root/oldboy ---> lv[3G]2、LVM的优点1、可以动态扩容与缩容2、可以将新增加的硬盘添加到VG存储池3、可以突破物理存储卷的限制3、使⽤lvm1、安装lvm软件包yum install lvm2 -y2、将磁盘交给pvpvreate [磁盘/磁盘分区]3、查看pvpvspvscan4、创建vgvgcreate [vg名称] [pv路径][root@test1 ~]# vgcreate vg1 /dev/sdb2 /dev/sdb3Volume group "vg1" successfully created5、查看vgvgs6、创建lvm逻辑卷(lv)-L :创建逻辑卷的⼤⼩-n : 逻辑卷的名字lvcreate -L [⼤⼩] -n [lv名] [vg路径][root@test1 ~]# lvcreate -L 30G -n lv1 vg1Logical volume "lv1" created.7、制作⽂件系统mkfs.xfs /dev/vg1/xxx8、挂载⽂件系统mount [lv的路径] [挂载点的路径]在线动态扩容在线扩容的意思为:在不⽤卸载的情况下完成扩容.lvextend -L [+]MGT /dev/VG_NAME/VL_NAME# 注意:-L 100M 与 -L +100M不是⼀个意思,后者代表在原有的基础上扩容lvextend -L [扩容量] [⽬标盘][root@test1 ~]# lvextend -L +8G /dev/mapper/vg1_sdc-lv1_vg1_sdcSize of logical volume vg1_sdc/lv1_vg1_sdc changed from 20.00 GiB (5120 extents) to 28.00 GiB (7168 extents).Logical volume vg1_sdc/lv1_vg1_sdc successfully resized.[root@test1 ~]# df -hFilesystem Size Used Avail Use% Mounted ondevtmpfs 979M 0 979M 0% /devtmpfs 991M 0 991M 0% /dev/shmtmpfs 991M 9.5M 981M 1% /runtmpfs 991M 0 991M 0% /sys/fs/cgroup/dev/mapper/centos-root 18G 3.9G 15G 22% //dev/sda1 1014M 194M 821M 20% /boottmpfs 199M 0 199M 0% /run/user/0/dev/mapper/vg1_sdc-lv1_vg1_sdc 20G 33M 20G 1% /root/sdb1#这时候需要更新fs⽂件系统[root@test1 ~]# xfs_growfs /dev/mapper/vg1_sdc-lv1_vg1_sdcmeta-data=/dev/mapper/vg1_sdc-lv1_vg1_sdc isize=512 agcount=4, agsize=1310720 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=0 spinodes=0data = bsize=4096 blocks=5242880, imaxpct=25= sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=1log =internal bsize=4096 blocks=2560, version=2= sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 5242880 to 7340032#这时候再查看⼀下发现增长了[root@test1 ~]# df -hFilesystem Size Used Avail Use% Mounted ondevtmpfs 979M 0 979M 0% /devtmpfs 991M 0 991M 0% /dev/shmtmpfs 991M 9.5M 981M 1% /runtmpfs 991M 0 991M 0% /sys/fs/cgroup/dev/mapper/centos-root 18G 3.9G 15G 22% //dev/sda1 1014M 194M 821M 20% /boottmpfs 199M 0 199M 0% /run/user/0/dev/mapper/vg1_sdc-lv1_vg1_sdc 28G 33M 28G 1% /root/sdb1#删除# 删除lv之前需要先卸载挂载点[root@egon ~]# umount /test3[root@egon ~]# lvremove /dev/vg2/lv1_from_vg2 # 删vg[root@egon ~]# vgremove vg2# 删pv:只能删掉那些不属于任何vg的pv[root@egon ~]# pvremove /dev/sdb2[root@egon ~]# pvremove /dev/sdb3。

xfs日志原理

xfs日志原理

xfs日志原理全文共四篇示例,供读者参考第一篇示例:XFS(Extended File System)是Linux系统中常用的一种文件系统,并且在CentOS等操作系统中作为默认文件系统被广泛采用。

在XFS文件系统中,日志(journal)的作用非常重要,它可以保证文件系统的一致性和可靠性。

本文将从XFS日志的原理、工作机制和优缺点等方面进行详细介绍。

一、XFS日志的原理XFS日志是一种采用日志结构的文件系统,它使用一种称为“write-ahead logging(WAL)”的机制来保证数据的一致性。

在XFS中,所有的数据修改操作都会被记录到日志中,然后再在磁盘上执行实际的数据写入操作。

这样可以确保在系统意外崩溃或断电等情况下,可以通过日志进行回滚和恢复,避免数据丢失或文件系统损坏。

XFS日志的构成主要包括同步元数据日志(Synchronous Metadata Journal)和延迟写入日志(Delayed Write Journal)。

其中同步元数据日志用于记录对文件系统元数据(如inode、block等)的修改操作,它会在元数据操作完成后立即写入磁盘,这样可以确保元数据的一致性。

而延迟写入日志则用于记录对数据块的修改操作,它会在一定条件下才将数据写入磁盘,以提高系统性能。

在XFS文件系统中,日志的写入是以一组称为事务(Transaction)的单位进行的。

当文件系统进行数据更新时,会将这些操作打包为一个事务,并将其写入到日志中。

每个事务都会有一个唯一的标识符,以便在系统崩溃后可以通过日志进行事务的回滚操作。

XFS日志的写入顺序是有序的,即先写入同步元数据日志,再写入延迟写入日志。

这样可以确保元数据的一致性和数据的可靠性。

在写入日志时会采用类似于写时拷贝(Copy-On-Write)的技术,即先将日志写入到一个临时日志区域,然后在系统空闲时再将其写入到磁盘中,以减少对磁盘的频繁访问。

XFS日志也存在一些缺点,如:1. 日志空间占用:XFS日志会占用一定的磁盘空间用于存储日志数据,这可能会影响文件系统的可用空间。

超融合一体机故障应对措施

超融合一体机故障应对措施

一、登录系统时,显示页面为服务器的地址信息1、故障描述通过浏览器访问超融合一体机管理平台地址时,界面显示为服务器的HDM登录页面。

2、应对方案通过HDM口登录服务器管理页面(默认用户名:admin,默认密码:Password@_),点击“网络-专用网口-配置”,查看IPv4地址是否与平台地址冲突。

若冲突,请修改地址。

点击“网络-共享网口-配置”,查看IPv4地址是否与平台地址冲突,若冲突,修改IPv4地址,或去勾选“IPv4配置”项。

使用专用网口进行服务器管理。

二、区域配置不正确1.故障描述创建资产时,提示“区域配置不正确,资产创建失败”。

2.应对方案(1)检查资产信息配置是否存在错误,例如管理IP或名称与组内已有成员是否重复。

如果是资产管理IP、名称重复等错误,请根据提示修改相应配置信息。

(2)检查区域配置是否正确,确保区域配置IP范围在父区域范围内,查看是否存在其它错误,例如IP范围或名称与组内已有成员是否重复。

如果是区域IP范围、名称重复等错误,请根据提示修改相应配置信息。

(3)如果区域未配置,请按照区域配置步骤配置区域信息。

(4)如果上述操作完成后问题仍无法排除,请联系技术支持工程师。

三、管理IP不一致1、故障描述创建资产时,提示“创建失败,管理IP不一致”。

2、应对方案该问题是由于创建资产管理IP与区域IP范围不一致造成的。

解决方法如下:(1)检查资产管理IP是否超出区域IP范围,如果未超出,查看信息配置是否存在错误,例如管理IP或名称与组内已有成员是否重复。

如果是资产管理IP、名称重复等错误,请根据提示修改相应配置信息。

(2)检查区域配置是否正确,确保区域配置IP范围在父区域范围内,查看是否存在其它错误,例如IP范围或名称与组内已有成员是否重复。

如果是区域IP范围、名称重复等错误,请根据提示修改相应配置信息。

(3)如果上述操作完成后问题仍无法排除,请联系技术支持工程师。

四、资产发现失败1、故障描述创建拓扑任务后,自动发现资产功能失效,资产发现失败。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

xfs_repair 原理
XFS(ExtendedFileSystem)是一种常用的Linux文件系统,广泛应用于各种Linux系统中。

在Linux系统中,文件系统的稳定性至关重要,因此,定期对文件系统进行维护和修复是非常必要的。

其中,xfs_repair是一个常用的工具,用于修复XFS文件系统中的问题。

本文将介绍xfs_repair的原理,包括其工作流程、使用方法、参数解析以及常见问题和解决方案。

一、工作流程
xfs_repair工具是用于修复XFS文件系统的命令行工具,其工作流程大致可以分为以下几个步骤:
1.检查文件系统状态:xfs_repair通过检查文件系统的元数据信息,确定文件系统的健康状态。

2.确定需要修复的问题:根据文件系统的状态,xfs_repair会找出需要修复的问题,如损坏的数据块、不完整的日志等。

3.执行修复操作:根据问题的类型和严重程度,xfs_repair会采取相应的修复操作,如重建数据块、恢复日志等。

4.验证修复结果:修复完成后,xfs_repair会验证修复结果是否正确,确保文件系统的完整性。

二、使用方法
要使用xfs_repair工具修复XFS文件系统,可以按照以下步骤进行操作:
1.打开终端,以root用户身份登录。

2.运行以下命令,使用xfs_repair工具修复文件系统:
```
sudoxfs_repair/dev/sdXY
```
其中,/dev/sdXY是你要修复的XFS文件系统的设备名称。

3.xfs_repair工具会执行一系列检查和修复操作,并在过程中提供一些提示信息。

根据提示信息进行操作即可。

4.如果修复成功,xfs_repair会输出一些确认信息,并提示你文件系统已经修复完成。

三、参数解析
xfs_repair工具提供了许多参数,用于调整工具的行为和效果。

以下是一些常用的参数及其含义:
*-n:仅进行检查,不进行实际的修复操作。

*-v:详细模式,输出更多的信息,帮助了解修复过程。

*-f:强制执行修复操作,即使某些问题无法修复也不会退出。

*--force-recovery:强制恢复损坏的数据块,即使可能会导致数据丢失。

*--lazy:延迟日志恢复操作,以提高效率。

*--abort:在修复过程中提前终止,通常用于调试目的。

四、常见问题和解决方案
在使用xfs_repair工具时,可能会遇到一些常见问题,如无法找到设备、无法进入修复模式等。

以下是几个常见问题的解决方案:
1.无法找到设备:确保设备名称正确,并使用正确的设备路径。

2.无法进入修复模式:尝试使用其他用户身份登录并运行该命令。

3.修复过程中出现错误:根据提示信息进行相应的操作,如恢复数据块或日志等。

如果问题仍然存在,可以考虑寻求专业人士的帮助。

总之,了解xfs_repair工具的原理和使用方法对于维护和修复XFS文件系统非常重要。

通过正确使用该工具,可以确保文件系统的稳定性和可靠性。

相关文档
最新文档