Skip site navigation (1)Skip section navigation (2)
Date:      26 Feb 2003 22:53:37 +0300
From:      "Vladimir B. " Grebenschikov <vova@sw.ru>
To:        fs@freebsd.org
Subject:   GEOM + md: how to repair ufs image ?
Message-ID:  <1046289216.2610.15.camel@vbook.fbsd.ru>

next in thread | raw e-mail | index | archive | help

Hi ppl.

I was a bit surprised but some kind of inconsistensy of 
GEOM + md, so may be I do not understand something, please help.

Story:

I have some bad sectors in my notebook HDD, so fsck reports unability to
write into some disk sectors due to physical errors and fails.
Disk can be mounted in read-olny mode and in read-write mode with -f.
After that find /usr/local panics in 100% cases. Some data unavailable,
but most of data available.

I was triing to do backup, as much as possible.

It think this way:
copy all data from broken partition to work media (ignoring errors)
than repair UFS volume (fsck) and then copy it to fresh volume.

So 
dd if=/dev/ad0s4f of=ad0s4f conv=noerror
it works all night and make me my partition image, then I have tried
following:

# ls -l ad0s4f
-rw-r--r--  1 vova  wheel  8817336320 Feb 25 10:28 ad0s4f
# file ad0s4f
ad0s4f: Unix Fast File system (little-endian), last mounted on
/usr/local, last
written at Mon Feb 24 22:23:34 2003, clean flag 0, number of blocks
8706560, num
ber of data blocks 8439596, number of cylinder groups 194, block size
8192, frag
ment size 1024, minimum percentage of free blocks 8, rotational delay
0ms, disk
rotational speed 60rps, TIME optimization
# mdconfig -a -t vnode -f ad0s4f
md0
# ls -l /dev/md0*
crw-r-----  1 root  operator    4,  30 Feb 26 10:21 /dev/md0
# mount -r /dev/md0 /mnt
WARNING: /usr/local was not properly dismounted
# ls /mnt
Acrobat5
BAD
NOT
OpenOffice.org1.0
Together-6.0
VFS
...
# fsck /dev/md0
fsck: Could not determine filesystem type
# fsck_ufs /dev/md0
** /dev/md0

CANNOT READ BLK: 17391648
CONTINUE? [yn] 

THE FOLLOWING DISK SECTORS COULD NOT BE READ: 17391648, 17391649,
17391650,
17391651,
ioctl (GCINFO): Inappropriate ioctl for device
fsck_ufs: /dev/md0: can't read disk label
# 

So volume mounts well, but I can't repait it with fsck. Why ?

Ok, I have assumed that I should get full slice, not only f partiton
(disklabel and so on).
Ok I have made new volume: ad0s4 - first megabyte was copied from real
disk, and ad0s4f was written according disklabel to offeset
4456448.

I have got: 

# ls -l ad0s4 
-rw-r--r--  1 root  wheel  11099037696 Feb 25 17:59 ad0s4
# file ad0s4 
ad0s4: Unix Fast File system (little-endian), last mounted on
/usr/local, last written at Mon Feb 24 22:23:34 200
3, clean flag 0, number of blocks 8706560, number of data blocks
8439596, number of cylinder groups 194, block si
ze 8192, fragment size 1024, minimum percentage of free blocks 8,
rotational delay 0ms, disk rotational speed 60r
ps, TIME optimization
# mdconfig -a -t vnode -f ad0s4 
md0
# ls /dev/md0*
/dev/md0
# disklabel /dev/md0
disklabel: ioctl DIOCGDINFO: Inappropriate ioctl for device
>> where my disklabel ? where freebsd partitions of md0 device ?
# cat disklabel.saved
# /dev/ad0s4c:
type: ESDI
disk: ad0s4
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 240
sectors/cylinder: 15120
cylinders: 2584
sectors/unit: 39070080
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0 

8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:   262144        0    4.2BSD        0     0     0   # (Cyl.    0 -
17*)
  c: 21869568        0    unused        0     0         # (Cyl.    0 -
1446*)
  e:  4194304   262144    4.2BSD     2048 16384 28512   # (Cyl.   17*-
294*)
  f: 17413120  4456448    4.2BSD        0     0     0   # (Cyl.  294*-
1446*)
>> triing to restore disklabel from original disk
# disklabel -R /dev/md0 disklabel
Warning, partition c doesn't cover the whole unit!
Warning, An incorrect partition c may cause problems for standard system
utilities
disklabel: Inappropriate ioctl for device
#

So ... I have no idea how to repair filesystem in image. Any advises are
welcome.

Thanxs

-- 
Vladimir B. Grebenschikov <vova@sw.ru>
SWsoft Inc.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1046289216.2610.15.camel>