Giter VIP home page Giter VIP logo

nullfsvfs's Introduction

nullfsvfs CI on ubuntu-latest

nullfs

A virtual file system that behaves like /dev/null

It can handle regular file operations like mkdir/rmdir/ln but writing to files does not store any data. The file size is however saved, reading from the files behaves like reading from /dev/zero.

Writing and reading is basically an NOOP, so it can be used for performance testing with applications that require directory structures. Implemented as kernel module, instead of using FUSE, there is absolutely no overhead for copying application data from user to kernel space while performing write or read operations.

alt text

# sudo make
make -C /lib/modules/4.18.5/build M=/home/abi/lwnfs modules
make[1]: Entering directory '/usr/src/linux-headers-4.18.5'
  Building modules, stage 2.
  MODPOST 1 modules
make[1]: Leaving directory '/usr/src/linux-headers-4.18.5'

# insmod nullfs.ko 
# mkdir /sinkhole
# mount -t nullfs none /sinkhole/
# mkdir /sinkhole/testdir
# touch /sinkhole/testdir/myfile
# echo foobar > /sinkhole/testdir/myfile
# ls -lah /sinkhole/testdir/myfile
-rw-r--r-- 1 root root 0 Nov  8 20:17 /sinkhole/testdir/myfile
# cat /sinkhole/testdir/myfile
# pv < /dev/zero > /sinkhole/testdir/myfile
11.1GiB 0:00:04 [3.85GiB/s] [     <=>      ] 
# cat /sinkhole/testdir/myfile
# 

File size is preserved to work around applications that do size checks:

# dd if=/dev/zero of=/nullfs/DATA bs=1M count=20
20+0 records in
20+0 records out
20971520 bytes (21 MB, 20 MiB) copied, 0.00392452 s, 5.3 GB/s
# stat -c%s /nullfs/DATA
20971520

Reading from the files does not copy anything to userspace and is an NOOP; makes it behave like reading from /dev/zero:

# dd if=/nullfs/DATA of=/tmp/REALFILE
40960+0 records in
40960+0 records out
20971520 bytes (21 MB, 20 MiB) copied, 0.0455288 s, 461 MB/s
# hexdump -C /tmp/REALFILE
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

installation

manual installation

To install the module for the running linux kernel use:

 # make -C /lib/modules/$(uname -r)/build M=$PWD modules_install INSTALL_MOD_DIR=kernel/fs/nullfs
 # depmod

Running depmod is mandatory. Now the module can be loaded via:

 # modprobe nullfs

To automatically load the module during system boot, create a configuration file suitable for your distribution (usually located in /etc/modules-load.d):

 # echo nullfs > /etc/modules-load.d/nullfs.conf

Example entry for /etc/fstab, mounting the filesystem to /nullfs:

none    /nullfs nullfs auto

debian package

 # apt-get install debhelper dkms dh-dkms
 # dpkg-buildpackage -uc -us -rfakeroot
 # dpkg -i ../nullfsvfs_<version>_amd64.deb

Usage

Keeping file data

There is the possibility to exclude certain files from being sent into the void. If, for example, the file matching "fstab" should be kept in memory, mount nullfs with the "write=" option.

# mount -t nullfs none /sinkhole/ -o write=fstab
# cp /etc/fstab /sinkhole/
# wc -l /sinkhole/fstab 
14 /sinkhole/fstab
# cp /etc/passwd /sinkhole/
# wc -l /sinkhole/passwd 
0 /sinkhole/passwd

Another option is using the sysfs interface to change the exclude string after the module has been loaded:

 # echo foo  > /sys/fs/nullfs/exclude

Keep in mind that file data is kept in memory and no boundary checks are done, so this might fill up your RAM in case you exclude big files from being nulled.

ACL

It is possible to set POSIX ACL attributes via setfacl so it appears the filesystem supports them, they are not saved.

Works with recent linux kernels (5.x), nullfs builds fine with older kernels (4.x, 3.x) but setting ACL information fails with "Operation not supported".

usecases

See: Use Cases

The module has been used for performance testing with redis, see:

https://www.usenix.org/system/files/atc20-george.pdf

Please report usecases as regular issues!

supported mount options

