EXTERNAL 2TB USB DISK that casually goes nuts

I have this 2TB hard disk, fresh new, that goes nuts when connected to a debian box.

I use it to backup stuff from my laptop, from another computer, but sometimes when I connect it to some Linux Box, the entire partition goes wiped out. I sometimes recover it using Testdisk, sometimes I must rely on my second backup copy (I have three of them ;) ) but this time I was able to pinpoint WHAT computer caused this trouble. So I decided to investigate this shit.

Computers involved: Gemini (my laptop, IBM Thinkpad), Norad (a very nice and big computer), Cosmos (a little one).

NOTE: This is *NOT* a problem of the USB box / interface: it appears on different computers, using different USB box / interfaces, and also connecting the hard disk directly on SATA connectors.

Hard disk da 2TB

[87307.080716] sd 7:0:0:0: Attached scsi generic sg4 type 0
[87307.080993] sd 7:0:0:0: [sdd] 3907029166 512-byte logical blocks: (2.00 TB/1.81 TiB)
[87307.081187] sd 7:0:0:0: [sdd] Write Protect is off
[87307.081193] sd 7:0:0:0: [sdd] Mode Sense: 03 00 00 00
[87307.100337]  sdd: sdd1
[87307.101361] sd 7:0:0:0: [sdd] No Caching mode page found
[87307.101369] sd 7:0:0:0: [sdd] Assuming drive cache: write through
[87307.101375] sd 7:0:0:0: [sdd] Attached SCSI disk

Clean disk, connected to Norad, Linux Mint 17 Mate edition

asbesto@norad ~ $ uname -a
Linux norad 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
asbesto@norad ~ $ 

#deb cdrom:[Linux Mint 17.1 _Rebecca_ - Release amd64 20141126]/ trusty contrib main non-free

I create a brand new fresh ext4 partition using gparted

As standard I choose Align to MiB.

oloc1.jpg

oloc2.jpg

What NORAD see mounting this disk

It's automagically mounted at connection.

[88600.191391] usb 3-9: new high-speed USB device number 7 using xhci_hcd
[88600.208111] usb 3-9: New USB device found, idVendor=14cd, idProduct=6116
[88600.208119] usb 3-9: New USB device strings: Mfr=1, Product=3, SerialNumber=2
[88600.208124] usb 3-9: Product: USB Mass Storage Device
[88600.208128] usb 3-9: Manufacturer: Generic     
[88600.208132] usb 3-9: SerialNumber: 116AC2101219
[88600.208728] usb-storage 3-9:1.0: USB Mass Storage device detected
[88600.209032] scsi8 : usb-storage 3-9:1.0
[88601.207515] scsi 8:0:0:0: Direct-Access        Mass  Storage Device        PQ: 0 ANSI: 0
[88601.207959] sd 8:0:0:0: Attached scsi generic sg4 type 0
[88601.209982] sd 8:0:0:0: [sdd] 3907029166 512-byte logical blocks: (2.00 TB/1.81 TiB)
[88601.210185] sd 8:0:0:0: [sdd] Write Protect is off
[88601.210191] sd 8:0:0:0: [sdd] Mode Sense: 03 00 00 00
[88601.210428] sd 8:0:0:0: [sdd] No Caching mode page found
[88601.210433] sd 8:0:0:0: [sdd] Assuming drive cache: write through
[88601.211664] sd 8:0:0:0: [sdd] No Caching mode page found
[88601.211673] sd 8:0:0:0: [sdd] Assuming drive cache: write through
[88601.228432]  sdd: sdd1
[88601.247994] sd 8:0:0:0: [sdd] No Caching mode page found
[88601.248008] sd 8:0:0:0: [sdd] Assuming drive cache: write through
[88601.248010] sd 8:0:0:0: [sdd] Attached SCSI disk
[88601.532470] EXT4-fs (sdd1): mounted filesystem with ordered data mode. Opts: (null)
norad asbesto # 

/dev/sdd1 on /media/asbesto/287b593a-124e-4142-822d-67ecffd767bc type ext4 (rw,nosuid,nodev,uhelper=udisks2)

norad asbesto # fdisk /dev/sdd

Command (m for help): p

Disk /dev/sdd: 2000.4 GB, 2000398932992 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029166 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 identifier: 0x00085e8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048  3907028991  1953513472   83  Linux

