Fixdisk repeatedly unable to find partition 1

prpr

Well-Known Member
Here's the output from the modified igorw script from post #16:
That looks good, although the numbers slightly surprise me.
You should be able to recreate the partitions manually using gfdisk -u /dev/sda as described in the post referenced in #4 in this thread.
Start and end should probably be:
P1: 64 and 2104574
P2: 2104576 and 3886043174
P3: 3886043176 and 3907024070
and you should end up with this:
Code:
Command (m for help): p                                               

Disk /dev/sda: 2000 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              64     2104574     1060258   83  Linux
Warning: Partition 1 does not end on cylinder boundary.               
/dev/sda2         2104576  3866043174  1931968867   83  Linux
Warning: Partition 2 does not end on cylinder boundary.               
/dev/sda3      3886043176  3907024070    10490445   83  Linux
Warning: Partition 3 does not end on cylinder boundary.               
Command (m for help):
The important one is obviously P2. Hopefully this is enough to resurrect your recordings.
I don't particularly like some of the SMART stats. though, so you may want to consider replacing it, even though it's quite low hours.
 
Last edited:

/df

Well-Known Member
Is it just 8x out? So 1..32 might have been good for traditional disks but it should use 8..256 for 4k physical sectors?
 

prpr

Well-Known Member
Is it just 8x out?
No. Logical sectors are still 512 bytes regardless.
There is an offset compared to my disk: P1 is 56 higher, P2 is 64 higher, P3 is 8 higher. This is why I was slightly surprised at the numbers.

The OP's disk is obviously a different model than mine, despite being the same basic type (1CT164 vs. 1ET164), and certain other details are different. I wonder what partitioned it.

Also, I have the exact same "Error: UNC at LBA = 0x0fffffff = 268435455" error on a remote box (which gets turned off daily and has minor similar SMART niggles), also associated with a bad sector event, again with the same disk as in mine (which never gets turned off and has nothing nasty in the SMART).
 
OP
thoughton

thoughton

Forum Supporter
That looks good, although the numbers slightly surprise me.
You should be able to recreate the partitions manually using gfdisk -u /dev/sda as described in the post referenced in #4 in this thread.
Ok, I've given this a go, although I'm not sure if it's worked (or I'm not sure what the next steps should be).

Here's the log from my first session:

Code:
      /-------------------------\
      |  T E L N E T   M E N U  |
      \-------------------------/

  [ Humax HDR-Fox T2 (humax) 1.03.12/3.13 ]

  Note: Some areas of the hard disk are not mounted.
        Not all functions will be available.
        (normal if you have just run a disk check)

   maint - Restart into maintenance mode.
    safe - Enable safe mode on next boot.
     rma - Enable return-to-manufacturer (RMA) mode.
   reset - Reset custom firmware environment.
    stat - Show current activity.
       x - Exit and close connection.
  reboot - Reboot the Humax.
    diag - Run a diagnostic.
     cli - System command line (advanced users).

Please select option: cli

-----------------------------------------------------------------------

Humax HDR-Fox T2 (humax) 1.03.12/3.13

To return to the menu, type: exit

humax# gfdisk /dev/sda
GNU Fdisk 1.3.0a
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Using /dev/sda
Command (m for help): m
Command action
   a   toggle bootable flag
   b   edit bsd disklabel
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): o
Command (m for help): n
Partition type
   e   extended
   p   primary partition (1-4)
p
First sector  (default 63s): 64
Last sector or +size or +sizeMB or +sizeKB  (default 3907024064s): 2104574
Command (m for help): n
Partition type
   e   extended
   p   primary partition (1-4)
p
First sector  (default 63s): 2104576
Last sector or +size or +sizeMB or +sizeKB  (default 3907024064s): 3886043174
Command (m for help): n
Partition type
   e   extended
   p   primary partition (1-4)
p
First sector  (default 63s): 3886043176
Last sector or +size or +sizeMB or +sizeKB  (default 3907024064s): 3907024070
Command (m for help): p

Disk /dev/sda: 2000 GB, 2000396321280 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024065 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              64     2104574     1060258   83  Linux
Warning: Partition 1 does not end on cylinder boundary.
/dev/sda2         2104576  3886043174  1941961297   83  Linux
/dev/sda3      3886043176  3907024070    10490445   83  Linux
Warning: Partition 3 does not end on cylinder boundary.
Command (m for help): w
Information: Don't forget to update /etc/fstab, if necessary.