The following mount options are supported:

 -o mode=      set permissions on mount directory ( mount .. -o mode=777 )
 -o uid=       set uid on mount directory ( mount .. -o uid=1000 )
 -o gid=       set gid on mount directory ( mount .. -o gid=1000 )
 -o write=fn   keep data for specific file ( mount .. -o write=fstab )

todos/ideas

  • replace simple_statfs call with real one, show free space of a directory that can be passed during kernel module load
  • support multiple parameters for write= option
  • allow regex for write= option via trace.h
  • simulate xattr support?

nullfsvfs's People

Contributors

abbbi avatar terraluna977 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nullfsvfs's Issues

Doesn't build on kernel 5.14.2: ‘simple_readpage’ and ‘simple_write_end’ undeclared

==> dkms install --no-depmod -m nullfsvfs -v 0.9 -k 5.14.2-arch1-2
Error! Bad return status for module build on kernel: 5.14.2-arch1-2 (x86_64)
Consult /var/lib/dkms/nullfsvfs/0.9/build/make.log for more information.

make-log:

DKMS make.log for nullfsvfs-0.9 for kernel 5.14.2-arch1-2 (x86_64)
2021-09-10T11:45:41 CEST
make: Entering directory '/usr/lib/modules/5.14.2-arch1-2/build'
  CC [M]  /var/lib/dkms/nullfsvfs/0.9/build/nullfs.o
/var/lib/dkms/nullfsvfs/0.9/build/nullfs.c:204:20: error: ‘simple_readpage’ undeclared here (not in a function); did you mean ‘simple_rename’?
  204 |     .readpage    = simple_readpage,
      |                    ^~~~~~~~~~~~~~~
      |                    simple_rename
/var/lib/dkms/nullfsvfs/0.9/build/nullfs.c:206:20: error: ‘simple_write_end’ undeclared here (not in a function); did you mean ‘simple_write_begin’?
  206 |     .write_end   = simple_write_end,
      |                    ^~~~~~~~~~~~~~~~
      |                    simple_write_begin
make[1]: *** [scripts/Makefile.build:271: /var/lib/dkms/nullfsvfs/0.9/build/nullfs.o] Error 1
make: *** [Makefile:1851: /var/lib/dkms/nullfsvfs/0.9/build] Error 2
make: Leaving directory '/usr/lib/modules/5.14.2-arch1-2/build'

gcc (GCC) 11.1.0

[Usecase] Keep Chrome from needlessly chewing up GBs of worthless cache files

HowTo

sudo modprobe nullfs
sudo mkdir -p /media/sinkhole
sudo mount -t nullfs none /media/sinkhole
rm -rvf ~/.cache/{chromium,google-chrome}/Default/Cache
ln -s /media/sinkhole ~/.cache/chromium/Default/Cache
ln -s /media/sinkhole ~/.cache/google-chrome/Cache

Before

$ du -h ~/.cache/chromium/Default/Cache/;
747M	/home/tsmith/.cache/chromium/Default/Cache/
458M	/home/tsmith/.cache/google-chrome/Default/Cache/
1.2G    total

After

0	/home/tsmith/.cache/chromium/Default/Cache/
0	/home/tsmith/.cache/google-chrome/Default/Cache/
0	total

It also will save on SSD wear-and-tear, and you won't even notice a performance drag as everything's stored in memory anyway.

Won't make on a Centos 7.8 system

I'm sure its a simple library or something but...

I also wouldn't blame you if you want to leave this old version in the dust, it does work fine on Centos8 and Fedora32.

Thanks!

make -C /lib/modules/3.10.0-1127.18.2.el7.x86_64/build M=/home/preese/nullfsvfs modules
make[1]: Entering directory /usr/src/kernels/3.10.0-1127.18.2.el7.x86_64' CC [M] /home/preese/nullfsvfs/nullfs.o /home/preese/nullfsvfs/nullfs.c:116:5: error: unknown field ‘read_iter’ specified in initializer .read_iter = generic_file_read_iter, ^ /home/preese/nullfsvfs/nullfs.c:116:19: error: ‘generic_file_read_iter’ undeclared here (not in a function) .read_iter = generic_file_read_iter, ^ /home/preese/nullfsvfs/nullfs.c:117:5: error: unknown field ‘write_iter’ specified in initializer .write_iter = generic_file_write_iter, ^ /home/preese/nullfsvfs/nullfs.c:117:19: error: ‘generic_file_write_iter’ undeclared here (not in a function) .write_iter = generic_file_write_iter, ^ /home/preese/nullfsvfs/nullfs.c: In function ‘nullfs_get_inode’: /home/preese/nullfsvfs/nullfs.c:230:13: error: implicit declaration of function ‘inode_nohighmem’ [-Werror=implicit-function-declaration] inode_nohighmem(inode); ^ cc1: some warnings being treated as errors make[2]: *** [/home/preese/nullfsvfs/nullfs.o] Error 1 make[1]: *** [_module_/home/preese/nullfsvfs] Error 2 make[1]: Leaving directory /usr/src/kernels/3.10.0-1127.18.2.el7.x86_64'
make: *** [ko] Error 2

