Link to home
Start Free TrialLog in
Avatar of ashokvpp
ashokvpp

asked on

hdc Error:Attempt to access beyond end of device

Hi All,,

 Hope you all doing good:)  I have a quick question ....

I keep getting errors like :-

hdc1:rw=1 wants=613670 limit=610407
hdc Error:Attempt to access beyond end of device
=========================================
Below is info :-

Fdisk

Disk /dev/hdc: 512 MB, 512483328 bytes
255 heads, 63 sectors/track, 62 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1   *           1          38      305203+  83  Linux
============================================

Fsck:-

fsck 1.38 (30-Jun-2005)
Warning!  /dev/hdc1 is mounted.
The filesystem size (according to the superblock) is 306904 blocks
The physical size of the device is 305203 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort? no

Pass 1: Checking inodes, blocks, and sizes
Deleted inode 67368 has zero dtime.  Fix? no

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Unattached inode 67370
Connect to /lost+found? no

Pass 5: Checking group summary information
Block bitmap differences:  -218113 -(219649--219656) -275969 -(276486--276525)
Fix? no

Free blocks count wrong (252525, counted=252430).
Fix? no

Inode bitmap differences:  -(52724--52725) -67368 -67371
Fix? no

Free inodes count wrong (72624, counted=72583).
Fix? no


ASTROOT: ********** WARNING: Filesystem still has errors **********


    4288 inodes used (5%)
      20 non-contiguous inodes (0.5%)
         # of inodes with ind/dind/tind blocks: 477/22/0
   54379 blocks used (17%)
       0 bad blocks
       0 large files

    1702 regular files
     159 directories
    1688 character device files
     480 block device files
       0 fifos
       1 link
     285 symbolic links (285 fast symbolic links)
       2 sockets--------

    4316 files
============================================

Pls suggest me to fix this issue.

Thanks in advance:)

Best Regards
ashok
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ashokvpp
ashokvpp

ASKER

Hello ,,,

Thank u so much for ur imm reply...:)

Well i have cross compiled uclibc and made a image using bximage

bximage  -q -hd -mode=flat -size=$SIZE disk.img

then performed...below steps..

1.   losetup /dev/loop0 disk.img

2.  fdisk /dev/loop0

3. losetup -d /dev/loop0

4.  ln -sf /dev/loop0 /dev/loop

5.  losetup /dev/loop0 disk.img
losetup -o 32256 /dev/loop1 disk.img

mke2fs -O sparse_super -L ASHROOT -m0 -q /dev/loop1

