大分区使用xfs文件系统存储备份遇到的问题

日前,同事反馈一个问题:在一个大分区(24T)中使用xfs文件系统,用来做历史文件备份,突然提示没有磁盘空间错误,先检查下:

[root@imysql ~]# df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sdb1      xfs     19T   16T  2.4T  88% /backup

[root@imysql ~]# df -hi
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sdb1               9.3G    3.4M    9.3G    1% /backup

可以看到,不管是物理空间,还是inode,都还有很多余量,那为何还会报告磁盘空间不够呢?
查询了下XFS FAQ,发现有一段:

Q: What is the inode64 mount option for?

By default, with 32bit inodes, XFS places inodes only in the first 1TB of a disk. If you have a disk with 100TB, all inodes will be stuck in the first TB. This can lead to strange things like "disk full" when you still have plenty space free, but there's no more place in the first TB to create a new inode. Also, performance sucks.
To come around this, use the inode64 mount options for filesystems >1TB. Inodes will then be placed in the location where their data is, minimizing disk seeks.
Beware that some old programs might have problems reading 64bit inodes, especially over NFS. Your editor used inode64 for over a year with recent (openSUSE 11.1 and higher) distributions using NFS and Samba without any corruptions, so that might be a recent enough distro.

大意就是xfs文件系统会把inode存储在磁盘最开始的这1T空间里,如果这部分空间被完全填满了,那么就会出现磁盘空间不足的错误提示了。解决办法就是在挂载时,指定 inode64 选项:

mount -o remount -o noatime,nodiratime,inode64,nobarrier /dev/sdb1 /backup

P.S,磁盘空间小于1T的不用担心这个问题 :)

评论

我的没有这个问题啊。你什么操作系统啊?
[@zw_77_108 ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.1 (Santiago)
[@zw_77_108 ~]# df -T
文件系统 类型 1K-块 已用 可用 已用% 挂载点
/dev/sda1 ext4 4128448 406500 3512236 11% /
/dev/sda6 ext4 122948636 68393488 48309724 59% /opt
/dev/sda5 ext4 5160576 1623264 3275168 34% /usr
/dev/sda2 ext4 4128448 2045696 1873040 53% /var
tmpfs tmpfs 12296236 0 12296236 0% /dev/shm
/dev/sdb1 xfs 10736379868 7405334636 3331045232 69% /data
[@zw_77_108 ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/sda1 4.0G 397M 3.4G 11% /
/dev/sda6 118G 66G 47G 59% /opt
/dev/sda5 5.0G 1.6G 3.2G 34% /usr
/dev/sda2 4.0G 2.0G 1.8G 53% /var
tmpfs 12G 0 12G 0% /dev/shm
/dev/sdb1 10T 6.9T 3.2T 69% /data
[@zw_77_108 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Mar 29 15:26:08 2012
#
# 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
#
UUID=c3107c81-154b-48e7-ae41-fba28d314747 / ext4 defaults 1 1
UUID=dea675e6-301c-4e49-ad4a-aee413e1578b /opt ext4 defaults,noatime,nodiratime 0 0
UUID=55b2cafe-480b-43e9-827f-7b97946a6aff /usr ext4 defaults 1 2
UUID=5dd32206-8a35-44f8-a18a-d106d53ce46e /var ext4 defaults 1 2
UUID=0bebe7cf-09f6-4e33-ab5c-c3bc7952d829 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/shm /tmp none rw,bind 0 0
/dev/sdb1 /data xfs defaults,noatime,nodiratime 0 0
[@zw_77_108 ~]#

QQ or 邮件单独联系我