Command (m for help): q

                              cfdisk (util-linux 2.20.1)

                                 Disk Drive: /dev/sdd
                         Size: 2000398932992 bytes, 2000.3 GB
                Heads: 255   Sectors per Track: 63   Cylinders: 243201

    Name         Flags       Part Type   FS Type           [Label]         Size (MB)
 -------------------------------------------------------------------------------------
                              Pri/Log    Free Space                             1,05  *
    sdd1                      Primary    ext4                             2000397,80  *
                              Pri/Log    Free Space                             0,09  *

    Name         Flags       Part Type   FS Type           [Label]           Sectors
 -------------------------------------------------------------------------------------
                              Pri/Log    Free Space                             2048  *
    sdd1                      Primary    ext4                             3907026944  *
                              Pri/Log    Free Space                              174  *

I copy some files/dir on it

Karate MP3 are OK for this test ;)

norad 287b593a-124e-4142-822d-67ecffd767bc # ls 
Karate  lost+found
norad 287b593a-124e-4142-822d-67ecffd767bc # ls -la Karate/
total 24
drwxr-xr-x 6 asbesto asbesto 4096 Mar 29  2010 .
drwxr-xr-x 4 asbesto asbesto 4096 Feb 27 11:56 ..
drwxr-xr-x 2 asbesto asbesto 4096 May  7  2003 Karate (1996) - Karate
drwxr-xr-x 2 asbesto asbesto 4096 May  7  2003 Karate (1997) - In Place Of Real Insight
drwxr-xr-x 2 asbesto asbesto 4096 May  7  2003 Karate (1998) - The bed is in the ocean
drwxr-xr-x 2 asbesto asbesto 4096 May  7  2003 Karate (2000) - Unsolved
norad 287b593a-124e-4142-822d-67ecffd767bc # 

Everything ok!

umount and move the udb disk on Gemini

Here I am on my laptop, Gemini!

rover asbesto # uname -a
Linux rover 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:31:42 UTC 2014 i686 i686 i686 GNU/Linux
rover asbesto # 

rover asbesto # cat /etc/apt/sources.list
#deb cdrom:[Linux Mint 17 _Qiana_ - Release i386 20140623]/ trusty contrib main non-free
rover asbesto # 

This is what Gemini see

[146032.763349] usb 2-1.2: new high-speed USB device number 4 using ehci-pci
[146032.856892] usb 2-1.2: New USB device found, idVendor=14cd, idProduct=6116
[146032.856900] usb 2-1.2: New USB device strings: Mfr=1, Product=3, SerialNumber=2
[146032.856905] usb 2-1.2: Product: USB Mass Storage Device
[146032.856909] usb 2-1.2: Manufacturer: Generic     
[146032.856912] usb 2-1.2: SerialNumber: 116AC2101219
[146032.857298] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[146032.857456] scsi8 : usb-storage 2-1.2:1.0
[146033.856664] scsi 8:0:0:0: Direct-Access        Mass  Storage Device        PQ: 0 ANSI: 0
[146033.857230] sd 8:0:0:0: Attached scsi generic sg1 type 0
[146033.857814] sd 8:0:0:0: [sdb] 3907029166 512-byte logical blocks: (2.00 TB/1.81 TiB)
[146033.858462] sd 8:0:0:0: [sdb] Write Protect is off
[146033.858467] sd 8:0:0:0: [sdb] Mode Sense: 03 00 00 00
[146033.859234] sd 8:0:0:0: [sdb] No Caching mode page found
[146033.859241] sd 8:0:0:0: [sdb] Assuming drive cache: write through
[146033.861982] sd 8:0:0:0: [sdb] No Caching mode page found
[146033.861989] sd 8:0:0:0: [sdb] Assuming drive cache: write through
[146033.880410]  sdb: sdb1
[146033.882907] sd 8:0:0:0: [sdb] No Caching mode page found
[146033.882914] sd 8:0:0:0: [sdb] Assuming drive cache: write through
[146033.882920] sd 8:0:0:0: [sdb] Attached SCSI disk

disk mounted, files are all there. no problem. I copy some other things on it.

[146122.038178] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)

rover asbesto # fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 2000.4 GB, 2000398932992 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029166 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 identifier: 0x00085e8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  3907028991  1953513472   83  Linux

