Add special case for BTRFS when creating swap
This commit is contained in:
parent
bbe928f340
commit
a1abd04580
@ -320,8 +320,14 @@ def main():
|
||||
print("Creating swap ...")
|
||||
hasSwap = False
|
||||
try:
|
||||
call(["dd","if=/dev/zero","of=" +ipth("swap"),"bs=1M","count=512","status=progress"])
|
||||
call(["chmod","600",ipth("swap")])
|
||||
if formatPartition == "btrfs":
|
||||
call(["truncate","-s","0",ipth("swap")])
|
||||
call(["chattr","+C",ipth("swap")])
|
||||
call(["fallocate","-l","512M",ipth("swap")])
|
||||
else:
|
||||
call(["dd","if=/dev/zero","of=" +ipth("swap"),"bs=1M","count=512","status=progress"])
|
||||
|
||||
call(["chmod","0600",ipth("swap")])
|
||||
call(["mkswap",ipth("swap")])
|
||||
call(["swapon",ipth("swap")])
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user