License

What license is this under? Thanks in advance :)

Mount it with 777 rights

Hello,
I tried this in fstab, but it doesn't work:
none /nullfs nullfs default,umask=0000,gid=1000,uid=1000,rw,user,nosuid
I'm getting 755 and owner root:root everytime.
How to mount nullfs with 777 rights?

recent addition for uid/gid breaks backwards compatibility

On the master branch, the change to nullfs.c to allow for specifying a specific uid or gid in the mount options, breaks things a bit! The code will now default to using root uid/gid when new inodes are created. Previous code allowed for the uid/gid fields of the new inode to be that of the user creating the file. Seems like some conditional code is needed to restore beauty.

Can't build on Alma Linux 9.4

I have already opened a ticket to Alma Support.

I can't build the module because of this error:

make -C /lib/modules/5.14.0-427.13.1.el9_4.x86_64/build M=/home/toto/nullfsvfs-master modules
make[1]: Entering directory '/usr/src/kernels/5.14.0-427.13.1.el9_4.x86_64'
  CC [M]  /home/toto/nullfsvfs-master/nullfs.o
/home/toto/nullfsvfs-master/nullfs.c: In function ‘nullfs_tmpfile’:
/home/toto/nullfsvfs-master/nullfs.c:560:15: error: passing argument 1 of ‘d_tmpfile’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  560 |     d_tmpfile(dentry, inode);
      |               ^~~~~~
      |               |
      |               struct dentry *
In file included from ./include/linux/fs.h:8,
                 from ./include/linux/seq_file.h:12,
                 from /home/toto/nullfsvfs-master/nullfs.c:30:
./include/linux/dcache.h:254:23: note: expected ‘struct file *’ but argument is of type ‘struct dentry *’
  254 | extern void d_tmpfile(struct file *, struct inode *);
      |                       ^~~~~~~~~~~~~
/home/toto/nullfsvfs-master/nullfs.c: At top level:
/home/toto/nullfsvfs-master/nullfs.c:581:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct file *, umode_t)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct file *, short unsigned int)’} from incompatible pointer type ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, umode_t)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, short unsigned int)’} [-Werror=incompatible-pointer-types]
  581 |     .tmpfile    = nullfs_tmpfile,
      |                   ^~~~~~~~~~~~~~
/home/toto/nullfsvfs-master/nullfs.c:581:19: note: (near initialization for ‘nullfs_dir_inode_operations.tmpfile’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:299: /home/toto/nullfsvfs-master/nullfs.o] Error 1
make[1]: *** [Makefile:1934: /home/toto/nullfsvfs-master] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.14.0-427.13.1.el9_4.x86_64'
make: *** [Makefile:5: ko] Error 2

Kernel version is < 6.1.0:
5.14.0-427.13.1.el9_4.x86_64

still in the kernel header as long as I could see, the declaration of d_tmpfile is:
extern void d_tmpfile(struct file *, struct inode *);

hence the issue building the module.

Any idea?

Thanks!

Failing to build with kernel 6.5.2

Hello, I'm trying to get this build on openSUSE Tumbleweed which has all the newest software stack in :-)
unfortunately the make simply failed with kernl 6.5.2

make -C /lib/modules/6.5.2-1-default/build M=/git/nullfsvfs modules
make[1]: Entering directory '/usr/src/linux-6.5.2-1-obj/x86_64/default'
  CC [M]  /git/nullfsvfs/nullfs.o