Command (m for help): q

                          cfdisk (util-linux 2.20.1)

                             Disk Drive: /dev/sdb
                     Size: 2000398932992 bytes, 2000.3 GB
            Heads: 255   Sectors per Track: 63   Cylinders: 243201

   Name        Flags      Part Type  FS Type          [Label]        Size (MB)
 -----------------------------------------------------------------------------
                           Pri/Log   Free Space                           1,05*
   sdb1                    Primary   ext4                           2000397,80*
                           Pri/Log   Free Space                           0,09*

   Name        Flags      Part Type  FS Type          [Label]          Sectors
 -----------------------------------------------------------------------------
                           Pri/Log   Free Space                           2048*
   sdb1                    Primary   ext4                           3907026944*
                           Pri/Log   Free Space                            174*

LET'S GO BACK on NORAD to see if everything's ok

Check: perfect, everything is still there, files et al.

Let's move on COSMOS

asbesto@cosmos:~$ uname -a
Linux cosmos 2.6.32-5-686 #1 SMP Tue May 13 16:33:32 UTC 2014 i686 GNU/Linux
asbesto@cosmos:~$ 

asbesto@cosmos:~$ cat /etc/apt/sources.list
deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main

This is a DAMN SHITTY DEBIAN, I suspect this IS the problem...

[   27.652013] eth1: no IPv6 routers present
[  155.492154] usb 1-8: new high speed USB device using ehci_hcd and address 3
[  155.625237] usb 1-8: New USB device found, idVendor=14cd, idProduct=6116
[  155.625243] usb 1-8: New USB device strings: Mfr=1, Product=3, SerialNumber=2
[  155.625247] usb 1-8: Product: USB Mass Storage Device
[  155.625250] usb 1-8: Manufacturer: Generic     
[  155.625253] usb 1-8: SerialNumber: 116AC2101219
[  155.625403] usb 1-8: configuration #1 chosen from 1 choice
[  155.719431] Initializing USB Mass Storage driver...
[  155.719516] usbcore: registered new interface driver usb-storage
[  155.719520] USB Mass Storage support registered.
[  155.727184] scsi4 : SCSI emulation for USB Mass Storage devices
[  155.730627] usbcore: registered new interface driver ums-cypress
[  155.732976] usb-storage: device found at 3
[  155.732980] usb-storage: waiting for device to settle before scanning
[  160.732182] usb-storage: device scan complete
[  160.732668] scsi 4:0:0:0: Direct-Access        Mass  Storage Device        PQ: 0 ANSI: 0
[  160.734080] sd 4:0:0:0: Attached scsi generic sg2 type 0
[  160.734783] sd 4:0:0:0: [sdb] 3907029166 512-byte logical blocks: (2.00 TB/1.81 TiB)
[  160.735281] sd 4:0:0:0: [sdb] Write Protect is off
[  160.735287] sd 4:0:0:0: [sdb] Mode Sense: 03 00 00 00
[  160.735290] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[  160.737103] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[  160.737111]  sdb: sdb1
[  160.743649] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[  160.743656] sd 4:0:0:0: [sdb] Attached SCSI disk
[  167.928023] usb 1-8: reset high speed USB device using ehci_hcd and address 3
[  173.249479] EXT4-fs (sdb1): mounted filesystem with ordered data mode

Smoothly mounted, it seem ok, files are there

root@cosmos:/media/287b593a-124e-4142-822d-67ecffd767bc# ls
Karate  lost+found  pifimon-0.4rc2.tar.gz  PROVA
root@cosmos:/media/287b593a-124e-4142-822d-67ecffd767bc# ls PROVA
rtl8188eu-master.zip
root@cosmos:/media/287b593a-124e-4142-822d-67ecffd767bc# 

Good, files are ok.

What COSMOS see

/dev/sdb1 on /media/287b593a-124e-4142-822d-67ecffd767bc type ext4 (rw,nosuid,nodev,uhelper=udisks)

root@cosmos:~# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdb: 2000.4 GB, 2000398932992 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00085e8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      243202  1953513472   83  Linux

Command (m for help): q

CFDISK gives ERROR!!!

FATAL ERROR: Bad primary partition 0: Partition ends in the final partial cylinder
                         Press any key to exit cfdisk

Since now, the entire HD is CRAP.

gparted doesn't recognize the partition anymore

gparted: /dev/sdb1 UNKNOWN

oloc3.jpg

