大网数据广告活动
服务器运维问答

Recreating XFS project quota information

· 52CE 我爱测

We recreated a fileserver, which had an XFS filesystem using project quotas residing on a SAN. Unfortunately, we had forgotten to backup /etc/projects and /etc/projid on the server before reinstalling. The XFS filesystem itself, …

问题原文

原帖链接 · janneb · CC BY-SA 3.0

We recreated a fileserver, which had an XFS filesystem using project quotas residing on a SAN. Unfortunately, we had forgotten to backup /etc/projects and /etc/projid on the server before reinstalling. The XFS filesystem itself, and the quota information stored therein, is all Ok AFAICS. Is there some way of figuring out the project ID's of the directories on disk, so that we can recreate /etc/{projects,projid}?

To clarify, lets say the XFS filesystem is mounted on /export/xfs and contains directories /export/xfs/foo and /export/xfs/bar. So we need to have the following entries in /etc/projects

NN:/export/xfs/foo
MM:/export/xfs/bar

and the following entries in /etc/projid

foo:NN
bar:MM

So how do we retrieve the values of NN and MM, which are stored on disk?

已采纳解答

原帖链接 · janneb · CC BY-SA 3.0

Well, since nobody knew the answer, I had to figure out something myself. The following seems to work:

Make a guess (NN) for a project ID for one of the project directories. Then run

xfs_quota -x -c "project -c -p /export/xfs/projdir -d 0 NN"

If your guess was correct, you should see output like

Checking project NN (path /export/xfs/projdir)...

If your guess was incorrect, you should see output like

/export/xfs/projdir - project identifier is not set (inode=MM, tree=NN)

where NN is your guess and the correct project ID is MM. So based on this, you can fill in /etc/projects and /etc/projid for that project directory. Then, repeat for all project directories in the filesystem (script to automate this left as an exercise for the reader).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-06-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。