Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/raw_format.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3

from subprocess import call
from subprocess import check_call
import sys
import argparse
sys.path.append('/usr/lib/mintstick')
Expand All @@ -9,8 +9,8 @@

def execute(command):
syslog.syslog(str(command))
call(command)
call(["sync"])
check_call(command)
check_call(["sync"])

def raw_format(device_path, fstype, volume_label, uid, gid):

Expand All @@ -36,6 +36,10 @@ def raw_format(device_path, fstype, volume_label, uid, gid):
# If it starts at 0% or 0MB, it's not aligned to MB's and complains
execute(["parted", device_path, "mkpart", "primary", partition_type, "1MiB", "100%"])

# Make sure the kernel and udev see the new partition geometry before formatting it.
execute(["partprobe", device_path])
execute(["udevadm", "settle", "--timeout=10", "--exit-if-exists=%s" % partition_path])

# Call wipefs on the new partitions to avoid problems with old filesystem signatures
execute(["wipefs", "-a", partition_path, "--force"])

Expand Down
Loading