1 (edited by fbml 2019-02-13 14:12:38)

Topic: [Solved] Error during partition resize

Hi,
I need help for a problem occurred during partition  resize. I was extending the second partition from 250 GB to 300, but the process suddenly stopped when 20 GB were already moved. After a reboot, I can open the partition (size now is 300 Gb), but some files (audio) won't open (they can be copied and pasted in another directory, but they cannot be opened); some files can be opened, but the player plays pieces of other files.
Unfortunately I have no backup sad
What can I do? Thanks for your help

2

Re: [Solved] Error during partition resize

We really need the Saved Details from applying the pending operations to be certain what operations GParted was performing and what the exact sector offsets for the partitions were.  Also because GParted rolls back partial moves on failure we need to see exactly what happened and didn't happen in order to provide correct and accurate recovery steps.

Making guesses, you were moving the start of the partition, because that involves moving the data in the partition, as well as resizing the contained file system.  Also assuming you weren't moving the end of the partition.  These steps might recover your file system:

  1. Make an image backup of the whole hard drive.

  2. Outside of GParted, re-create the second partition with it's exact original partition start and end positions.

3 (edited by fbml 2019-02-02 19:18:34)

Re: [Solved] Error during partition resize

Thanks for your answer. Unfortunately I have no saved details: Gparted was running live. It stopped because of an I/O error, and clicking on Retry, Cancel or Ignore had no effect. After a while, the screen has turned black with a list of numbers updating very fast. The hard drive led was not blinking anymore.
I think that the more or less 20 GB it moved can now be read. But when I try to open an audio file that was placed in the remaining 180 GB, the player plays the piece of another audio file (or, with other files, it gives error).

Making guesses, you were moving the start of the partition, because that involves moving the data in the partition, as well as resizing the contained file system.  Also assuming you weren't moving the end of the partition.

Yes, Gparted was moving my files to the new partition start (51200 MB back from the old partition start) when stopped at 20 GB moved. I wasn't moving the end of the partition.

Outside of GParted, re-create the second partition with it's exact original partition start and end positions.

Do you mean to resize it again making it 51200 MB smaller from the new partition start? Or deleting this partition, creating a new partition over this one and using the Attempt data rescue?

4

Re: [Solved] Error during partition resize

fbml wrote:

But when I try to open an audio file that was placed in the remaining 180 GB, the player plays the piece of another audio file (or, with other files, it gives error).

Don't try to use the file system in it's current state.  Mounting the file system (except read-only) may lead to further corruption and loss of data.


fbml wrote:

Do you mean to resize it again making it 51200 MB smaller from the new partition start? Or deleting this partition, creating a new partition over this one and using the Attempt data rescue?

No, and no.


Provide the output from the following commands and I will provide instructions:
(I am assuming that the problem hard drive is /dev/sda.  Change as needed).

sudo parted /dev/sda print
sudo fdisk -l /dev/sda
sudo gdisk -l /dev/sda
sudo lsblk -o name,maj:min,rm,size,ro,type,fstype,label,mountpoint

5

Re: [Solved] Error during partition resize

Background information

This is what your hard drive originally looked like as an ASCII art picture.  ("ABC...WXY" represents the file system itself).

Offset   0         <-------- 250 GB ------->
         |        |ABCDEFGHIJKLMNOPQRSTUVWXY|

Growing a partition 50 GB to the left involves the following steps:
1. Setting the start of the partition 50 GB to the left.
2. Copying the file system content 50 GB to the left.  (Since the file system was 250 GB that will involve overwriting the later parts of the file system).
3. Growing the file system to fill the now 300 GB partition.

As the copy stage reportedly broke after about 20 GB, the move of the file system didn't get as far as overwriting later portions of itself.  Therefore your hard drive now looks like this:

Offset   0     <---------- 300 GB --------->
         |    |AB  ABCDEFGHIJKLMNOPQRSTUVWXY|

Specifically when you are accessing your file system you are only accessing the first 20 GB successfully copied.  Beyond that, as far as that copy of the file system is concerned there is just garbage.  However at offset 50 GB into the new partition is your original file system.  This is why I said above, don't use the file system as it may lead to further corruption.

6 (edited by fbml 2019-02-03 20:03:21)

Re: [Solved] Error during partition resize

mfleetwo wrote:

Provide the output from the following commands and I will provide instructions:
(I am assuming that the problem hard drive is /dev/sda.  Change as needed).

sudo parted /dev/sda print
sudo fdisk -l /dev/sda
sudo gdisk -l /dev/sda
sudo lsblk -o name,maj:min,rm,size,ro,type,fstype,label,mountpoint

This is what you asked:

root@partedmagic:~# sudo parted /dev/sdb print
Model: WDC WD20 EZRZ-00Z5HB0 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1678GB  1678GB  primary  ntfs
 2      1678GB  2000GB  322GB   primary  ntfs

root@partedmagic:~# sudo fdisk -l /dev/sdb

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x52fcd906

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  3277850623  1638924288    7  HPFS/NTFS/exFAT
/dev/sdb2      3277850624  3907024895   314587136    7  HPFS/NTFS/exFAT
root@partedmagic:~# sudo gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
***************************************************************

