LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to rewrite partition structure without deleting any data? (https://www.linuxquestions.org/questions/debian-26/how-to-rewrite-partition-structure-without-deleting-any-data-748986/)

mrcharles 08-20-2009 06:25 AM

How to rewrite partition structure without deleting any data?
 
Hi,

Sorry, but I'm pretty new to linux, and I'm facing a problem with an ext3 partition on an external hdd. I'm not sure whether the hdd is about to crash or not, however I've had a few problems accessing it in the past.

This is what I get when trying to mount it:

[ 9090.405125] scsi 3:0:0:0: Direct-Access WD 3200BEV External 1.04 PQ: 0 ANSI: 4
[ 9090.452048] sd 3:0:0:0: [sdb] 625142448 512-byte hardware sectors (320073 MB)
[ 9090.453332] sd 3:0:0:0: [sdb] Write Protect is off
[ 9090.453337] sd 3:0:0:0: [sdb] Mode Sense: 21 00 00 00
[ 9090.453340] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[ 9090.468218] sd 3:0:0:0: [sdb] 625142448 512-byte hardware sectors (320073 MB)
[ 9090.469325] sd 3:0:0:0: [sdb] Write Protect is off
[ 9090.469330] sd 3:0:0:0: [sdb] Mode Sense: 21 00 00 00
[ 9090.469333] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[ 9090.469760] sdb: sdb1 sdb2 < sdb5 sdb6 >
[ 9090.549390] sd 3:0:0:0: [sdb] Attached SCSI disk
[ 9090.551253] sd 3:0:0:0: Attached scsi generic sg2 type 0
[ 9092.691588] EXT3-fs error (device sdb6): ext3_check_descriptors: Block bitmap for group 128 not in group (block 0)!
[ 9092.701717] EXT3-fs: group descriptors corrupted!
[ 9093.414353] EXT3-fs error (device sdb6): ext3_check_descriptors: Block bitmap for group 128 not in group (block 0)!
[ 9093.414366] EXT3-fs: group descriptors corrupted!

I have a second external hdd, the exact same drive, that has the exact same partition configuration, but holds different data. So, my question is; is it possible to backup the partition structure of the second working drive, and using this information to rewrite the partition structure of the failing hdd without damaging the data stored on that drive?

Any ideas?

Cheers,
Charles

pixellany 08-20-2009 07:01 AM

Welcome to LQ!!

First, what command produced all of that output?

Please post the output of "fdisk -l" (ell, not one---run this as root)

Also, what happens if you try to mount one or more of the partitions manually using "mount"? e.g.: Suppose you have a mount point named "/mnt/ext_1". Try running
Code:

mount /dev/sdb1 /mnt/ext_1
cd /mnt/ext_1
ls

With respect to restoring the partition structure, there are at least two aspects:
1. the partition table which is simply a map of the partition locations. This can readily be copied from an identical disk.

2. the "formatting"--i.e. the filesystem structure of each partition. I've never heard of copying this from another drive, but I doubt that it can be done without altering data. It CAN however be repaired with tools like fsck.-----But first, lets find out where the problem is.


If you think the drive is physically failing, and you have really valuable data, then the first thing to consider is cloning the whole drive.

mrcharles 08-27-2009 10:46 AM

Hi Pixellany,

The output was just a part of a dmesg. Fdisk -l gives me the following output:

$ fdisk -l /dev/sdb

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x28f12a69

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 608 4883728+ 83 Linux
/dev/sdb2 609 38913 307684912+ f W95 Ext'd (LBA)
/dev/sdb5 609 730 979933+ 82 Linux swap / Solaris
/dev/sdb6 731 38913 306704916 83 Linux

The partition that gives me trouble is sdb6. Manually mounting this partition gives me the following...

$ sudo mount /dev/sdb6 /mnt/tmp
mount: wrong fs type, bad option, bad superblock on /dev/sdb6,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

Cheers,
Charles


Quote:

Originally Posted by pixellany (Post 3650735)
Welcome to LQ!!

First, what command produced all of that output?

Please post the output of "fdisk -l" (ell, not one---run this as root)

Also, what happens if you try to mount one or more of the partitions manually using "mount"? e.g.: Suppose you have a mount point named "/mnt/ext_1". Try running
Code:

mount /dev/sdb1 /mnt/ext_1
cd /mnt/ext_1
ls

With respect to restoring the partition structure, there are at least two aspects:
1. the partition table which is simply a map of the partition locations. This can readily be copied from an identical disk.

2. the "formatting"--i.e. the filesystem structure of each partition. I've never heard of copying this from another drive, but I doubt that it can be done without altering data. It CAN however be repaired with tools like fsck.-----But first, lets find out where the problem is.


If you think the drive is physically failing, and you have really valuable data, then the first thing to consider is cloning the whole drive.



All times are GMT -5. The time now is 06:00 PM.