Writing all changes to /dev/sda.
Error: Partition(s) 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda have been
written, but we have been unable to inform the kernel of the change, probably
because it/they are in use.  As a result, the old partition(s) will remain in
use.  You should reboot now before making further changes.
   i   Ignore
   c   Cancel
/CODE]

I'll be honest, at this point I wasn't really sure what difference between Ignore and Cancel was, so instead I decided to "reboot" with the big button on the front of the Humax...

[CODE]
Connection closed by foreign host.

Perhaps unsurprisingly when the Humax had rebooted it still showed the "disk needs formatting" message on the TV.

Here I decided to restart in Maintenance mode instead, and see if that would allow me to fix the error from the end of the previous session. So here's the log of that Meintenance session:
Code:
      /---------------------------------------------\
      |  M A I N T E N A N C E   M O D E   M E N U  |
      \---------------------------------------------/

  [ Humax HDR-Fox T2 (humax) 1.03.12/3.13 ]

  Note: Some areas of the hard disk are not mounted.
        Not all functions will be available.
        (normal if you have just run a disk check)

 fixdisk - Check and repair hard disk.
   short - Run short hard-disk self test.
    long - Run long hard-disk self test.
   check - Check self-test progress.
    gptf - Re-format disk using GPT scheme.
     epg - Clear persistent EPG data.
    dlna - Reset DLNA server database.
       x - Leave maintenance mode (Humax will restart).
    diag - Run a diagnostic.
     cli - System command line (advanced users).

Please select option: cli

-----------------------------------------------------------------------

Humax HDR-Fox T2 (humax) 1.03.12/3.13

To return to the menu, type: exit

humax#
humax# gfdisk /dev/sda
GNU Fdisk 1.3.0a
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Using /dev/sda
Command (m for help): m
Command action
   a   toggle bootable flag
   b   edit bsd disklabel
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): p

Disk /dev/sda: 2000 GB, 2000396321280 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         132     1060258   83  Linux
Warning: Partition 1 does not end on cylinder boundary.
/dev/sda2             132      241895  1941961297   83  Linux
/dev/sda3          241896      243202    10490445   83  Linux
Warning: Partition 3 does not end on cylinder boundary.
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): p

Disk /dev/sda: 2000 GB, 2000396321280 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024065 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              64     2104574     1060258   83  Linux
Warning: Partition 1 does not end on cylinder boundary.
/dev/sda2         2104576  3886043174  1941961297   83  Linux
/dev/sda3      3886043176  3907024070    10490445   83  Linux
Warning: Partition 3 does not end on cylinder boundary.
Command (m for help): w
Information: Don't forget to update /etc/fstab, if necessary.


Writing all changes to /dev/sda.
Error: Partition(s) 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda have been
written, but we have been unable to inform the kernel of the change, probably
because it/they are in use.  As a result, the old partition(s) will remain in
use.  You should reboot now before making further changes.
   i   Ignore
   c   Cancel
i
Error: Partition(s) 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda have been
written, but we have been unable to inform the kernel of the change, probably
because it/they are in use.  As a result, the old partition(s) will remain in
use.  You should reboot now before making further changes.
   i   Ignore
   c   Cancel
i
humax#
humax# exit

Press return to continue:

      /---------------------------------------------\
      |  M A I N T E N A N C E   M O D E   M E N U  |
      \---------------------------------------------/

  [ Humax HDR-Fox T2 (humax) 1.03.12/3.13 ]

  Note: Some areas of the hard disk are not mounted.
        Not all functions will be available.
        (normal if you have just run a disk check)

 fixdisk - Check and repair hard disk.
   short - Run short hard-disk self test.
    long - Run long hard-disk self test.
   check - Check self-test progress.
    gptf - Re-format disk using GPT scheme.
     epg - Clear persistent EPG data.
    dlna - Reset DLNA server database.
       x - Leave maintenance mode (Humax will restart).
    diag - Run a diagnostic.
     cli - System command line (advanced users).

Please select option: x
Are you sure you wish to leave maintenance mode and restart? [Y/N] y
Restarting........Connection closed by foreign host.

I was somewhat heartened to see my previous changes had seemed to persist when choosing the p command, so instead of going through the process of creating the partitions again, I decided to instead try the w command to just write the changes and quit.