Disk /dev/sdb: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): A962D873-068C-4A15-98E1-9791B85D2D3D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 6253 sectors (3.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      3277850623   1.5 TiB     0700  Microsoft basic data
   2      3277850624      3907024895   300.0 GiB   0700  Microsoft basic data
root@partedmagic:~# sudo lsblk -o name,maj:min,rm,size,ro,type,fstype,label,mountpoint
NAME   MAJ:MIN RM   SIZE RO TYPE FSTYPE   LABEL      MOUNTPOINT
sda      8:0    0 465.8G  0 disk                     
├─sda1   8:1    0   499M  0 part ntfs     Ripristino 
├─sda2   8:2    0   100M  0 part vfat                
├─sda3   8:3    0    16M  0 part                     
├─sda4   8:4    0 149.4G  0 part ntfs                
├─sda5   8:5    0 165.8G  0 part ntfs     Dati       
└─sda6   8:6    0   150G  0 part ntfs     Dati2      
sdb      8:16   0   1.8T  0 disk                     
├─sdb1   8:17   0   1.5T  0 part ntfs     Fabio WD   /media/Fabio WD
└─sdb2   8:18   0   300G  0 part ntfs     Fabio2     
sr0     11:0    1 598.2M  0 rom                      
loop0    7:0    0  43.3M  1 loop squashfs            
loop1    7:1    0 245.8M  1 loop squashfs            

The partition we are talking about is sdb2.


mfleetwo wrote:

Background information

Thanks for this explanation.

7

Re: [Solved] Error during partition resize

We have to work out the exactly location where the original partition use to be.

Search for magic signatures of NTFS.

sudo hexdump -C /dev/sdb2 | fgrep 'NTFS    '

That is 4 spaces after NTFS and before the single quote (').  The command is reading all 300 GB of partition sdb2 so will take a while to run.  I expect 3 lines of output something line this:

00000000  eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |.R.NTFS    .....|
c80000000  eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |.R.NTFS    .....|
4afffffe00  eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |.R.NTFS    .....|

The lines are:
1) NTFS signature of the partially copied file system at the start of the partition.
2) NTFS signature at the start of the original copy of the NTFS file system.  The first column on this line is the one we need to use in the calculation below.
3) NTFS signature of the end of the original copy of the NTFS file system.

Compute the required start and length of partition sdb2:

python
# Offset from your hexdump -C output
ntfs_byte_offset = 0xc80000000
# Start and end from your earlier fdisk -l output
current_partition_2_sector_start = 3277850624
current_partition_2_sector_end = 3907024895
orig_start = current_partition_2_sector_start + ntfs_byte_offset / 512
orig_size = current_partition_2_sector_end - orig_start + 1
print ("start=%d, size=%d" % (orig_start, orig_size))
start=3382708224, size=524316672
[Press Ctrl-D]

Backup current partition table:

sudo sfdisk -d /dev/sdb > sdb.tab

Create new partition table description file:

cp sdb.tab sdb-new.tab

Edit new partition table description file, replace the start and size figures for the /dev/sdb2 line with those computed just above.

I notice in your output that sdb1 is mounted on "/media/Fabio WD".  Ensure all partitions on hard drive /dev/sdb are unmounted.

Re-write the partition table.

sudo sfdisk /dev/sdb < sdb-new.tab



It should be all OK now.  Use GParted and perform a check on partition sdb2.  Make a backup of data you care about.  GParted has already failed once because of hardware I/O errors.

8 (edited by fbml 2019-02-04 19:59:43)

Re: [Solved] Error during partition resize

mfleetwo wrote:

Search for magic signatures of NTFS.

sudo hexdump -C /dev/sdb2 | fgrep 'NTFS    '

