Add support for btrfs subvolumes for user homes

new switch added to useradd command, --btrfs-subvolume-home. When
specified *and* the filesystem is detected as btrfs, it will create a
subvolume for user's home instead of a plain directory. This is done via
`btrfs subvolume` command.  Specifying the new switch while trying to
create home on non-btrfs will result in an error.

userdel -r will handle and remove this subvolume transparently via
`btrfs subvolume` command. Previosuly this failed as you can't rmdir a
subvolume.

usermod, when moving user's home across devices, will detect if the home
is a subvolume and issue an error messages instead of copying it. Moving
user's home (as subvolume) on same btrfs works transparently.
This commit is contained in:
Adam Majer
2019-01-21 09:32:36 +01:00
committed by Serge Hallyn
parent caefe9e8de
commit c1d36a8acb
6 changed files with 158 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ libmisc_a_SOURCES = \
age.c \
audit_help.c \
basename.c \
btrfs.c \
chkname.c \
chkname.h \
chowndir.c \