Unfortunately, as the logs show, I encounterd the same "unable to inform kernel of the change" error again. This time I chose the Ignore option (had to choose it twice) and then rebooted out of Maintenance mode.

I again still have the same "disk needs formatting" message appear on the TV though.

Are the gfdisk results as expected? Are there any steps I've missed or further steps I should try?

Thanks!
 

prpr

Well-Known Member
Are the gfdisk results as expected? Are there any steps I've missed or further steps I should try?
It looks right, based on the previously supplied information.
I would probably try e2fsck -n /dev/sda1 first and see what it says. Then same for /dev/sda3.
Ignore sda2 for the moment. These are non-destructive with -n.
 
OP
thoughton

thoughton

Forum Supporter
I would probably try e2fsck -n /dev/sda1 first and see what it says. Then same for /dev/sda3.

/dev/sda1 finished quickly and to my untrained eye doesn't look great:

Code:
humax# e2fsck -n /dev/sda1
e2fsck 1.42.13 (17-May-2015)
The filesystem size (according to the superblock) is 263064 blocks
The physical size of the device is 263063 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort? no

/dev/sda1 contains a file system with errors, check forced.
Resize inode not valid.  Recreate? no

Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory.  Clear? no

Journal is not regular file.  Fix? no

Pass 2: Checking directory structure
Entry '..' in <2>/<36561> (36561) has deleted/unused inode 2.  Clear? no

Entry '..' in <2>/<36561> (36561) has an incorrect filetype (was 2, should be 0).
Fix? no

Pass 3: Checking directory connectivity
Root inode not allocated.  Allocate? no

Cannot proceed without a root inode.

/dev/sda1: ********** WARNING: Filesystem still has errors **********

e2fsck: aborted

/dev/sda1: ********** WARNING: Filesystem still has errors **********

/dev/sda3 took a little longer:

Code:
humax# e2fsck -n /dev/sda3
e2fsck 1.42.13 (17-May-2015)
/dev/sda3 has been mounted 5901 times without being checked, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda3: 13/655776 files (0.0% non-contiguous), 933209/2622611 blocks
 

prpr

Well-Known Member
/dev/sda1 finished quickly and to my untrained eye doesn't look great
No, nor mine. I would try setting the start of that partition to sector 8 instead of 64 and then repeat the process. (Or maybe 56 on a second look at the numbers.)
You may find dumpe2fs -h /dev/sda1 of use as well.

sda3 looks good though which is nice to know. Shows we're getting there! So, it should be safe to do e2fsck /dev/sda3 now.
 
Last edited:
OP
thoughton

thoughton

Forum Supporter
No, nor mine. I would try setting the start of that partition to sector 8 instead of 64 and then repeat the process. (Or maybe 56 on a second look at the numbers.)

Thanks. Below is the output from my attempt at changing partition 1's first sector to 56.

Code:
humax# gfdisk /dev/sda
GNU Fdisk 1.3.0a
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Using /dev/sda
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): p

Disk /dev/sda: 2000 GB, 2000396321280 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024065 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              64     2104574     1060258   83  Linux
Warning: Partition 1 does not end on cylinder boundary.
/dev/sda2         2104576  3886043174  1941961297   83  Linux
/dev/sda3      3886043176  3907024070    10490445   83  Linux
Warning: Partition 3 does not end on cylinder boundary.
Command (m for help): o
Command (m for help): n
Partition type
   e   extended
   p   primary partition (1-4)
p
First sector  (default 63s): 56
Last sector or +size or +sizeMB or +sizeKB  (default 0s): 2104574
Command (m for help): n
Partition type
   e   extended
   p   primary partition (1-4)
p
First sector  (default 2104575s): 2104576
Last sector or +size or +sizeMB or +sizeKB  (default 3907024064s): 3886043174
Command (m for help): n
Partition type
   e   extended
   p   primary partition (1-4)
p
First sector  (default 2104575s): 3886043176
Last sector or +size or +sizeMB or +sizeKB  (default 3907024064s): 3907024070
Command (m for help): p

Disk /dev/sda: 2000 GB, 2000396321280 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907024065 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              56     2104574     1060258   83  Linux
Warning: Partition 1 does not end on cylinder boundary.
/dev/sda2         2104576  3886043174  1941961297   83  Linux
/dev/sda3      3886043176  3907024070    10490445   83  Linux
Warning: Partition 3 does not end on cylinder boundary.
Command (m for help): w
Information: Don't forget to update /etc/fstab, if necessary.