[  173.249479] EXT4-fs (sdb1): mounted filesystem with ordered data mode
[  285.928023] usb 1-8: reset high speed USB device using ehci_hcd and address 3
[  313.112020] usb 1-8: reset high speed USB device using ehci_hcd and address 3
[  326.112020] usb 1-8: reset high speed USB device using ehci_hcd and address 3
[  385.112046] usb 1-8: reset high speed USB device using ehci_hcd and address 3
[  408.112033] usb 1-8: reset high speed USB device using ehci_hcd and address 3
root@cosmos:~# 

DISK is now DISAPPEARED from devices on "Computer" icon... so can't be mounted.

I disconnect and reconnect it on USB port...

NOTHING. OS can't see it, can't be mounted automatically as happened before.

What COSMOS see NOW about it

root@cosmos:~# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdb: 2000.4 GB, 2000398932992 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00085e8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      243202  1953513472   83  Linux

Command (m for help): q

root@cosmos:~# 

root@cosmos:~# mount /dev/sdb1 /mnt
mount: you must specify the filesystem type
root@cosmos:~# mount /dev/sdb1 /mnt -t ext4
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

root@cosmos:~# 

PARTITION SEEM TOTALLY TRASHED!

I disconnect again the USB cable, and suddendly the kernel CRASHED.

root@cosmos:~# 
Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.979732] Oops: 0000 [#1] SMP 

Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.979736] last sysfs file: /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8/idVendor

Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.979826] Process udisks-probe-at (pid: 2246, ti=ed44e000 task=ef9f1dc0 task.ti=ed44e000)

Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.979829] Stack:

Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.979855] Call Trace:

Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.979990] Code:  Bad EIP value.

Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.979993] EIP: [<2f367473>] 0x2f367473 SS:ESP 0068:ed44fc90

Message from syslogd@cosmos at Feb 27 12:19:12 ...
 kernel:[  767.980000] CR2: 000000002f367473

Kernel failure message 1:

BUG: unable to handle kernel paging request at 2f367473
IP: [<2f367473>] 0x2f367473
*pde = 00000000 
Oops: 0000 [#1] SMP 
last sysfs file: /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8/idVendor
Modules linked in: ext4 jbd2 crc16 ums_cypress usb_storage speedstep_lib cpufreq_conservative cpufreq_userspace cpufreq_powersave cpufreq_stats binfmt_misc fuse loop snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm radeon ttm snd_seq drm_kms_helper snd_timer snd_seq_device drm intel_rng i2c_algo_bit snd soundcore snd_page_alloc rng_core shpchp i2c_i801 i2c_core pci_hotplug parport_pc processor parport pcspkr evdev button psmouse serio_raw ext3 jbd mbcache sg sr_mod cdrom sd_mod crc_t10dif ata_generic ata_piix thermal uhci_hcd e100 floppy thermal_sys mii libata ehci_hcd scsi_mod usbcore nls_base [last unloaded: scsi_wait_scan]

Pid: 2246, comm: udisks-probe-at Not tainted (2.6.32-5-686 #1)         
EIP: 0060:[<2f367473>] EFLAGS: 00010002 CPU: 0
EIP is at 0x2f367473
EAX: efd0d640 EBX: efd0d640 ECX: 2f367473 EDX: efd0d640
ESI: 01282c40 EDI: efeec000 EBP: efd0d640 ESP: ed44fc90
 DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Process udisks-probe-at (pid: 2246, ti=ed44e000 task=ef9f1dc0 task.ti=ed44e000)
Stack:
 c1122c3d c112973c efeec000 efd0d640 00000286 c1129c04 00000000 ed44fd48
<0> ed44fd24 c112f9a0 efdd0e00 efeec000 eff40600 00000000 00000000 00000000
<0> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Call Trace:
 [<c1122c3d>] ? elv_put_request+0x10/0x11
 [<c112973c>] ? __blk_put_request+0x60/0x8e
 [<c1129c04>] ? blk_put_request+0x1e/0x2e
 [<c112f9a0>] ? sg_io+0x304/0x33b
 [<c112fe7e>] ? scsi_cmd_ioctl+0x1fd/0x39a
 [<c1130044>] ? scsi_cmd_blk_ioctl+0x29/0x31
 [<f7e5f713>] ? sd_ioctl+0x9a/0xbc [sd_mod]
 [<c112dc07>] ? __blkdev_driver_ioctl+0x53/0x63
 [<c112e467>] ? blkdev_ioctl+0x850/0x891
 [<c1087d46>] ? find_get_page+0x1f/0x85
 [<c1087f4e>] ? lock_page+0x8/0x1d
 [<c1088516>] ? filemap_fault+0xb5/0x2e6
 [<c109a658>] ? __do_fault+0x381/0x3b1
 [<c108c84d>] ? __alloc_pages_nodemask+0xf3/0x4d9
 [<c10d2458>] ? block_ioctl+0x27/0x2c
 [<c10d2431>] ? block_ioctl+0x0/0x2c
 [<c10be534>] ? vfs_ioctl+0x1c/0x5f
 [<c10beac8>] ? do_vfs_ioctl+0x4aa/0x4e5
 [<c1135f1a>] ? _atomic_dec_and_lock+0x26/0x40
 [<c10c1cbd>] ? dput+0x34/0x105
 [<c12719a0>] ? do_page_fault+0x2f1/0x307
 [<c10beb44>] ? sys_ioctl+0x41/0x58
 [<c10030fb>] ? sysenter_do_call+0x12/0x28
Code:  Bad EIP value.
EIP: [<2f367473>] 0x2f367473 SS:ESP 0068:ed44fc90
CR2: 000000002f367473
---[ end trace d9b9738ac05d5045 ]---

DEBIAN SH1%!!!!!!!!!!!!!!!!!!!!

Let's get back the USB disk on my GEMINI laptop

[147498.501036] usb 2-1.2: new high-speed USB device number 6 using ehci-pci
[147498.594567] usb 2-1.2: New USB device found, idVendor=14cd, idProduct=6116
[147498.594576] usb 2-1.2: New USB device strings: Mfr=1, Product=3, SerialNumber=2
[147498.594581] usb 2-1.2: Product: USB Mass Storage Device
[147498.594584] usb 2-1.2: Manufacturer: Generic     
[147498.594588] usb 2-1.2: SerialNumber: 116AC2101219
[147498.595007] usb-storage 2-1.2:1.0: USB Mass Storage device detected
[147498.595137] scsi10 : usb-storage 2-1.2:1.0
[147499.594704] scsi 10:0:0:0: Direct-Access        Mass  Storage Device        PQ: 0 ANSI: 0
[147499.595333] sd 10:0:0:0: Attached scsi generic sg1 type 0
[147499.595834] sd 10:0:0:0: [sdb] 3907029166 512-byte logical blocks: (2.00 TB/1.81 TiB)
[147499.596539] sd 10:0:0:0: [sdb] Write Protect is off
[147499.596545] sd 10:0:0:0: [sdb] Mode Sense: 03 00 00 00
[147499.597482] sd 10:0:0:0: [sdb] No Caching mode page found
[147499.597490] sd 10:0:0:0: [sdb] Assuming drive cache: write through
[147499.603749] sd 10:0:0:0: [sdb] No Caching mode page found
[147499.603758] sd 10:0:0:0: [sdb] Assuming drive cache: write through
[147499.615987]  sdb: sdb1
[147499.618473] sd 10:0:0:0: [sdb] No Caching mode page found
[147499.618479] sd 10:0:0:0: [sdb] Assuming drive cache: write through
[147499.618485] sd 10:0:0:0: [sdb] Attached SCSI disk
rover asbesto # 

No desktop icon, I will try a manual mount:

rover asbesto # mount /dev/sdb1 /mnt
mount: you must specify the filesystem type
rover asbesto # mount /dev/sdb1 /mnt -t ext4
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

rover asbesto # 

FACEPALM!

What GEMINI see of this disk now

rover asbesto # fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 2000.4 GB, 2000398932992 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029166 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 identifier: 0x00085e8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  3907028991  1953513472   83  Linux

Command (m for help): q

rover asbesto # 

                          cfdisk (util-linux 2.20.1)

                              Disk Drive: /dev/sdb
                      Size: 2000398932992 bytes, 2000.3 GB
             Heads: 255   Sectors per Track: 63   Cylinders: 243201

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)
 ------------------------------------------------------------------------------
                            Pri/Log   Free Space                           1,05*
    sdb1                    Primary   Linux                          2000397,80*
                            Pri/Log   Free Space                           0,09*

    Name        Flags      Part Type  FS Type          [Label]          Sectors
 ------------------------------------------------------------------------------
                            Pri/Log   Free Space                           2048*
    sdb1                    Primary   Linux                          3907026944*
                            Pri/Log   Free Space                            174*

GPARTED: Error on partition!

oloc5.jpg

Let's try testdisk on it

TestDisk 6.14, Data Recovery Utility, July 2013
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sdb - 2000 GB / 1863 GiB - CHS 243201 255 63
Current partition structure:
     Partition                  Start        End    Size in sectors

No ext2, JFS, Reiser, cramfs or XFS marker
 1 P Linux                    0  32 33 243201  78 13 3907026944
 1 P Linux                    0  32 33 243201  78 13 3907026944
No partition is bootable

I save partition data on backup.log and go along

Disk /dev/sdb - 2000 GB / 1863 GiB - CHS 243201 255 63
     Partition               Start        End    Size in sectors
>* Linux                    0  32 33 243201  78 13 3907026944

I choose P, LIST FILES

Directory /

>drwxr-xr-x  1000  1000      4096 27-Feb-2016 12:00 .
 drwxr-xr-x  1000  1000      4096 27-Feb-2016 12:00 ..
 drwx------  1000  1000     16384 27-Feb-2016 11:50 lost+found
 drwxr-xr-x  1000  1000      4096 29-Mar-2010 15:50 Karate
 -rw-r-----  1000  1000     20150 27-Feb-2016 12:00 pifimon-0.4rc2.tar.gz
 drwxr-xr-x  1000  1000      4096 27-Feb-2016 12:00 PROVA

...and they are all f%ck1ng still there, holy cr4p!

I try WRITE partition table, and try a new mount:

rover asbesto # mount /dev/sdb1 /mnt
mount: you must specify the filesystem type
rover asbesto # mount /dev/sdb1 /mnt -t ext4
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

[148969.955213] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
[148969.955963] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
[148969.956591] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
[148969.957706] FAT-fs (sdb1): bogus number of FAT structure
[148969.957713] FAT-fs (sdb1): Can't find a valid FAT filesystem
[148969.960224] XFS (sdb1): bad magic number
[148969.960279] XFS (sdb1): SB validate failed with error 22.
[148971.906421] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
[148971.907169] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
[148971.907918] EXT4-fs (sdb1): VFS: Can't find ext4 filesystem
[148971.908918] FAT-fs (sdb1): bogus number of FAT structure
[148971.908924] FAT-fs (sdb1): Can't find a valid FAT filesystem
[148971.919567] XFS (sdb1): bad magic number

NOTHING TO DO.

With gparted, I delete and create again the same unformatted partition

NOTHING TO DO.

Files are still there, testdisk can read them all.

I try fsck.ext4:

rover asbesto # fsck.ext4 /dev/sdb1
e2fsck 1.42.9 (4-Feb-2014)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
/dev/sdb1 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inode 3325953 is in use, but has dtime set.  Fix<y>? yes
Inode 3325953 has a extra size (34303) which is invalid
Fix<y>? yes
Inode 3325953 has compression flag set on filesystem without compression support.  Clear<y>? yes
Inode 3325953, i_size is 5332049955685662513, should be 0.  Fix<y>? yes
Inode 3325953, i_blocks is 181415946747698, should be 0.  Fix<y>? yes
Inode 3325954 is in use, but has dtime set.  Fix<y>? yes
Inode 3325954 has a extra size (53569) which is invalid
Fix<y>? yes
Inode 3325954 has INDEX_FL flag set but is not a directory.
Clear HTree index<y>? yes
Inode 3325954, i_size is 13941736783679938815, should be 0.  Fix<y>? yes
Inode 3325954, i_blocks is 217780600324095, should be 0.  Fix<y>? yes
Inode 3325955 is in use, but has dtime set.  Fix<y>? yes
Inode 3325955 has a extra size (139) which is invalid
Fix<y>? yes
Inode 3325955, i_size is 34505975998209259, should be 0.  Fix<y>? yes
Inode 3325955, i_blocks is 562607185026, should be 0.  Fix<y>? yes
Inode 3325956 is in use, but has dtime set.  Fix<y>? yes
Inode 3325956 has a extra size (15872) which is invalid
Fix<y>? yes
Inode 3325957 is in use, but has dtime set.  Fix<y>? yes
Inode 3325957 has imagic flag set.  Clear<y>? yes
Inode 3325957 has a extra size (18453) which is invalid
Fix<y>? yes
Inode 3325958 is in use, but has dtime set.  Fix<y>? yes
Inode 3325958 has imagic flag set.  Clear<y>? yes
Inode 3325958 has a extra size (65485) which is invalid
Fix<y>? yes
Inode 3325958 has compression flag set on filesystem without compression support.  Clear<y>? yes
Inode 3325958 has INDEX_FL flag set but is not a directory.
Clear HTree index<y>? yes
Inode 3325958, i_size is 18429985314207426313, should be 0.  Fix<y>? 
Inode 3325958, i_blocks is 281237126113649, should be 0.  Fix<y>? yes
Inode 3325959 is in use, but has dtime set.  Fix<y>? yes
Inode 3325959 has imagic flag set.  Clear<y>? yes
Inode 3325959 has a extra size (18176) which is invalid
Fix<y>? yes
Inode 3325960 is in use, but has dtime set.  Fix<y>? yes
Inode 3325960 has a extra size (7984) which is invalid
Fix<y>? yes
Inode 3325961 is in use, but has dtime set.  Fix<y>? yes
Inode 3325961 has imagic flag set.  Clear<y>? yes
Inode 3325961 has a extra size (65437) which is invalid
Fix<y>? yes
Inode 3325961 has compression flag set on filesystem without compression support.  Clear<y>? yes
Error while reading over extent tree in inode 3325961: Corrupt extent header
Clear inode<y>? yes
Inode 3325961, i_size is 18419413512053842605, should be 0.  Fix<y>? yes
Inode 3325961, i_blocks is 281053717582327, should be 0.  Fix<y>? yes
Inode 3325962 is in use, but has dtime set.  Fix<y>? yes
Inode 3325962 has a extra size (30720) which is invalid
Fix<y>? yes
Special (device/socket/fifo) inode 3325962 has non-zero size.  Fix<y>? yes
Inode 3325962 has compression flag set on filesystem without compression support.  Clear<y>? yes

Inode 3325962 has a bad extended attribute block 2765568.  Clear<y>? yes
Inode 3325962, i_blocks is 249589943304240, should be 0.  Fix<y>? yes
Inode 3325963 is in use, but has dtime set.  Fix<y>? yes
Inode 3325963 has a extra size (10187) which is invalid
Fix<y>? yes
Inode 3325964 is in use, but has dtime set.  Fix<y>? yes
Inode 3325964 has imagic flag set.  Clear<y>? yes
Inode 3325964 has a extra size (65474) which is invalid
Fix<y>? yes
Inode 3325965 is in use, but has dtime set.  Fix<y>? yes
Inode 3325965 has a extra size (42239) which is invalid
Fix<y>? yes
Inode 3325965 has compression flag set on filesystem without compression support.  Clear<y>? yes
Inode 3325965, i_size is 15059897904129638241, should be 0.  Fix<y>? yes
Inode 3325965, i_blocks is 62669493370720, should be 0.  Fix<y>? yes
Inode 3325966 is in use, but has dtime set.  Fix<y>? 

Got really PISSED OF pressing Y forever, I try fsck.ext4 -y

oloc6.jpg

ULTRA PISSED OFF of waiting forever, CTRL-C AND F%CK 1T.

TEST: save partition data and compare it before/after the problem

So I used

sfdisk -d /dev/sdb >filename

to restore eventually with

sfdisk /dev/sdb <filename

but they seem exactly the same.

Working hd:

# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=     2048, size=3907026944, Id=83
/dev/sdb2 : start=        0, size=        0, Id= 0
/dev/sdb3 : start=        0, size=        0, Id= 0
/dev/sdb4 : start=        0, size=        0, Id= 0
partizionebiterone (END)

Damaged hd:

# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=     2048, size=3907026944, Id=83
/dev/sdb2 : start=        0, size=        0, Id= 0
/dev/sdb3 : start=        0, size=        0, Id= 0
/dev/sdb4 : start=        0, size=        0, Id= 0
biteronesmerdato (END)

TRYING with a GPT label / partitioning scheme

Used parted manually to create GPT label, partition etc.

SAME PROBLEM.

udisks doing shit?

Nope. Killed udisks daemon, mounted / unmounted manually, only "rw" as mount option, same prolem.

THE SOLUTION

I dist-upgraded debian squeeze to debian wheezy and the problem DISAPPEARED.

It seem related to kernel 2.6.32-5-686...

I HATE DEBIAN. Why? Because there's no kernel update for squeezy. And yes, I had backports enabled, but apt-get update && apt-get upgrade installed nothing.

GO DEVUAN - http://devuan.org

Some references

HardDiskHolocaust (last edited 2016-02-27 17:52:19 by asbesto)