Skip to contentSkip to conversation

Number of hard links limit

DISCUSSION Sami Liedes 9 participants 11 messages Aug 2, 2010 – Nov 8, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi,

There's been discussion before on this list on the very small number of hard links supported by btrfs.[1][2] In those threads, an often asked question has been if there's a real world use case the limit breaks. Also it has been pointed out that a fix for this would need a disk format change.

As discussed in bug #15762 [3], there are certainly real-world use cases this limitation breaks. I don't usually like to bring up my pet bugs on mailing lists, and I'm sorry for doing it here, but if it indeed needs a disk format change, I think this should be considered before the format is set in stone. I won't personally lose my sleep if this is not fixed - I can use other filesystems for backuppc and other similar systems, although I'd be disappointed to see a production backup system unexpectedly fail because of this - just that I think it's better to think about this before things are set in stone.

I'd venture to guess that if I have hit this limit with the very small amount of btrfs use I've done, thousands of others are going to hit it when btrfs is the default filesystem of distributions.

Sami

[1] http://comments.gmane.org/gmane.comp.file-systems.btrfs/4589
[2] http://thread.gmane.org/gmane.comp.file-systems.btrfs/3427
[3] https://bugzilla.kernel.org/show_bug.cgi?id=15762

#1 lore raw

Le 02 ao=FBt 2010 =E0 14:40, Sami Liedes a =E9crit:

Quoted 3 lines

[BTRFS supports only 256 hard-links per directory ...] but if it indeed needs a disk format change, I think this should be considered before the format is set in stone. I won't personally lose my sleep i=

f

Quoted 1 line

this is not fixed - I can use other filesystems for backuppc and othe=

r

Quoted 1 line

similar systems,=20

Wouldn't it be even better to actually patch BackupPC to handle btrfs snapshots and COW (bcp) ?

--=20
Xavier Nicollet
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 4 lines · Xavier Nicollet

Le 02 ao=C3=BBt 2010 =C3=A0 14:40, Sami Liedes a =C3=A9crit:

Quoted 3 lines

[BTRFS supports only 256 hard-links per directory ...] but if it indeed needs a disk format change, I think this should be considered before the format is set in stone. I won't personally lose my sleep =

if

Quoted 1 line
Quoted 1 line

this is not fixed - I can use other filesystems for backuppc and oth=

er

Quoted 4 lines
Quoted 1 line

similar systems,=20

=20
Wouldn't it be even better to actually patch BackupPC to handle btrfs snapshots and COW (bcp) ?

That's not the only application impacted by this.

Also, I think it's unrealistic to expect everyone else to code to BTRFS-specific ioctls when there's other filesystems and other platform= s to
worry about. It would also be nice if we could tar/rsync/whatever betwe= en
BTRFS and something else like ext3 or some other OS entirely, without archiving tools either blowing up or requiring application-specific knowledge of how to convert dedups to hard links and back.

Also, I believe it's not strictly 256 links, it's dependent on the leng= th
of the names.

I recall Chris posting something about being able to fix this without a format change, though it wasn't a priority yet.

-Anthony
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 5 lines

Also, I believe it's not strictly 256 links, it's dependent on the length of the names.

I recall Chris posting something about being able to fix this without a format change, though it wasn't a priority yet.

As to my knowledge the limit is 64KB for all names of a single file and due to Chris it will take a format change to fix this.

I ran into the limit some month ago while installing some Gentoo packages.

Greetings, Michael

#4 lore raw
Quoted 10 lines · Michael Niederle
Quoted 5 lines

Also, I believe it's not strictly 256 links, it's dependent on the length of the names.

I recall Chris posting something about being able to fix this without a format change, though it wasn't a priority yet.

As to my knowledge the limit is 64KB for all names of a single file and due to Chris it will take a format change to fix this.

I ran into the limit some month ago while installing some Gentoo packages.

That means it would not work for my backup server.
At 4 backups per day, failure for filenames with 45 characters after just one year.

Signature · 1 line
   Roberto Ragusa    mail at robertoragusa.it
#5 lore raw

* [Roberto Ragusa]=20

Quoted 2 lines

That means it would not work for my backup server.
At 4 backups per day, failure for filenames with 45 characters after =

just

Quoted 1 line

one year.

IIRC, the limit on hard links is per directory. That is, if you put each hard link into its own directory, there's basically no limit to th= e
amount of hard links you can make to one file.

Thus, many generations of backup with BackupPC shouldn't trigger the problem, as each generation is stored in its own directory tree. The problem appears when your source data has many identical files in the same directory, since these would be deduplicated as hard links to the same file in the backup pool.