Writing all changes to /dev/sda.
Error: Partition(s) 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda have been
written, but we have been unable to inform the kernel of the change, probably
because it/they are in use.  As a result, the old partition(s) will remain in
use.  You should reboot now before making further changes.
   i   Ignore
   c   Cancel
i
Error: Partition(s) 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/sda have been
written, but we have been unable to inform the kernel of the change, probably
because it/they are in use.  As a result, the old partition(s) will remain in
use.  You should reboot now before making further changes.
   i   Ignore
   c   Cancel
i
humax#
humax# exit

Nothing much to report aside from I had to "ignore" (twice) the same errors when writing the changes again, and I still have the same error on the TV when I reboot.

Next I will try running e2fsck -n /dev/sda1 again.
 
OP
thoughton

thoughton

Forum Supporter
Next I will try running e2fsck -n /dev/sda1 again.

Oh, an even quicker failure this time:

Code:
humax# e2fsck -n /dev/sda1
e2fsck 1.42.13 (17-May-2015)
ext2fs_open2: Bad magic number in super-block
/usr/lib/ext2/bin/e2fsck: Superblock invalid, trying backup blocks...
/usr/lib/ext2/bin/e2fsck: Bad magic number in super-block while trying to open /dev/sda1

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>
 

prpr

Well-Known Member
Oh, an even quicker failure this time
There's some inconsistency in what the superblock reports compared to what diag igorw found, which is kind of what I was exploring.
P1 is disposable anyway, so not worth wasting any more time on, but what you really want to avoid is trashing any of P2.
You could try e2fsck -n /dev/sda2 and see if it is as happy as P3. If it is, then it's just a matter of re-making the filesystem on P1 and running e2fsck in write/fix mode on P2 (but you'll need a swap file, which hopefully is already on P3, now that's proved OK - try mount /dev/sda3 /mnt/hd3 followed by ls -l /mnt/hd3/.swap if successful).
 

prpr

Well-Known Member
Duh, I've just realised that the inconsistency in P1 is possibly easily fixable.
Instead of 64 to 2104574 make it 64 to 2104575, which makes it 2104512 sectors in length, which is 263064 4k blocks (which is what the superblock says).
All the HDRs I've looked at have this strange -1 offset on the end sector of all partitions, which results in a wasted 7 sectors, and a wasted block, and generally confuses. I wonder what Humax were thinking when they wrote the partitioning software?
 
OP
thoughton

thoughton

Forum Supporter
e2fsck /dev/sda3 seemed pretty uneventful (hopefully a good thing):

Code:
humax# e2fsck /dev/sda3
e2fsck 1.42.13 (17-May-2015)
/dev/sda3 has been mounted 5901 times without being checked, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda3: 13/655776 files (0.0% non-contiguous), 933209/2622611 blocks
humax#

Haven't tried mounting it yet.

Currently have a e2fsck -n /dev/sda2 in progress. Doesn't look great so far. Not sure how long it's going to take, but here's the progress after about 5 mins:

Code:
humax# e2fsck -n /dev/sda2
e2fsck 1.42.13 (17-May-2015)
Warning: skipping journal recovery because doing a read-only filesystem check.
The filesystem size (according to the superblock) is 485492325 blocks
The physical size of the device is 485492324 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort? no

/dev/sda2 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes

Duh, I've just realised that the inconsistency in P1 is possibly easily fixable.

Oh nice! Thanks! I'll give your suggestion a try once the above e2fsck -n /dev/sda2 finishes (unless you think it's ok to cancel?).
 

prpr

Well-Known Member
Oh nice! Thanks! I'll give your suggestion a try once the above e2fsck -n /dev/sda2 finishes (unless you think it's ok to cancel?).
I would cancel it. It's only in read-only mode, and you haven't set up your swap file yet, so it'll probably fail at some point down the line anyway. And it can take several hours, so don't let that put you off.
It looks like you need to adjust the end sector of P2 as well as P1 though - just increase them both by 1 in the partition table and reboot.
If your swap file exists (see previous) then you need to activate it first (swapon /mnt/hd3/.swap), having mounted the partition of course.

But, if the partition table is now correct, then you could just run fix-disk again and it should do it all for you, but make sure you use the option to omit the SMART checks as otherwise it may end up blatting the table again if it rewrites LBA 0.
 
Top