/git/nullfsvfs/nullfs.c:60:6: error: ‘posix_acl_access_xattr_handler’ undeclared here (not in a function); did you mean ‘posix_acl_xattr_header’?
   60 |     &posix_acl_access_xattr_handler,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |      posix_acl_xattr_header
/git/nullfsvfs/nullfs.c:61:6: error: ‘posix_acl_default_xattr_handler’ undeclared here (not in a function); did you mean ‘posix_acl_xattr_header’?
   61 |     &posix_acl_default_xattr_handler,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |      posix_acl_xattr_header
make[3]: *** [/usr/src/linux-6.5.2-1/scripts/Makefile.build:244: /git/nullfsvfs/nullfs.o] Error 1
make[2]: *** [/usr/src/linux-6.5.2-1/Makefile:2049: /git/nullfsvfs] Error 2
make[1]: *** [../../../linux-6.5.2-1/Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-6.5.2-1-obj/x86_64/default'
make: *** [Makefile:5: ko] Error 2

Maybe you have some ideas about how to fix that.
(of course beside the kernel development, I also have the following installed
libacl-devel-2.3.1-2.11
libattr-devel-2.5.1-1.27

PPA

Hi again,

Can you create an entry in launchpad ?

https://launchpad.net/ubuntu/+search?text=nullfsvfs

For having a packaged .DEB file which use DKMS and be load on each boot?

it will be more simple to use it as PPA and ask ubuntu to integrate it in futur distrib...

Doesnt build with kernel 5.12: too few arguments to function ‘inode_init_owner’

I get a lot warnings, treated as errors, about incompatible pointer types:

DKMS make.log for nullfs-0.3.r2.g802930f for kernel 5.12.2-153-tkg-MuQSS (x86_64)
Mon May 17 20:06:31 CEST 2021
make: Entering directory '/usr/lib/modules/5.12.2-153-tkg-MuQSS/build'
  CC [M]  /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.o
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: In function ‘nullfs_getattr’:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:86:19: error: passing argument 1 of ‘generic_fillattr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   86 |  generic_fillattr(inode, stat);
      |                   ^~~~~
      |                   |
      |                   struct inode *
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:3212:23: note: expected ‘struct user_namespace *’ but argument is of type ‘struct inode *’
 3212 | void generic_fillattr(struct user_namespace *, struct inode *, struct kstat *);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:86:26: error: passing argument 2 of ‘generic_fillattr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   86 |  generic_fillattr(inode, stat);
      |                          ^~~~
      |                          |
      |                          struct kstat *
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:3212:48: note: expected ‘struct inode *’ but argument is of type ‘struct kstat *’
 3212 | void generic_fillattr(struct user_namespace *, struct inode *, struct kstat *);
      |                                                ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:86:2: error: too few arguments to function ‘generic_fillattr’
   86 |  generic_fillattr(inode, stat);
      |  ^~~~~~~~~~~~~~~~
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:3212:6: note: declared here
 3212 | void generic_fillattr(struct user_namespace *, struct inode *, struct kstat *);
      |      ^~~~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: At top level:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:144:19: error: initialization of ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, u32,  unsigned int)’ {ak
a ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, unsigned int,  unsigned int)’} from incompatible pointer type ‘int (*)(const struct path *, struct kstat *,
 u32,  unsigned int)’ {aka ‘int (*)(const struct path *, struct kstat *, unsigned int,  unsigned int)’} [-Werror=incompatible-pointer-types]
  144 |     .getattr    = nullfs_getattr,
      |                   ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:144:19: note: (near initialization for ‘nullfs_file_inode_operations.getattr’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: In function ‘nullfs_get_inode’:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:26: error: passing argument 1 of ‘inode_init_owner’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  264 |         inode_init_owner(inode, dir, mode);
      |                          ^~~~~
      |                          |
      |                          struct inode *
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1829:46: note: expected ‘struct user_namespace *’ but argument is of type ‘struct inode *’
 1829 | void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
      |                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:33: warning: passing argument 2 of ‘inode_init_owner’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  264 |         inode_init_owner(inode, dir, mode);
      |                                 ^~~
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1829:72: note: expected ‘struct inode *’ but argument is of type ‘const struct inode *’
 1829 | void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
      |                                                          ~~~~~~~~~~~~~~^~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:38: warning: passing argument 3 of ‘inode_init_owner’ makes pointer from integer without a cast [-Wint-conversion]
  264 |         inode_init_owner(inode, dir, mode);
      |                                      ^~~~
      |                                      |
      |                                      umode_t {aka short unsigned int}
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1830:29: note: expected ‘const struct inode *’ but argument is of type ‘umode_t’ {aka ‘short unsigned int’}
 1830 |         const struct inode *dir, umode_t mode);
      |         ~~~~~~~~~~~~~~~~~~~~^~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:9: error: too few arguments to function ‘inode_init_owner’
  264 |         inode_init_owner(inode, dir, mode);
      |         ^~~~~~~~~~~~~~~~
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1829:6: note: declared here
 1829 | void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
      |      ^~~~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: At top level:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:374:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, umode_t,  bool)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, short unsigned int,  _Bool)’} from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, umode_t,  bool)’ {aka ‘int (*)(struct inode *, struct dentry *, short unsigned int,  _Bool)’} [-Werror=incompatible-pointer-types]
  374 |     .create     = nullfs_create,
      |                   ^~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:374:19: note: (near initialization for ‘nullfs_dir_inode_operations.create’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:378:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, const char *)’ from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, const char *)’ [-Werror=incompatible-pointer-types]
  378 |     .symlink    = nullfs_symlink,
      |                   ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:378:19: note: (near initialization for ‘nullfs_dir_inode_operations.symlink’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:379:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, umode_t)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, short unsigned int)’} from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, umode_t)’ {aka ‘int (*)(struct inode *, struct dentry *, short unsigned int)’} [-Werror=incompatible-pointer-types]
  379 |     .mkdir      = nullfs_mkdir,
      |                   ^~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:379:19: note: (near initialization for ‘nullfs_dir_inode_operations.mkdir’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:381:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, umode_t,  dev_t)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, short unsigned int,  unsigned int)’} from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, umode_t,  dev_t)’ {aka ‘int (*)(struct inode *, struct dentry *, short unsigned int,  unsigned int)’} [-Werror=incompatible-pointer-types]
  381 |     .mknod      = nullfs_mknod,
      |                   ^~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:381:19: note: (near initialization for ‘nullfs_dir_inode_operations.mknod’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:383:19: error: initialization of ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, u32,  unsigned int)’ {aka ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, unsigned int,  unsigned int)’} from incompatible pointer type ‘int (*)(const struct path *, struct kstat *, u32,  unsigned int)’ {aka ‘int (*)(const struct path *, struct kstat *, unsigned int,  unsigned int)’} [-Werror=incompatible-pointer-types]
  383 |     .getattr    = nullfs_getattr,
      |                   ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:383:19: note: (near initialization for ‘nullfs_dir_inode_operations.getattr’)
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:271: /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.o] Error 1
make: *** [Makefile:1854: /var/lib/dkms/nullfs/0.3.r2.g802930f/build] Error 2
make: Leaving directory '/usr/lib/modules/5.12.2-153-tkg-MuQSS/build'