8 hours ago I started to run this command, but at the moment (it's still running) it has found only the first of the three lines you indicated (exactly the same you wrote).

mfleetwo wrote:

The command is reading all 300 GB of partition sdb2 so will take a while to run.

Is it normal that it takes so much time? It's connected directly via SATAII. CPU usage is 100%, and hard disk's led blinks (slowly).

9

Re: [Solved] Error during partition resize

fbml wrote:

8 hours ago I started to run this command, but at the moment (it's still running) it has found only the first of the three lines you indicated (exactly the same you wrote).

mfleetwo wrote:

The command is reading all 300 GB of partition sdb2 so will take a while to run.

Is it normal that it takes so much time? It's connected directly via SATAII. CPU usage is 100%, and hard disk's led blinks (slowly).

I would have expected to read 300 GB from a SATAII hard drive to take less than 1 hour.

Check the system log file for recent errors:

sudo tail -50 /var/log/messages

See what is using the CPU with:

top

10 (edited by fbml 2019-02-05 01:01:50)

Re: [Solved] Error during partition resize

root@partedmagic:~# sudo tail -50 /var/log/messages
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Novatel'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Option'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Samsung'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Sierra'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'SimTech'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Wavecom'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'X22X'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'ZTE'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Cinterion'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Iridium'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Via CBP7'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Loaded plugin 'Generic'
Feb  4 12:19:45 partedmagic daemon.info modem-manager[3155]: <info>  Successfully loaded 21 plugins
Feb  4 11:19:48 partedmagic user.info kernel: [  127.731745] NET: Registered protocol family 10
Feb  4 11:19:48 partedmagic user.info kernel: [  127.731971] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Feb  4 12:19:48 partedmagic auth.info sshd[3179]: Server listening on 0.0.0.0 port 22.
Feb  4 12:19:48 partedmagic auth.info sshd[3179]: Server listening on :: port 22.
Feb  4 10:20:00 partedmagic daemon.info init: starting pid 3428, tty '/dev/tty1': '/sbin/mingetty --autologin root tty1'
Feb  4 11:20:01 partedmagic authpriv.notice login[3428]: ROOT LOGIN  on '/dev/tty1'
Feb  4 11:20:03 partedmagic daemon.notice acpid: client connected from 3457[0:0]
Feb  4 11:20:03 partedmagic daemon.info acpid: 1 client rule loaded
Feb  4 11:20:06 partedmagic daemon.notice acpid: exiting
Feb  4 11:20:06 partedmagic daemon.info acpid: starting up with proc fs
Feb  4 11:20:06 partedmagic daemon.info acpid: 1 rule loaded
Feb  4 11:20:06 partedmagic daemon.info acpid: waiting for events: event logging is off
Feb  4 11:20:07 partedmagic daemon.notice acpid: client connected from 3457[0:0]
Feb  4 11:20:07 partedmagic daemon.info acpid: 1 client rule loaded
Feb  4 10:20:12 partedmagic user.err kernel: [  151.341181] end_request: I/O error, dev fd0, sector 0
Feb  4 11:20:12 partedmagic authpriv.notice polkitd(authority=local): Registered Authentication Agent for unix-session:/org/freedesktop/ConsoleKit/Session3 (system bus name :1.11 [/usr/libexec/polkit-gnome-authentication-agent-1], object path /org/gnome/PolicyKit1/Authentication
Feb  4 11:20:20 partedmagic daemon.notice dbus[1909]: [system] Activating service name='org.blueman.Mechanism' (using servicehelper)
Feb  4 11:20:21 partedmagic daemon.info blueman-mechanism: Starting blueman-mechanism 
Feb  4 11:20:21 partedmagic daemon.notice dbus[1909]: [system] Successfully activated service 'org.blueman.Mechanism'
Feb  4 10:20:22 partedmagic user.info kernel: [  161.252728] Bluetooth: RFCOMM TTY layer initialized
Feb  4 10:20:22 partedmagic user.info kernel: [  161.252743] Bluetooth: RFCOMM socket layer initialized
Feb  4 10:20:22 partedmagic user.info kernel: [  161.252746] Bluetooth: RFCOMM ver 1.11
Feb  4 11:20:22 partedmagic daemon.info blueman-mechanism: loading Config 
Feb  4 11:20:22 partedmagic daemon.info blueman-mechanism: loading Network 
Feb  4 11:20:22 partedmagic daemon.info blueman-mechanism: loading Ppp 
Feb  4 11:20:22 partedmagic daemon.info blueman-mechanism: loading RfKill 
Feb  4 11:20:29 partedmagic authpriv.notice sudo:     root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/sbin/fdisk -l
Feb  4 10:20:29 partedmagic user.err kernel: [  168.769066] end_request: I/O error, dev fd0, sector 0
Feb  4 11:20:51 partedmagic daemon.info blueman-mechanism: Exiting 
Feb  4 11:22:36 partedmagic authpriv.notice sudo:     root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/bin/hexdump -C /dev/sda2
Feb  4 11:48:59 partedmagic daemon.crit smartd[1896]: System clock time adjusted to the past. Resetting next wakeup time.
Feb  4 12:18:59 partedmagic daemon.info smartd[1896]: Device: /dev/sda [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 123 to 119
Feb  4 15:18:59 partedmagic daemon.info smartd[1896]: Device: /dev/sda [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 119 to 118
Feb  4 16:49:00 partedmagic daemon.info smartd[1896]: Device: /dev/sda [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 118 to 117
Feb  4 18:18:59 partedmagic daemon.info smartd[1896]: Device: /dev/sda [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 117 to 116
Feb  4 19:29:45 partedmagic authpriv.notice sudo:     root : TTY=pts/1 ; PWD=/root ; USER=root ; COMMAND=/bin/tail -50 /var/log/messages
Feb  4 19:33:20 partedmagic authpriv.notice sudo:     root : TTY=pts/1 ; PWD=/root ; USER=root ; COMMAND=/bin/tail -50 /var/log/messages

And this is CPU

Mem: 1209676K used, 1903640K free, 0K shrd, 516572K buff, 587140K cached
CPU: 98.4% usr  1.5% sys  0.0% nic  0.0% idle  0.0% io  0.0% irq  0.0% sirq
Load average: 1.35 1.19 1.16 3/187 32438
  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
 4330  4088 root     R     3160  0.1   0 96.0 hexdump -C /dev/sda2
 4331  4088 root     S     3364  0.1   0  1.3 fgrep NTFS    
 4085     1 root     S    33392  1.0   0  0.8 roxterm
 3457  3456 root     S <  48912  1.5   0  0.4 Xorg -br -dpi 96
32420 32399 root     R     2620  0.0   0  0.2 top
  492     2 root     SW       0  0.0   0  0.2 [kswapd0]
 3769     1 root     S    54708  1.7   0  0.0 /usr/bin/conky
 3801  3724 root     S    54172  1.7   0  0.0 nm-applet
 3705     1 root     S    42280  1.3   0  0.0 /usr/libexec/at-spi-bus-launcher
 3800  3725 root     S    34928  1.1   0  0.0 {blueman-applet} /usr/bin/python /usr/bin/blueman-applet
 3664  3456 root     S    33300  1.0   0  0.0 lxpanel
 3693  3664 root     S    32848  1.0   0  0.0 spacefm --desktop
 3149     1 root     S    30856  0.9   0  0.0 /usr/sbin/NetworkManager
 1911     1 root     S    27892  0.8   0  0.0 console-kit-daemon
 3802  3723 root     S    26224  0.8   0  0.0 /usr/libexec/polkit-gnome-authentication-agent-1
 1982     1 root     S    25320  0.8   0  0.0 /usr/libexec/polkitd --no-debug
 3815     1 root     S    22172  0.7   0  0.0 /usr/libexec/notification-daemon-xfce
32095     1 root     S    21120  0.6   0  0.0 leafpad
 3694  3664 root     S    19988  0.6   0  0.0 parcellite
 3726     1 root     S    17740  0.5   0  0.0 /usr/libexec/notification-daemon-xfce
 3713     1 root     S    16040  0.5   0  0.0 /usr/libexec/at-spi2-registryd --use-gnome-session
 3155     1 root     S    15508  0.5   0  0.0 /usr/sbin/modem-manager
 3676  3664 root     S    14284  0.4   0  0.0 /usr/bin/openbox --startup /usr/libexec/openbox-autostart OPENBOX
 1784     1 root     S    10944  0.3   0  0.0 udevd --daemon
 3373     1 root     S     6940  0.2   0  0.0 /usr/sbin/cupsd -C /etc/cups/cupsd.conf
 3812     1 root     S     6916  0.2   0  0.0 /usr/libexec/gconfd-2
 3828     1 root     S     5964  0.1   0  0.0 /usr/bin/obex-data-server --no-daemon
 3703     1 root     S     5952  0.1   0  0.0 /usr/libexec/menu-cached
 4088  4085 root     S     5824  0.1   0  0.0 -bash
32399  4085 root     S     5824  0.1   0  0.0 -bash
 3428     1 root     S     5792  0.1   0  0.0 -bash
32436 32435 root     R     5352  0.1   0  0.0 gphoto2 --auto-detect
 3723     1 root     S     4816  0.1   0  0.0 ck-launch-session /usr/libexec/polkit-gnome-authentication-agent-1
 3724     1 root     S     4816  0.1   0  0.0 ck-launch-session nm-applet
 3725     1 root     S     4816  0.1   0  0.0 ck-launch-session blueman-applet
32437 32435 root     S     4720  0.1   0  0.0 awk /usb:/ {print $0}
 4044     1 root     S     4332  0.1   0  0.0 {pmagic_fstab_da} /bin/bash /usr/bin/pmagic_fstab_daemon
 3179     1 root     S     4248  0.1   0  0.0 /usr/sbin/sshd
32432  4044 root     S     4000  0.1   0  0.0 {pmagic_fstab.sh} /bin/bash /usr/bin/pmagic_fstab.sh
32435 32432 root     S     4000  0.1   0  0.0 {pmagic_fstab.sh} /bin/bash /usr/bin/pmagic_fstab.sh
 3455  3428 root     S     3984  0.1   0  0.0 {xinit} /bin/sh /usr/local/bin/xinit
 3118     1 root     S     3704  0.1   0  0.0 bluetoothd
 3698     1 root     S     3412  0.1   0  0.0 dbus-launch --autolaunch 5ec459c769b8b36a3682d57f5c581fa3 --binary-syntax --close-stderr
 1896     1 root     S     3300  0.1   0  0.0 smartd
32438 32435 root     S     3260  0.1   0  0.0 sed -r s/[[:space:]]{2,}/ /g
 3456  3455 root     S     3064  0.1   0  0.0 /usr/bin/xinit
 1909     1 messageb S     2728  0.0   0  0.0 /usr/bin/dbus-daemon --system
    1     0 root     S     2616  0.0   0  0.0 init
 1779     1 root     S     2616  0.0   0  0.0 syslogd
 1781     1 root     S     2616  0.0   0  0.0 klogd -c 1
 3430     1 root     S     2616  0.0   0  0.0 init
 3431     1 root     S     2616  0.0   0  0.0 init
 3432     1 root     S     2616  0.0   0  0.0 init
 3433     1 root     S     2616  0.0   0  0.0 init
 3434     1 root     S     2616  0.0   0  0.0 init
 3702     1 root     S     2604  0.0   0  0.0 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
 3710  3705 root     S     2468  0.0   0  0.0 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
 3737     1 root     S     2468  0.0   0  0.0 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
 1914     1 root     S     2136  0.0   0  0.0 dmeventd
 1871     1 root     S     1940  0.0   0  0.0 /usr/sbin/gpm -m /dev/mouse -t imps2
 4087  4085 root     S     1856  0.0   0  0.0 gnome-pty-helper
 3066     1 root     S     1696  0.0   0  0.0 inetd
 3670     1 root     S     1664  0.0   0  0.0 acpid
    3     2 root     SW       0  0.0   0  0.0 [ksoftirqd/0]
 1001     2 root     SW<      0  0.0   0  0.0 [kworker/0:1H]

I'm on a desktop PC, now the drive is /sda. Do you suggest to stop and retry on another PC (but only on USB 3.0)?

--Edit
I stopped the process. I tried this command on a usb flash drive, creating a 100 MB NTFS partition. It completed the task in 80 seconds: less than 2 mb/s. Why is it so slow?

11

Re: [Solved] Error during partition resize

I tried on my machine with SATA3 connected drive and got about 3 MB/s and found hexdump using 100% CPU.  For 300 GB I estimated it would take my machine 24 hours!  It appears that hexdump is very inefficient.


Run this to specify an offset from where hexdump should start reading from.  Will reduce the amout it has to read to about 6 GB at most.

hexdump -C -s 49392123904 /dev/sdb | fgrep 'NTFS    '

Press [Ctrl-C] when one line is displayed.  This will give you the needed original start of the NTFS file system for the calculation.

12

Re: [Solved] Error during partition resize

hexdump -C -s 49392123904 /dev/sdb | fgrep 'NTFS    '

Ok!
P.s.: here I read /sdb, not /sdb2: is this an offset from disk start or partition start?

13

Re: [Solved] Error during partition resize

Sorry about that.  Yes it should be an offset from the start of the second partition.

hexdump -C -s 49392123904 /dev/sdb2 | fgrep 'NTFS    '

14

Re: [Solved] Error during partition resize

I tried it on Ubuntu x64 (live), really faster: in about one hour (as you expected) I got this result:

ubuntu@ubuntu:~$ sudo hexdump -C -s 49392123904 /dev/sda2 | fgrep 'NTFS    '
c7ffffe00  eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |.R.NTFS    .....|
c80000000  eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |.R.NTFS    .....|

Can we trust about this short time?
Anyway, considering offset, I think that the first line is the one we need, if you agree.
But here a further doubt: should we also expect the magic signature of the old first partition ending (the one I reduced, taking 50 GB for the second one)?

15

Re: [Solved] Error during partition resize

Byte offset c7ffffe00 is 104857599 sectors ~= 51199.9995117 MiB.
Byte offset c80000000 is 104857600 sectors = 51200 MiB = 50.0 GiB.

Also checked and partition 2 starts at sector 3277850624 = 1600513 MiB = 1563 GiB.


Since GParted works in multiples of MiB, use the figure c80000000 as the original start of your NTFS in the calculation.


N.B.  1 MiB = 1024*1024 bytes;  1 GiB = 1024 MiB.

16 (edited by fbml 2019-02-08 20:13:29)

Re: [Solved] Error during partition resize

mfleetwo, your system WORKED!
I performed all steps you told me in post #7: the partition size now is 250 GB, I have a 50 GB unallocated partition between partition 1-2, and files are OK! Even Gparted check is ok (it took less than a second).

First of all, thank you for your help, you also explained all passages so I've learned new things about disk partitioning.

Now, I'm performing a MD5 check on files stored on partition 1 (but I backed them up before the final operation); then I will perform a MD5 check between the current partition 2 files and the files recovered by Photorec. Now, assuming that in the first days after this problem I mounted the partition on Windows to check what happened after the resize error (trying to play some file, but without any write attempt), what do you think about the risk of some file corruption? They are all (long) audio files. If you were me, would you trust more about Photorec results or current datas?

P.S. For example, I checked a txt file Photorec didn't restore and is ok

17

Re: [Solved] Error during partition resize

I am glad you got your data back.

fbml wrote:

Now, I'm performing a MD5 check on files stored on partition 1 (but I backed them up before the final operation); then I will perform a MD5 check between the current partition 2 files and the files recovered by Photorec. Now, assuming that in the first days after this problem I mounted the partition on Windows to check what happened after the resize error (trying to play some file, but without any write attempt), what do you think about the risk of some file corruption? They are all (long) audio files. If you were me, would you trust more about Photorec results or current datas?

P.S. For example, I checked a txt file Photorec didn't restore and is ok

First with the caveats:
1.  I don't know what Windows does when it accesses a corrupt NTFS file system to try to read files only.
2.  I have read the theory of how Photorec works, but never used it in practice.

In your situation I would hope corruption hadn't occurred and go with the fixed file system.  Especially as you say Photorec hasn't recovered all files.


I also recommend checking both the hard drive and file system for corruption.  The hard drive because GParted previously failed with an I/O error to give us this mess and the file system because of possible corruption from use while partially copied.

1.  Check the hard drive is okay by reading every block from the whole 2 TBs.  As a guess this will take 5 hours give or take a factor of 2.

sudo ddrescue -n -T 8 -f -v -v /dev/sdb /dev/null

2.  Try reading every file on the file system.  Again this will likely take a few hours.

cd /mountpoint
find . -type f -print0 | xargs -0 cat > /dev/null

3.  Backup your data.

4.  Boot into Windows and run a chkdsk on the NTFS.  (How to Check Disk for Errors Using chkdsk and Command Prompt).

chkdsk D: /f /r /x

18 (edited by fbml 2019-02-09 21:58:54)

Re: [Solved] Error during partition resize

I also wanted to check disk's health.

mfleetwo wrote:

1.  Check the hard drive is okay by reading every block from the whole 2 TBs.  As a guess this will take 5 hours give or take a factor of 2.

sudo ddrescue -n -T 8 -f -v -v /dev/sdb /dev/null

This is the result:

ubuntu@ubuntu:~$ sudo ddrescue -n -T 8 -f -v -v /dev/sdc /dev/null
GNU ddrescue 1.23
About to copy 2000 GBytes from '/dev/sdc' [UNKNOWN] (2000398934016) to '/dev/null' (0)
    Starting positions: infile = 0 B,  outfile = 0 B
    Copy block size: 128 sectors       Initial skip size: 39168 sectors
Sector size: 512 Bytes
Timeout: 8s       
Direct in: no     Direct out: no     Sparse: no     Truncate: no     
Trim: yes         Scrape: no         Max retry passes: 0

Press Ctrl-C to interrupt
     ipos:    2000 GB, non-trimmed:        0 B,  current rate:  62414 kB/s
     opos:    2000 GB, non-scraped:        0 B,  average rate:    123 MB/s
non-tried:        0 B,  bad-sector:        0 B,    error rate:       0 B/s
  rescued:    2000 GB,   bad areas:        0,        run time:  4h 30m 58s
pct rescued:  100.00%, read errors:        0,  remaining time:         n/a
                              time since last successful read:         n/a
Finished 

This is the actual S.M.A.R.T. report:

-- S.M.A.R.T. --------------------------------------------------------------
ID Cur Wor Thr RawValues(6) Attribute Name
01 200 200 _51 000000000000 Read Error Rate
03 178 172 _21 000000000FFB Spin-Up Time
04 100 100 __0 00000000007C Start/Stop Count
05 200 200 140 000000000000 Reallocated Sectors Count
07 200 200 __0 000000000000 Seek Error Rate
09 100 100 __0 0000000000A0 Power-On Hours
0A 100 100 __0 000000000000 Spin Retry Count
0B 100 253 __0 000000000000 Recalibration Retries
0C 100 100 __0 000000000061 Power Cycle Count
C0 200 200 __0 000000000000 Power-off Retract Count
C1 200 200 __0 0000000000CC Load/Unload Cycle Count
C2 108 106 __0 000000000027 Temperature
C4 200 200 __0 000000000000 Reallocation Event Count
C5 200 200 __0 000000000000 Current Pending Sector Count
C6 100 253 __0 000000000000 Uncorrectable Sector Count
C7 200 200 __0 000000000000 UltraDMA CRC Error Count
C8 100 253 __0 000000000000 Write Error Rate


mfleetwo wrote:

2.  Try reading every file on the file system.  Again this will likely take a few hours.

cd /mountpoint
find . -type f -print0 | xargs -0 cat > /dev/null

Here I received no details:

ubuntu@ubuntu:/media/ubuntu/Fabio WD$ find . -type f -print0 | xargs -0 cat > /dev/null
ubuntu@ubuntu:/media/ubuntu/Fabio WD$ 

ubuntu@ubuntu:/media/ubuntu/Fabio2$ find . -type f -print0 | xargs -0 cat > /dev/null
ubuntu@ubuntu:/media/ubuntu/Fabio2$ 

These are both partitions; Fabio2 is the one we've recovered. Is this the right behavior of this command?


Regarding Windows:

mfleetwo wrote:

4.  Boot into Windows and run a chkdsk on the NTFS.  (How to Check Disk for Errors Using chkdsk and Command Prompt).

chkdsk D: /f /r /x

This is chkdsk for the first partition:

PS C:\Windows\system32> chkdsk H: /f /r /x
Il file system è di tipo NTFS.
L'etichetta del volume è Fabio WD.

Fase 1: analisi della struttura del file system di base in corso...
  768 record file elaborati.
Verifica file completata.
  0 record di file di grandi dimensioni elaborati.
  0 record file non validi elaborati.

Fase 2: analisi del collegamento dei nomi file in corso...
  23 record reparse elaborati.
  854 voci di indice elaborate.
Verifica indici completata.
  0 file non indicizzati analizzati.
  0 file non indicizzati ripristinati nella cartella dei file persi e ritrovati.
  23 record reparse elaborati.

Fase 3: analisi dei descrittori di sicurezza in corso...
Verifica descrittori di sicurezza completata.
  44 file di dati elaborati.
CHKDSK sta verificando il journal USN...
  636832 byte USN elaborati.
Verifica del journal USN completata.

Fase 4: ricerca di cluster danneggiati nei dati dei file utente in corso...
  752 file elaborati.
Verifica dei dati del file completata.

Fase 5: ricerca di cluster liberi danneggiati in corso...
  164038085 cluster liberi elaborati.
Verifica dello spazio disponibile completata.

Analisi del file system effettuata. Nessun problema rilevato.
Non sono necessarie ulteriori azioni.

1638924287 KB di spazio totale su disco.
 982654000 KB in 323 file.
       188 KB in 45 indici.
         0 KB in settori danneggiati.
    117755 KB in uso dal sistema.
     65536 KB occupati dal file registro.
 656152344 KB disponibili su disco.

      4096 byte in ogni unità di allocazione.
 409731071 unità totali di allocazione su disco.
 164038086 unità di allocazione disponibili su disco.

And this is chkdsk for the second partition:

PS C:\Windows\system32> chkdsk J: /f /r /x
Il file system è di tipo NTFS.
L'etichetta del volume è Fabio2.

Fase 1: analisi della struttura del file system di base in corso...
  2304 record file elaborati.
Verifica file completata.
  0 record di file di grandi dimensioni elaborati.
  0 record file non validi elaborati.

Fase 2: analisi del collegamento dei nomi file in corso...
  44 record reparse elaborati.
  2476 voci di indice elaborate.
Verifica indici completata.
  0 file non indicizzati analizzati.
  0 file non indicizzati ripristinati nella cartella dei file persi e ritrovati.
  44 record reparse elaborati.

Fase 3: analisi dei descrittori di sicurezza in corso...
Verifica descrittori di sicurezza completata.
  87 file di dati elaborati.
CHKDSK sta verificando il journal USN...
  1159344 byte USN elaborati.
Verifica del journal USN completata.

Fase 4: ricerca di cluster danneggiati nei dati dei file utente in corso...
  2288 file elaborati.
Verifica dei dati del file completata.

Fase 5: ricerca di cluster liberi danneggiati in corso...
  12847236 cluster liberi elaborati.
Verifica dello spazio disponibile completata.

Analisi del file system effettuata. Nessun problema rilevato.
Non sono necessarie ulteriori azioni.

 262158335 KB di spazio totale su disco.
 210690960 KB in 1954 file.
       636 KB in 88 indici.
         0 KB in settori danneggiati.
     77791 KB in uso dal sistema.
     65536 KB occupati dal file registro.
  51388948 KB disponibili su disco.

      4096 byte in ogni unità di allocazione.
  65539583 unità totali di allocazione su disco.
  12847237 unità di allocazione disponibili su disco.

Sorry for the language. Both partitions reported no problems found and no need of furher actions ("Analisi del file system effettuata. Nessun problema rilevato. Non sono necessarie ulteriori azioni.").

If you think that all is okay, I will move current files from partition 2 and 1; delete partitions; create new partitions; and move the files back on this disk.

19 (edited by fbml 2019-02-10 17:00:35)

Re: [Solved] Error during partition resize

After posting this message, I tried to open Gparted and it got stuck while refreshing devices. So I restarted Ubuntu and got the errors shown in the image:
https://i.ibb.co/bFYN8wN/IMG-20190209-213630.jpg
After a forced reboot, Ubuntu S.M.A.R.T. utility (in Disks) reported "disk ok, 1 bad sector". In the details, the bad sector counter was 0, but there was a problem with Write error rate.
https://i.ibb.co/th5rNYM/IMG-20190209-214944.jpg
The strange thing is that the upper write error rate is 0; on Crystaldisk info and HDTune Pro I have only one write error rate attribute, which value is 0.

Rebooting again, no problems: Gparted refreshes the list, I can mount partitions and even the S.M.A.R.T. is OK. What do you think about this? Can it be just a logical error (maybe caused by the first Gparted error, or today by chkdsk)? I'm now performing another surface disk test with HDtune pro.

--edit
Like ddrescue, HDTune reported all blocks working (green).

20

Re: [Solved] Error during partition resize

So occasionally the drive is experiencing both read (GParted got stuck refreshing devices) and write errors (reported in /var/log/messages).

Given that the SMART information mostly looks OK, my first guess would be connector not seated correctly or faulty SATA cable.

Try:
1. Reseating the SATA cable, both ends.
2. Replacing the SATA cable.
And see how it goes after each.

If the error persists run the command line query all of SMART information from the drive.

sudo smartctl -x /dev/sdc

21 (edited by fbml 2019-02-11 14:51:21)

Re: [Solved] Error during partition resize

The disk usually works in a USB enclosure, but the first Gparted error and this actual problem occurred on different boxes.
Again, it doesn't mount the partitions.
In Disks utility I see:
https://i.ibb.co/68XGHqX/Screenshot-from-2019-02-11-10-11-08.png

smartctl output is Unknown USB bridge:

ubuntu@ubuntu:~$ sudo smartctl -x /dev/sdc
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.18.0-10-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/sdc: Unknown USB bridge [0x2109:0x0715 (0x336)]
Please specify device type with the -d option.

Use smartctl -h to get a usage summary

And, opening Gparted, it doesnt't complete the Scanning all devices operation.

I disconnected it with

sudo hdparm -y /dev/sdc

It took a while to safely shutdown the disk. I connected it again and it mounted partition 2, but got stuck on mounting partition 1. It seems to be a mounting problem: Ubuntu tries to mount this USB disk when I plug it in, the process get stuck and even Gparted doesn't end the scanning operation.

This happens with my USB 3.0 enclosure. With my other USB 2.0 enclosure both partitions are mounted and Gparted goes fine, but smartctl doesn't:

ubuntu@ubuntu:~$ sudo smartctl -x /dev/sdc
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.18.0-10-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/sdc: Unknown USB bridge [0x1e68:0x003f (0x10f)]
Please specify device type with the -d option.

Use smartctl -h to get a usage summary

It works with SATA connection:

ubuntu@ubuntu:~$ sudo smartctl -x /dev/sda
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.18.0-10-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue
Device Model:     WDC WD20EZRZ-00Z5HB0
Serial Number:    WD-WCC4M6XJCRZU
LU WWN Device Id: 5 0014ee 20de84754
Firmware Version: 80.00A80
User Capacity:    2,000,398,934,016 bytes [2.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Mon Feb 11 11:09:04 2019 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Enabled
Write cache is:   Enabled
ATA Security is:  Disabled, frozen [SEC2]
Wt Cache Reorder: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x80)    Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:         (25440) seconds.
Offline data collection
capabilities:              (0x7b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003)    Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01)    Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:      (   2) minutes.
Extended self-test routine
recommended polling time:      ( 257) minutes.
Conveyance self-test routine
recommended polling time:      (   5) minutes.
SCT capabilities:            (0x7035)    SCT Status supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  1 Raw_Read_Error_Rate     POSR-K   200   200   051    -    0
  3 Spin_Up_Time            POS--K   188   172   021    -    3566
  4 Start_Stop_Count        -O--CK   100   100   000    -    136
  5 Reallocated_Sector_Ct   PO--CK   200   200   140    -    0
  7 Seek_Error_Rate         -OSR-K   200   200   000    -    0
  9 Power_On_Hours          -O--CK   100   100   000    -    167
 10 Spin_Retry_Count        -O--CK   100   100   000    -    0
 11 Calibration_Retry_Count -O--CK   100   100   000    -    0
 12 Power_Cycle_Count       -O--CK   100   100   000    -    106
192 Power-Off_Retract_Count -O--CK   200   200   000    -    1
193 Load_Cycle_Count        -O--CK   200   200   000    -    218
194 Temperature_Celsius     -O---K   119   106   000    -    28
196 Reallocated_Event_Count -O--CK   200   200   000    -    0
197 Current_Pending_Sector  -O--CK   200   200   000    -    0
198 Offline_Uncorrectable   ----CK   100   253   000    -    0
199 UDMA_CRC_Error_Count    -O--CK   200   200   000    -    0
200 Multi_Zone_Error_Rate   ---R--   100   253   000    -    0
                            ||||||_ K auto-keep
                            |||||__ C event count
                            ||||___ R error rate
                            |||____ S speed/performance
                            ||_____ O updated online
                            |______ P prefailure warning

General Purpose Log Directory Version 1
SMART           Log Directory Version 1 [multi-sector log support]
Address    Access  R/W   Size  Description
0x00       GPL,SL  R/O      1  Log Directory
0x01           SL  R/O      1  Summary SMART error log
0x02           SL  R/O      5  Comprehensive SMART error log
0x03       GPL     R/O      6  Ext. Comprehensive SMART error log
0x06           SL  R/O      1  SMART self-test log
0x07       GPL     R/O      1  Extended self-test log
0x09           SL  R/W      1  Selective self-test log
0x10       GPL     R/O      1  SATA NCQ Queued Error log
0x11       GPL     R/O      1  SATA Phy Event Counters log
0x80-0x9f  GPL,SL  R/W     16  Host vendor specific log
0xa0-0xa7  GPL,SL  VS      16  Device vendor specific log
0xa8-0xb6  GPL,SL  VS       1  Device vendor specific log
0xb7       GPL,SL  VS      39  Device vendor specific log
0xbd       GPL,SL  VS       1  Device vendor specific log
0xc0       GPL,SL  VS       1  Device vendor specific log
0xc1       GPL     VS      93  Device vendor specific log
0xe0       GPL,SL  R/W      1  SCT Command/Status
0xe1       GPL,SL  R/W      1  SCT Data Transfer

SMART Extended Comprehensive Error Log Version: 1 (6 sectors)
No Errors Logged

SMART Extended Self-test Log Version: 1 (1 sectors)
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Conveyance offline  Completed without error       00%         5         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

SCT Status Version:                  3
SCT Version (vendor specific):       258 (0x0102)
SCT Support Level:                   1
Device State:                        Active (0)
Current Temperature:                    28 Celsius
Power Cycle Min/Max Temperature:     28/28 Celsius
Lifetime    Min/Max Temperature:     16/41 Celsius
Under/Over Temperature Limit Count:   0/0
Vendor specific:
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

SCT Temperature History Version:     2
Temperature Sampling Period:         1 minute
Temperature Logging Interval:        1 minute
Min/Max recommended Temperature:      0/60 Celsius
Min/Max Temperature Limit:           -41/85 Celsius
Temperature History Size (Index):    478 (85)

Index    Estimated Time   Temperature Celsius
  86    2019-02-11 03:12    40  *********************
 ...    ..( 28 skipped).    ..  *********************
 115    2019-02-11 03:41    40  *********************
 116    2019-02-11 03:42    41  **********************
 ...    ..( 67 skipped).    ..  **********************
 184    2019-02-11 04:50    41  **********************
 185    2019-02-11 04:51    40  *********************
 ...    ..(  7 skipped).    ..  *********************
 193    2019-02-11 04:59    40  *********************
 194    2019-02-11 05:00    39  ********************
 ...    ..( 12 skipped).    ..  ********************
 207    2019-02-11 05:13    39  ********************
 208    2019-02-11 05:14    38  *******************
 ...    ..( 18 skipped).    ..  *******************
 227    2019-02-11 05:33    38  *******************
 228    2019-02-11 05:34     ?  -
 229    2019-02-11 05:35    29  **********
 230    2019-02-11 05:36     ?  -
 231    2019-02-11 05:37    33  **************
 232    2019-02-11 05:38    32  *************
 233    2019-02-11 05:39     ?  -
 234    2019-02-11 05:40    32  *************
 235    2019-02-11 05:41    32  *************
 236    2019-02-11 05:42    32  *************
 237    2019-02-11 05:43     ?  -
 238    2019-02-11 05:44    33  **************
 239    2019-02-11 05:45     ?  -
 240    2019-02-11 05:46    33  **************
 241    2019-02-11 05:47    32  *************
 242    2019-02-11 05:48     ?  -
 243    2019-02-11 05:49    33  **************
 244    2019-02-11 05:50     ?  -
 245    2019-02-11 05:51    33  **************
 ...    ..(  3 skipped).    ..  **************
 249    2019-02-11 05:55    33  **************
 250    2019-02-11 05:56    34  ***************
 ...    ..(  4 skipped).    ..  ***************
 255    2019-02-11 06:01    34  ***************
 256    2019-02-11 06:02    35  ****************
 257    2019-02-11 06:03    35  ****************
 258    2019-02-11 06:04    35  ****************
 259    2019-02-11 06:05    36  *****************
 ...    ..(  8 skipped).    ..  *****************
 268    2019-02-11 06:14    36  *****************
 269    2019-02-11 06:15    37  ******************
 ...    ..(  3 skipped).    ..  ******************
 273    2019-02-11 06:19    37  ******************
 274    2019-02-11 06:20    38  *******************
 ...    ..(  6 skipped).    ..  *******************
 281    2019-02-11 06:27    38  *******************
 282    2019-02-11 06:28    39  ********************
 ...    ..( 10 skipped).    ..  ********************
 293    2019-02-11 06:39    39  ********************
 294    2019-02-11 06:40    40  *********************
 ...    ..( 19 skipped).    ..  *********************
 314    2019-02-11 07:00    40  *********************
 315    2019-02-11 07:01    41  **********************
 ...    ..(126 skipped).    ..  **********************
 442    2019-02-11 09:08    41  **********************
 443    2019-02-11 09:09    40  *********************
 ...    ..( 72 skipped).    ..  *********************
  38    2019-02-11 10:22    40  *********************
  39    2019-02-11 10:23    39  ********************
 ...    ..( 13 skipped).    ..  ********************
  53    2019-02-11 10:37    39  ********************
  54    2019-02-11 10:38     ?  -
  55    2019-02-11 10:39    19  -
  56    2019-02-11 10:40    25  ******
  57    2019-02-11 10:41     ?  -
  58    2019-02-11 10:42    29  **********
  59    2019-02-11 10:43     ?  -
  60    2019-02-11 10:44    29  **********
  61    2019-02-11 10:45    28  *********
 ...    ..(  4 skipped).    ..  *********
  66    2019-02-11 10:50    28  *********
  67    2019-02-11 10:51     ?  -
  68    2019-02-11 10:52    28  *********
 ...    ..(  5 skipped).    ..  *********
  74    2019-02-11 10:58    28  *********
  75    2019-02-11 10:59     ?  -
  76    2019-02-11 11:00    28  *********
 ...    ..(  8 skipped).    ..  *********
  85    2019-02-11 11:09    28  *********

SCT Error Recovery Control command not supported

Device Statistics (GP/SMART Log 0x04) not supported

SATA Phy Event Counters (GP Log 0x11)
ID      Size     Value  Description
0x0001  2            0  Command failed due to ICRC error
0x0002  2            0  R_ERR response for data FIS
0x0003  2            0  R_ERR response for device-to-host data FIS
0x0004  2            0  R_ERR response for host-to-device data FIS
0x0005  2            0  R_ERR response for non-data FIS
0x0006  2            0  R_ERR response for device-to-host non-data FIS
0x0007  2            0  R_ERR response for host-to-device non-data FIS
0x0008  2            0  Device-to-host non-data FIS retries
0x0009  2            3  Transition from drive PhyRdy to drive PhyNRdy
0x000a  2            2  Device-to-host register FISes sent due to a COMRESET
0x000b  2            0  CRC errors within host-to-device FIS
0x000f  2            0  R_ERR response for host-to-device data FIS, CRC
0x0012  2            0  R_ERR response for host-to-device non-data FIS, CRC
0x8000  4          660  Vendor specific

It's a strange behavior, but it seems related to a specific USB box (on Ubuntu; no problems on Windows); anyway, I performed with this box the ddrescue test you suggested and it worked fine.
Regarding the disk, the bad sectors count is 0, but I need to know if it is reliable: maybe a (long) format can be useful to check those sectors?

22

Re: [Solved] Error during partition resize

Yes that hard drive is perfectly good.  It is connectivity issues via USB that is causing issues.


From the smartctl output, overall health is good.

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

No seek, read or write errors at all.  Known ATA S.M.A.R.T. attributes

Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  1 Raw_Read_Error_Rate     POSR-K   200   200   051    -    0
...
  5 Reallocated_Sector_Ct   PO--CK   200   200   140    -    0
  7 Seek_Error_Rate         -OSR-K   200   200   000    -    0
...
196 Reallocated_Event_Count -O--CK   200   200   000    -    0
197 Current_Pending_Sector  -O--CK   200   200   000    -    0
198 Offline_Uncorrectable   ----CK   100   253   000    -    0
199 UDMA_CRC_Error_Count    -O--CK   200   200   000    -    0
200 Multi_Zone_Error_Rate   ---R--   100   253   000    -    0

No errors logged by the drive.

SMART Extended Comprehensive Error Log Version: 1 (6 sectors)
No Errors Logged

23

Re: [Solved] Error during partition resize

An update just to confirm your guesses.
I formatted the whole drive (slow format), partitioned and put all data back on it.
After these write operations, S.M.A.R.T. is OK and the surface scan was able to read all blocks.

Thank you mfleetwo! You gave me a great help.

Regards