[Discuss] Recovering a corrupted usb hard drive with XFS

John Abreau abreauj at gmail.com
Thu May 9 11:11:03 EDT 2024


I just checked with "journalctl -xe" after another unsuccessful attempt to
mount the drive, and found a duplicate UUID error.

A quick google search of the error message yielded the solution: I ran
"sudo xfs_admin -U generate /dev/sdf"
and was then able to mount /dev/sdf successfully.

I'm not thrilled about mounting sdf instead of sdf1. Is there any way to
safely reconstruct the partition table based on the info returned by
xfs_info?

On Wed, May 8, 2024 at 8:40 PM John Abreau <abreauj at gmail.com> wrote:

> I have an 18TB external hard drive that recently suffered a loss. When I
> first set it up, I formatted it as a single partition with an xfs
> filesystem.
>
> Yesterday I was trying to figure out how to export it via nfs, and during
> one of my attempts I used "mount --bind" to mount it under /export.
>
> Later, when I was backing out my tests, I found I was unable to unmount
> the drive because it was apparently still in use by a bash process that no
> longer existed. I clicked the "unmount anyway" button, and afterward
> discovered that the partition was missing from the drive. /dev/sdf exists,
> but /dev/sdf1 does not.
>
> When I ran fdisk to examine the drive, it gave the following error:
>
> Welcome to fdisk (util-linux 2.39.4).
>> Changes will remain in memory only, until you decide to write them.
>> Be careful before using the write command.
>
>
>
>> The device contains 'xfs' signature and it will be removed by a write
>> command. See fdisk(8) man page and --wipe option for more details.
>
>
>
>> Device does not contain a recognized partition table.
>> The size of this disk is 16.4 TiB (18000174383104 bytes). DOS partition
>> table format cannot be used on drives for volumes larger than 2199023255040
>> bytes for 512-byte sectors. Use GUID partition table format (GPT).
>
>
> Created a new DOS (MBR) disklabel with disk identifier 0xb9e277e5.
>
>
> I immediately exited fdisk without writing it out.
>
> I tried running "xfs_repair -L /dev/sdf", which appears to
> have successfully repaired the xfs filesystem, but the partition table
> still has no partitions showing, and the disk still won't mount.
>
> "xfs_info /dev/sdf" shows the following:
>
> meta-data=/dev/sdf               isize=512    agcount=17, agsize=268435455
> blks
>          =                       sectsz=4096  attr=2, projid32bit=1
>          =                       crc=1        finobt=1, sparse=1, rmapbt=0
>          =                       reflink=1    bigtime=0 inobtcount=0
> nrext64=0
> data     =                       bsize=4096   blocks=4394573824, imaxpct=5
>          =                       sunit=0      swidth=0 blks
> naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
> log      =internal log           bsize=4096   blocks=521728, version=2
>          =                       sectsz=4096  sunit=1 blks, lazy-count=1
> realtime =none                   extsz=4096   blocks=0, rtextents=0
>
> As far as I can tell, the filesystem itself is in good shape, and I just
> need to fix the partition table. But I don't know how to do that without
> risk of destroying the filesystem. I've had no luck googling a useful
> answer.
>
> How do I fix this?
>
>
>
> --
> John Abreau / Executive Director, Boston Linux & Unix
> Email: abreauj at gmail.com / WWW http://www.abreau.net / PGP-Key-ID
> 0x920063C6
> PGP-Key-Fingerprint A5AD 6BE1 FEFE 8E4F 5C23  C2D0 E885 E17C 9200 63C6
>
>

-- 
John Abreau / Executive Director, Boston Linux & Unix
Email: abreauj at gmail.com / WWW http://www.abreau.net / PGP-Key-ID 0x920063C6
PGP-Key-Fingerprint A5AD 6BE1 FEFE 8E4F 5C23  C2D0 E885 E17C 9200 63C6


More information about the Discuss mailing list