Skip to content

Instantly share code, notes, and snippets.

@Breakthrough
Last active December 2, 2023 07:39
Show Gist options
  • Save Breakthrough/2e7ec5ac2e1e5127f34b8ff3797d7601 to your computer and use it in GitHub Desktop.
Save Breakthrough/2e7ec5ac2e1e5127f34b8ff3797d7601 to your computer and use it in GitHub Desktop.
Bash script to show the progress of ntfsresize while installing Xubuntu (or other Debian-based variants) using the GUi installer and resizing an NTFS partition, only to be frustrated with the lack of zero time estimate or progress indicator.
$> sudo strace -p `pidof "ntfsresize"` -e trace=write 2>&1 | grep 'write(1'
[...]
write(1, " 87.38 percent completed\r", 25) = 25
write(1, " 87.38 percent completed\r", 25) = 25
write(1, " 87.92 percent completed\r", 25) = 25
write(1, " 87.92 percent completed\r", 25) = 25
[...]
write(1, "100.00 percent completed\r", 25) = 25
write(1, "100.00 percent completed\r", 25) = 25
write(1, "100.00 percent completed\r", 25) = 25
write(1, "100.00 percent completed\n", 25) = 25
write(1, "Updating $BadClust file ...\nUpda"..., 749) = 749
#!/bin/sh
# Used because Xubuntu installer doesn't have a progress bar for ntfsresize operations.
# Hit Ctrl+Alt+T to open a command prompt, and either use wget to download this file, or
# just copy and paste this text into a file show_ntfsresize.sh, then use chmod +x to make
# it executable, and bam, run ./show_ntfsresize.sh! :D
sudo strace -p `pidof "ntfsresize"` -e trace=write 2>&1 | grep 'write(1'
# (note: requires ntfsresize to actually be running, i.e. the output of
# `pidof "ntfsresize"` is not blank/null)
@vulcan25
Copy link

Very Useful! I was installing Ubuntu and used the GUI tool to resize my windows partition, which doesn't have a status monitor. After a long wait I was concerned that it had frozen/stalled, and was able to run this command from the terminal which shows the percentage climbing.

@queenbiscuit311
Copy link

queenbiscuit311 commented Dec 2, 2023

I found this while google searching several years later and it allowed me to see the progress of a gparted ntfs resize operation after the gui froze when i tried applying it, but it was still doing what it was supposed to do in the background. Thank you for posting this! Otherwise I would've been stuck wondering it was actually still working or if it had just silently nuked my drive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment