Portál AbcLinuxu, 16. července 2025 06:09


Dotaz: Omezení velikosti adresáře

21.10.2006 17:58 xHire | skóre: 21 | blog: Linuxovník
Omezení velikosti adresáře
Přečteno: 362×
Odpovědět | Admin
Potřebuji omezit velikost obsahu adresáře na pevně danou kvótu (např. 50 MB), nad kterou by se nedalo dostat. V mém případě to nemohu udělat pomocí klasických kvót, protože ty jsou vázány na uživatele či skupinu (těchto adresářů (s různými kvótami) je více, takže by to nešlo).

Existuje nějaké řešení? Pokud ne a musel bych si to hlídat třeba nějakým skriptem spouštěným přes cron, dá se nějak adresář (vč. podadresářů samozřejmě) "zamknout", aby do něj nešlo nic nahrávat?

Mockrát díky za odpovědi. :c)
Kryptoměny a bločenka.
Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

21.10.2006 18:03 Zdeněk Burda | skóre: 61 | blog: Zdendův blog | Praha
Rozbalit Rozbalit vše Re: Omezení velikosti adresáře
Odpovědět | | Sbalit | Link | Blokovat | Admin
Kolik těch adresářů potřebuješ takhle omezit a jestli se mohu zeptat, tak k čemu je to dobré?

Jako první věc mě napadlo udělat si soubor o velikosti 50MiB, v něm normální FS a ten si někam přimountovat. Nebo to udělat přes LVM (ale tam to asi nepůjde přesně na XMiB) ať nemusíš dělat soubor... Vím, je to divné řešení, ale protože jsem tento problém ještě nemusel řešit tak teď fakt nevím jak jinak na to.
-- Nezdar není hanbou, hanbou je strach z pokusu.
21.10.2006 20:27 Jirik
Rozbalit Rozbalit vše Re: Omezení velikosti adresáře
Toto řešení se fakt používá, pokud adresářů není příliš mnoho. Limitem je např. počet loop zařízení.

Další možností je snad "project quota" v XFS:

TREE QUOTA The project quota mechanism in XFS can be used to implement a form of directory tree quota, where a specified directory and all of the files and subdirectories below it (i.e. a tree) can be restricted to using a subset of the available space in the filesystem.

A managed tree must be setup initially using the -c option to the project command. The specified project name or identifier is matched to one or more trees defined in /etc/projects, and these trees are then recursively descended to mark the affected inodes as being part of that tree. This process sets an inode flag and the project identifier on every file in the affected tree. Once this has been done, new files created in the tree will automatically be accounted to the tree based on their project identifier. An attempt to create a hard link to a file in the tree will only succeed if the project identifier matches the project identifier for the tree. The xfs_io utility can be used to set the project ID for an arbitrary file, but this can only be done by a privileged user.

A previously setup tree can be cleared from project quota control through use of the project -C option, which will recursively descend the tree, clearing the affected inodes from project quota control.

Finally, the project -c option can be used to check whether a tree is setup, it reports nothing if the tree is correct, otherwise it reports the paths of inodes which do not have the project ID of the rest of the tree, or if the inode flag is not set.

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.