9

I have external hard drive which is 300GB. I set it to format to NTFS. Well there wasn't FAT32 in the list, though I know on Windows it asks me to set FAT32 because it has large capacity.

It started formating but I didn't get any window that shows progress. I just see the LED diode flashing all the time, meaning the disk works something.

I also tried to restart the PC but it asked me for my user password with a message that I should not restart at this time.

How can I know the progress of formatting my external hard drive on Ubuntu 16.04 ?

PS. should I close my PC forcefully?

11
  • 1
    Which tool are you using? Some tools will only show, that you have finished, when you have finished, but no really useful progress information. But it should not be too slow, try to wait for it to finish (for a few minutes).
    – sudodus
    Oct 7, 2017 at 17:06
  • 2
    @sudodus I don't remember the tool. Its just right click on the drive icon in the task bar(Unity) and then I pressed format. But it took like 2 hours now, still blinking diode.
    – Vlad
    Oct 7, 2017 at 17:08
  • 1
    @sudodus yes it is on USB 2, and yes I chose slow format, not a quick format. Its been a while since I formated it. I wanted it to be clean from garbage.
    – Vlad
    Oct 7, 2017 at 17:14
  • 3
    Slow format on USB 2. Well, it is probably working like it should (and you are probably using Disks alias gnome-disks under the hood). I suggest that you are patient and wait (probably for some more hours) if possible.
    – sudodus
    Oct 7, 2017 at 17:16
  • 1
    yes full format is very slow as it writes every block. a quick format just rewrites the file table
    – ravery
    Oct 7, 2017 at 17:32

5 Answers 5

21

I had a similar situation where I right clicked a previously created partition on an external drive to reformat it. Once it had started there was no window of any sort to show the progress of the formatting. My solution was to open the Disk Utility which can easily be installed if it is not already available.

Once I opened Disk Utility I was able to select the partition being formatted and view the progress bar together with an estimation of the time remaining.

Note: when looking for Disk Utility amongst your apps only enter the term Disk as that is what it shows up as.

