avatar
mikhailnov has added 9bf5ab7f29
Disable Copy-on-Write for loopback/swap file
view file @ 9bf5ab7f29
... ... --- a/perl-install/fs/loopback.pm
... ... +++ b/perl-install/fs/loopback.pm
... ... @@ -74,6 +74,12 @@ sub create {
74 74
    for (my $i = 0; $i < $part->{size}; $i += $block_size) {
75 75
	syswrite $F, $s or die "failed to create loopback file";
76 76
    }
77
    # Disable Copy-on-Write for loopback/swap file, useful for swap on BTRFS
78
    # In case this xattr is not supported by the filesystem, an error will occur:
79
    # "Inappropriate ioctl for device", - that's OK, ignore it
80
    my $cmd_chattr = "chattr +C " . $F . " 2>/dev/null || :";
81
    system($cmd_chattr);
82
    undef $cmd_chattr;
77 83
}
78 84
79 85
sub getFree {

Comments