6. mkdir -p /mnt/image
mount -t ext2 /dev/loop1 /mnt/image
cp -a build_i686/root/* /mnt/image/
tar -xz -C /mnt/image/ -f target/generic/dev.tar.gz
tar -xz -C /mnt/image/stat/ -f target/generic/dev.tar.gz
chown -Rh root:root /mnt/image
chmod 4755 /mnt/image/bin/busybox

Then initialised grub

7.  GRUB
grub> device (hd0) /dev/loop
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Finally....

8. umount /mnt/image

losetup -d /dev/loop0
losetup -d /dev/loop1
   
Then i copied disk.img to my 512MB compact flash card  and booted linux ... works fine ..but im ended up with
too mnay errrors...

hdc1:rw=1 wants=613670 limit=610407
hdc Error:Attempt to access beyond end of device

can u pls be more precise on doing resize for my hdc1 partition.

Thanks in advance

Best Regards
ashok




> can u pls be more precise on doing resize for my hdc1 partition.
resize2fs -p /dev/hdc1 # should try resize hdc1 filesystem to size of the device - that was Your error?
Hi,,

Thanks  for you rreply :)

 Well i tried the command you put by booting the machine into single user mode. But unsuccessfull.

Below is the error

#resize2fs -p /dev/hdc1

ext2fs_check_if_mount: No such file or directory while determining whether /dev/hdc1 is mounted.

Please run e2fsck -f /dev/hdc1 first.

Then i performed it

#e2fsck -f /dev/hdc1
ext2fs_check_if_mount: No such file or directory while determining whether /dev/hdc1 is mounted.

The file system size (according to super block is ) 306904 blocks.

The physical size of teh device is ========== 305203 blocks

Either superblock or teh partition table is corrupt
Abort<y> yes

Pls suggest me ahead ...to fix it

Thanks in advance

Best Regards
ashok

Helo Frnds,

   Good morning :)   ... Yes you are right ....n i agree wit u :)   Still problem persists...

Here is how i am doing ..n trying to get it fixed ...

 
1. )    I had the Buildroot ready with the folowing directory hierarchy
 
  [root@eden root]# ls
bin  boot  dev  etc  home  lib  lost+found  mnt  opt  proc  root  sbin  stat  sys  tftpboot  tmp  usr  var


2) Then next

./bximage -q -hd -mode=flat -size=300MB disk.img

losetup /dev/loop0 disk.img

fdisk /dev/loop0

losetup -d /dev/loop0

ln -sf /dev/loop0 /dev/loop

losetup /dev/loop0 disk.img
losetup -o 32256 /dev/loop1 disk.img


mke2fs -O sparse_super -L ASHROOT -m0 -q /dev/loop1


mkdir -p /mnt/image
mount -t ext2 /dev/loop1 /mnt/image
cp -a build_i686/root/* /mnt/image/
tar -xz -C /mnt/image/ -f target/generic/dev.tar.gz
tar -xz -C /mnt/image/stat/ -f target/generic/dev.tar.gz
chown -Rh root:root /mnt/image
chmod 4755 /mnt/image/bin/busybox

grub

grub> device (hd0) /dev/loop
grub> root (hd0,0)
grub> setup (hd0)
grub> quit


umount /mnt/image

losetup -d /dev/loop0
losetup -d /dev/loop1


3)   Once my disk.img is ready i used physdiskwrite v0.5.1


c:\>physdiskwrite.exe disk.img

Which writes disk.img to my 512MB Compacy flash card.

4)  Then im booting with my compact flash boots up fine ...

After a while  i get eror like ..
hdc1:rw=1 wants=613670 limit=610407
hdc Error:Attempt to access beyond end of device


5)  Then i tried

micro /root # fsck.ext2 -fv /dev/hdc1
e2fsck 1.35 (28-Feb-2004)
/dev/hdc1 is mounted.

WARNING!!!  Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)? yes

The [b]filesystem size (according to the superblock) is 306904 blocks[/b]
The [b]physical size of the device is 305203 blocks[/b]
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? no

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
Block bitmap differences:  -302416
Fix<y>? yes

Free blocks count wrong for group #36 (4070, counted=4071).
Fix<y>? yes

Free blocks count wrong (192443, counted=192444).
Fix<y>? yes


ASHROOT: ***** FILE SYSTEM WAS MODIFIED *****
ASHROOT: ***** REBOOT LINUX *****

    5685 inodes used (7%)
      32 non-contiguous inodes (0.6%)
         # of inodes with ind/dind/tind blocks: 682/70/0
  114460 blocks used (37%)
       0 bad blocks
       0 large files

    2815 regular files
     437 directories
    1688 character device files
     480 block device files
       0 fifos
       0 links
     253 symbolic links (253 fast symbolic links)
       3 sockets
--------
    5676 files
===============================================================

After Rebooting still i get HDC1 error....when i run Fsck.ext2  again it says Filesystem Size is more than Physical disk. :(

Pls tell where am i doing wrong,,,  so it is seeing

1. filesystem size (according to the superblock) is 306904 blocks???
2. physical size of the device is 305203 blocks.


How do i create filesystem size equal to physical size...and then write image to CF card.?

Pls help ahead....:)

Thanks in advance

Best Regards
ashok
Hello All,,
 
Any ways i solved the problem of HDC errors with existing CF card ...
 
The problem is when creating filesystem using Fdisk ..
 
Below is the steps..
 
Step 1.
                Note down the cylinder Size of bximage output Wrritten
        Eg:-    ata0-master: type=disk, path="c.img", mode=flat, cylinders=1015, heads=16, spt=63
Step 2.
        Command (m for help): x
                Expert command (m for help): h 16
                Number of heads (1-256, default 255): 16
                Expert command (m for help): s
                Number of sectors (1-63, default 63): 63
                Warning: setting sector offset for DOS compatiblity
                Expert command (m for help): c
                Number of cylinders (1-1048576): 1015
                Expert command (m for help): r
----------------------------------------------------------------------------------------
        Command (m for help): n
        Command action
                   e   extended
                   p   primary partition (1-4)
        p
        Partition number (1-4): 1
        First cylinder (1-1015, default 1):
        Using default value 1
        Last cylinder or +size or +sizeM or +sizeK (1-1015, default 1015):
        Using default value 1015
Command (m for help): wq

 
But i use to do just from ----line----- below ..that created the problem of having filesystem BIG and physical device small.

Solved my self :)

Thank u all.....
 
Warm Regards
ashok
Yahoo IM :- ashokvpp