4
  • 3
    For Disk Utility, to install - within CLI enter 'sudo apt-get install gnome-disk-utility'; to run from CLI enter command 'gnome-disks'; to run from GUI push 'Disks' icon Apr 10, 2018 at 6:39
  • 2
    This should be the accepted answer. Oct 27, 2018 at 12:53
  • Yes, running the 'gnome-disks' command starts the GUI, which actually connects to whatever background format operation is going on, and at least gives a spinning wheel thing to show stuff is happening. Sadly, it doesn't appear to show the actual progress, only ongoing activity. Sep 24, 2019 at 0:14
  • Right-click on disk in file browser -> Format... led to gnome-disks (named "Disks" on my Ubuntu 18.04) which still formatted my USB key without feedback (it just got hot and never finished formatting). But generally speaking, using another disk management app could be your solution. I used gparted and it has a nice popup with a progress bar (although formatting was so fast I didn't even get to see progress filling). I needed to right-click > Unmount beforehand and it took some time though. I also had to remount at the end and only gnome-disks did it properly without having to replug the key.
    – hsandt
    Aug 13, 2021 at 19:43
3

After a dialogue as comments, we can conclude

  • "I right clicked on the drive icon in the task bar(Unity) and then I pressed format."

  • Slow format on a USB 2 drive was selected for NTFS on 300 GB.

  • This will last for between 2 and 3 hours, and there is no feedback during the process, except signs that the computer and target drive are busy.

  • It was easy to see that the formatting was successful in the end.

2

I rewrote @MarcelK's script in more modern way, fix some bugs and shellcheck issues.

#!/bin/bash

DEVICE=sdb
PARTITION=sdb1

test -b /dev/$DEVICE
test -b /dev/$PARTITION
test -d /sys/block/$DEVICE
test -d /sys/block/$DEVICE/$PARTITION

TOTAL_SECTORS=$(fdisk -l /dev/$PARTITION | tee /dev/null | grep " sectors$" | cut -f3 -d, | cut -f2 -d" ")
SECTOR_SIZE=$(fdisk -l /dev/$PARTITION | tee /dev/null | grep "^Units" | cut -f8 -d" ")
 
# You can optionally put the lines below to a loop
WRITTEN_SECTORS=$(cat /sys/block/$DEVICE/$PARTITION/stat | awk "{ print $7 }")
PERCENTAGE=$(("$WRITTEN_SECTORS" * 100 / "$TOTAL_SECTORS"))
WRITTEN_MB=$(("$WRITTEN_SECTORS" * "$SECTOR_SIZE" / 1024 / 1024))

READ_SECTORS=$(cat /sys/block/$DEVICE/$PARTITION/stat | awk "{ print $3 }")
READ_MB=$(("$READ_SECTORS" * "$SECTOR_SIZE" / 1024 / 1024 ))

echo "Written $WRITTEN_SECTORS sectors of $TOTAL_SECTORS (${PERCENTAGE}%) (${WRITTEN_MB}MB written, ${READ_MB}MB read)"

I'm using Ubuntu 22.04 and I don't know if they added a progress display in more modern GNOME, but this script saved me.

0

I'm running on Ubuntu 18.04, but I suspect 16.04 should be the same. I recently had the same question and did some poking at it. I have an external HD that I wanted to format as a backup disk, the format ran for a long time but there was no information on how long it should take.

According to https://www.kernel.org/doc/Documentation/block/stat.txt , there is a counter of the number of sectors written. For a disk that is just added or partition just created, this number should start close to zero, and a format should be a simple linear write instead of skipping all around. So for my partition /dev/sda1, the number of sectors written can be found in /sys/block/sda/sda1/stat looking at the 7th field. Then you need to figure out the total number of sectors. To get that, I ran "fdisk -l /dev/sda1" and the number is present on the first line.

root@ubuntu:~/bin# fdisk -l /dev/sda1
Disk /dev/sda1: 4.1 TiB, 4501023490560 bytes, 8791061505 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Alignment offset: 512 bytes

Then if you can occasionally check the stat value and compare it to the total, you should have an idea of the progress. I'll include here a small shell script to print the percentage of progress. Using this, I was able to estimate that formatting my 4.5TB disk would take about 4 days, after letting it run for a day. Yeah, it is a cheap/slow external disk.

#!/bin/bash

# set -x

# look in /sys/block for this value
DEVICE=sda
# look in /sys/block/$DEVICE for this value
PARTITION=sda1

test -b /dev/$DEVICE
test -b /dev/$PARITION
test -d /sys/block/$DEVICE
test -d /sys/block/$DEVICE/$PARTITION

TOTAL_SECTORS=`fdisk -l /dev/$PARTITION 2>/dev/null | grep ' sectors$' | cut -f3 -d, | cut -f2 -d' '`
SECTOR_SIZE=`fdisk -l /dev/$PARTITION 2>/dev/null | grep '^Units' | cut -f8 -d' '`

while [ : ]
do
    WRITTEN_SECTORS=`cat /sys/block/$DEVICE/$PARTITION/stat | awk '{ print $7 }'`
    PERCENTAGE=`expr $WRITTEN_SECTORS \* 100 / $TOTAL_SECTORS`
    WRITTEN_MB=`expr $WRITTEN_SECTORS \* $SECTOR_SIZE / 1024 / 1024`

    READ_SECTORS=`cat /sys/block/$DEVICE/$PARTITION/stat | awk '{ print $3 }'`
    READ_MB=`expr $READ_SECTORS \* $SECTOR_SIZE / 1024 / 1024`

    echo "Written $WRITTEN_SECTORS sectors of $TOTAL_SECTORS (${PERCENTAGE}%) (${WRITTEN_MB}MB written, ${READ_MB}MB read)"
    sleep 1
done
0

Q: What happened to my disk when formatting?

I right clicked and selected format on my external drive in nautilus. Nothing happened and the disk disappeared.

A: It takes time and the disk returns when formatting completes.

I opted to erase and it looks like it takes roughly 80 minutes / TB. To view the progress you can open gnome-disk-utility (in i3 or from terminal:gnome-disks).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .