# Xfs partition shot after resize

## Raniz

I just removed and recreated my root partition with fdisk and now XFS says it's got a bad magic number :s

The output from before the resize was something like this:

```
Disk /dev/sda: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xdec3533c

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1         638     5120000   1c  Hidden W95 FAT32 (LBA)

Partition 1 does not end on cylinder boundary.

/dev/sda2   *         638        4285    29297124    7  HPFS/NTFS

/dev/sda3            4285       19458 

Partition 3 does not end on cylinder boundary.

/dev/sda5            4285        4348

/dev/sda6            4348       15810

/dev/sda7           15810       19458
```

And after resizing:

```
Disk /dev/sda: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xdec3533c

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1         638     5120000   1c  Hidden W95 FAT32 (LBA)

Partition 1 does not end on cylinder boundary.

/dev/sda2   *         638        4285    29297124    7  HPFS/NTFS

/dev/sda3            4285       19458 

Partition 3 does not end on cylinder boundary.

/dev/sda5            4285        4348

/dev/sda6            4348       19458
```

This, however didn't work, when I try to mount my partition I get this:

```
XFS: bad magic number

XFS: SB validate failed

mount: wrong fs type, bad option, bad superblock on /dev/sda6,

       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try

       dmesg | tail or so
```

the output from dmesg | tail contains the first two rows above and nothing else related to this.

Because the extended partition ended after the end of the disk I've tried changing the partitions a bit and now it looks like this: (I can't recreate the original partition scheme);

```
Disk /dev/sda: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xdec3533c

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1         638     5120000   1c  Hidden W95 FAT32 (LBA)

Partition 1 does not end on cylinder boundary.

/dev/sda2   *         638        4285    29297124    7  HPFS/NTFS

/dev/sda3            4285       19457

/dev/sda5            4285        4347

/dev/sda6            4348       19457
```

This hasn't changed anything though, I still can't mount the partition.

I'm in the process of running xfs_repair -n and it's currently searching for a second superblock.

Any other tips and ideas for how to fix this? I really don't want to loose that drive... I've got my homedir on it and I'm not very good at taking backups (I guess I'll start now  :Smile: )

----------

## Raniz

xfs_repair just finished and it couldn't find any valid secondary superblocks, it found a few but failed to verify them...

I'm starting to think the partition table on this computer was weird when I started changing it... Any ideas would be appreciated.

----------

## Jaglover

app-admin/testdisk

How did you resize your filesystems after repartioning?

----------

## Raniz

I couldn't resize it since xfs_growfs can't find an XFS filesystem there.

I'll see if I can find something with testdisk, I'll need to get hold of a disc that contains it first though, all I've got right now is the minimal install CD on a USB-stick..

----------

## Raniz

This is what a deep search with testdisk resulted in:

```
     FAT32 LBA                0   1  1  7782 254 47  125033816  [FD_BETA9SR2]

     FAT32, 64 GB / 59 GiB

     FAT32                    0  32  1   637 137 12   10240000 [RECOVERY]

     FAT32, 5242 MB / 5000 MiB

     Linux                  637 137 13  4284 219 39   58594248

     XFS 6.2+ - bitmap version, 30 GB / 27 GiB
```

Sadly, nothing about my root partition...

Any more ideas?

----------

## Raniz

I'm starting to think that my partitions weren't on cylinder boundaries before I started resizing.. Is there any way to search all data on the entire disk for an XFS partition and recover it?

I don't care about any of the other partitions, I only need the XFS partition that was sda6...

Edit:

I found this on the testdisk wiki:

 *Quote:*   

> TestDisk 6.7 now handles partitions created under Microsoft Vista. Traditionally partitions were created on cylinder boundaries. Under Vista, they are now independent of the disk geometry: These new partitions are aligned to a 1 MB boundary, and TestDisk can now handle that as well as the old cylinder boundaries. We have also changed the advanced menu items in light of these new Vista partitions. 

 

The laptop came with Vista preinstalled and I don't remember how I formatted the disk when I installed Linux on it... Could it be that it was partitioned in a weird way because of Vista?

I found an option in testdisk that said something about aligned cylinders/heads and I disabled that, I'm running a new search atm...

----------

## Raniz

Nope, that didn't change anything... though it took longer to complete.

Any idea for how I can locate the beginning of my partition and restore it? If I can only access that partition I can back everything up and the create a sane partition table from scratch...

----------