[Usecase] RepoSync

We use an Ubuntu LTS with Docker to have repository proxy using Sonatype Nexus3

For some distro (RHEL) we want to keep every installable package other times even if not anymore online.

We can do a reposync but :
1/ I don't want to consume both time some space
2/ I want everything in the same interface (Nexus3)

Nexus3 don't manage mirrors, so I create a docker redhat-ubi using my Nexus proxy to do a reposync.

It will place all file in my proxy and don't use space twice cause reposync use a nullfs ;-)

To do that you need nullfs loaded on the host (Ubuntu) and docker --privileged for container can use mount

Thx again for your amazing work

Unable to build package it on Ubuntu 22.04 server

When I build the deb package in the server, it says

root@localhost:~/nullfsvfs-0.17# dpkg-buildpackage -r fakeroot
dpkg-buildpackage: error: unknown option or argument fakeroot

Use --help for program usage information.

I then tried the following command and it says

dpkg-buildpackage: info: source package nullfsvfs
dpkg-buildpackage: info: source version 0.17
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Michael Ablassmeier [email protected]
dpkg-buildpackage: info: host architecture amd64
dpkg-source --before-build .
debian/rules clean
dh clean --with dkms
dh_auto_clean
make -j1 clean
make[1]: Entering directory '/root/nullfsvfs-0.17'
make -C /lib/modules/5.15.0-91-generic/build M=/root/nullfsvfs-0.17 clean
make[2]: Entering directory '/usr/lib/modules/5.15.0-91-generic/build'
ls
Makefile
make[2]: Leaving directory '/usr/lib/modules/5.15.0-91-generic/build'
make[1]: Leaving directory '/root/nullfsvfs-0.17'
dh_clean
dpkg-source -b .
dpkg-source: info: using source format '3.0 (native)'
dpkg-source: info: building nullfsvfs in nullfsvfs_0.17.tar.xz
dpkg-source: info: building nullfsvfs in nullfsvfs_0.17.dsc
debian/rules build
dh build --with dkms
dh_update_autotools_config
dh_autoreconf
dh_auto_configure
dh_auto_build
make -j1
make[1]: Entering directory '/root/nullfsvfs-0.17'
make -C /lib/modules/5.15.0-91-generic/build M=/root/nullfsvfs-0.17 modules
make[2]: Entering directory '/usr/lib/modules/5.15.0-91-generic/build'
make[2]: *** No rule to make target 'modules'. Stop.
make[2]: Leaving directory '/usr/lib/modules/5.15.0-91-generic/build'
make[1]: *** [Makefile:5: ko] Error 2
make[1]: Leaving directory '/root/nullfsvfs-0.17'
dh_auto_build: error: make -j1 returned exit code 2
make: *** [debian/rules:6: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

Could you help me solve it? Thanks!

Easily selectively destroy temp files

The Problem

Linux stores lots of cache files I don't give a damn about that take up many GBs of space. Today, I just reclaimed over 23 GB of space from just deleting one user's ~/.cache/ directories.

The issue arises that rm is not very safe and is very unwieldly when it comes to excluding patterns of files/directories I want to keep, while also having various race conditions of not deleting files added once the process starts.

To get past this, I wanted to use rsync, but it has no ability to JUST delete files. You have to copy them somewhere, first.

The Solution

Enter nullfsvfs:

This is what I now have in my /etc/cron.daily/clean-cache:

#!/bin/bash

rsync -rv --remove-source-files --exclude={composer,spotify,skype,thumbnails,vim} /home/*/.cache/ /run/media/sinkhole/
for user in `ls /home`; do
    find /home/$user/.cache/ -type d -empty -delete
done

Update: I have officially released this as part of my BashScripts collection:

https://github.com/hopeseekr/BashScripts/blob/master/cron.daily/00_clear-cache

image

setfacl fails with older kernels (4.x 3.x)

Module includes all required function definitions to build with ACL support on older kernels but attempting to set acl information fails with:

setfacl -m u:root:r /mnt/file
setfacl: /mnt/file: Operation not supported

Probably a few things are missing here which are handled by the generic_acl_access_handler functions exported
by newer kernel versions. I could not make it work, help welcome (if required)

Can't use it on Ubuntu 18.04.6 LTS

Hi @abbbi
First of all, thank you for this great project! Occasionally it helps me to tackle network issues.
Today I tried to use it once again and encountered the following problem.

# uname -a
Linux homemain 4.15.0-192-generic #203-Ubuntu SMP Wed Aug 10 17:40:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
# make -C /lib/modules/$(uname -r)/build M=$PWD modules_install INSTALL_MOD_DIR=kernel/fs/nullfs
make: Entering directory '/usr/src/linux-headers-4.15.0-192-generic'
  DEPMOD  4.15.0-192-generic
make: Leaving directory '/usr/src/linux-headers-4.15.0-192-generic'
# depmod
# modprobe  nullfs
modprobe: FATAL: Module nullfs not found in directory /lib/modules/4.15.0-192-generic

Tried both 0.12.1 and master branch.
Do you have any suggestions?

[Usecase] Discard systemd related files when installing Arch packages on Artix Linux

  1. Install nullfsvfs-dkms from the AUR, if it fails to compile you may need to compile it yourself.
  2. In /etc/mkinitcpio.conf, add in the modules MODULES(nullfs)
  3. In /etc/fstab add these lines
none /etc/systemd nullfs defaults 0 0
none /usr/lib/systemd nullfs defaults 0 0
  1. Any packages that try to put systemd related files on your system will put them in the void!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.