=D8ystein
--=20
This message was generated by a horde of attack elephants armed with PR= NGs.

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 3 lines · Oystein Viggen

IIRC, the limit on hard links is per directory. That is, if you put each hard link into its own directory, there's basically no limit to the amount of hard links you can make to one file.

Yes, that's always pointed out in these threads. Still, it seems to be breaking real use cases also beyond backuppc (someone mentioned installing some Gentoo package).

Quoted 5 lines

Thus, many generations of backup with BackupPC shouldn't trigger the problem, as each generation is stored in its own directory tree. The problem appears when your source data has many identical files in the same directory, since these would be deduplicated as hard links to the same file in the backup pool.

I think you are right. I looked at the errors I reported in

https://bugzilla.kernel.org/show_bug.cgi?id=15762

and figured out what happens there. In dbus's source tree, under doc/api/man/man3dbus, there are 119 files with the content ".so man3dbus/DBusProtocol.3dbus". I think these are redirects to a single man page.

Interestingly (and only somewhat off-topic), because of deduplication backuppc can be used to explore the merits of deduplication in filesystems too. I looked at the files I have most copies of. Many of them seem perhaps a bit silly.

The most common file has a single line with the text "# dummy". I have 54991 copies of that file. They are some kind of dependency files (perhaps by libtool or something?), always in a directory named .deps and with a file extension of .Po or .Plo.

There are also tens of thousands of copies of a file with a single line with the text "END". Subversion VCS seems to have two of these for every file under version control. In fact a large portion of the most common files seem to be owned by Subversion.

Sami

#7 lore raw
Quoted 8 lines · Sami Liedes
Quoted 3 lines · Oystein Viggen

IIRC, the limit on hard links is per directory. That is, if you put each hard link into its own directory, there's basically no limit to the amount of hard links you can make to one file.

Yes, that's always pointed out in these threads. Still, it seems to be breaking real use cases also beyond backuppc (someone mentioned installing some Gentoo package).

Right, this will get fixed in a future btrfs update. We're focusing on stability with what we have right now, but I do agree we should have done this link back reference design differently.

-chris

#8 lore raw
Quoted 3 lines · Chris Mason

Right, this will get fixed in a future btrfs update. We're focusing on stability with what we have right now, but I do agree we should have done this link back reference design differently.

I think people are complaining about this (apparently not too urgent) limitation, because if the on-disk format has to be changed, it is better to think about it as soon as possible, before back-compatibility becomes an issue.

Signature · 1 line
   Roberto Ragusa    mail at robertoragusa.it
#9 lore raw
In reply to Chris Mason

Hello,

Am Freitag, 6. August 2010 schrieb Chris Mason:

Quoted 6 lines · Sami Liedes
Quoted 5 lines · Oystein Viggen
Quoted 3 lines

IIRC, the limit on hard links is per directory. That is, if you put each hard link into its own directory, there's basically no limit to the amount of hard links you can make to one file.

Quoted 7 lines
Quoted 3 lines

Yes, that's always pointed out in these threads. Still, it seems to be breaking real use cases also beyond backuppc (someone mentioned installing some Gentoo package).

Right, this will get fixed in a future btrfs update. We're focusing on stability with what we have right now, but I do agree we should have done this link back reference design differently.

What is the status of fixing the limits of hardlinks in BTRFS?

It is now easy to hit on Debian systems that have git package installed:

Preparing to replace git 1:1.7.6.3-1 (using .../git_1%3a1.7.7-1_amd64.deb)
...
Unpacking replacement git ...
dpkg: error processing /var/cache/apt/archives/git_1%3a1.7.7-1_amd64.deb (--unpack):
unable to make backup link of `./usr/lib/git-core/git-send-pack' before
installing new version: Too many links
configured to not write apport reports
dpkg-deb: error: subprocess paste
was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/git_1%3a1.7.7-1_amd64.deb

also see:

git - too many hardlinks in /usr/lib/git-core
http://bugs.debian.org/642603

While above bug might be fixed by using symlinks or by some other workaround, I think this limit will be hit more likely as BTRFS matures. I think it should be fixed, before the experimental flag of BTRFS is removed.

Ciao,

Signature · 2 lines
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
#10 lore raw
Quoted 3 lines · Martin Steigerwald

What is the status of fixing the limits of hardlinks in BTRFS?

It is now easy to hit on Debian systems that have git package installed:

I too wonder if there still is an intention to fix this... I'd expect to see much more breakage like this once some distribution adopts btrfs as the default filesystem. If this is not going to be fixed in btrfs, perhaps we should start considering it a possible bug in programs that trigger it (that's apparently the way it was fixed in Debian for git)?

Sami