BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] Recovering a corrupted usb hard drive with XFS
- Subject: [Discuss] Recovering a corrupted usb hard drive with XFS
- From: worley at alum.mit.edu (Dale R. Worley)
- Date: Fri, 17 May 2024 22:48:33 -0400
- In-reply-to: <mailman.1226.1715816083.30041.discuss@driftwood.blu.org> (discuss-request@driftwood.blu.org)
> From: "Dale R. Worley" <worley at alum.mit.edu> > In principal, it can be done by: (1) using the right utility to shrink > the filesystem enough to leave space for the GPT, (2) copying the > filesystem "further" into the disk by that amount (which mostly has to > be done *in reverse* to not lose data, so it can't be done directly by > dd), (3) creating the GPT, (4) inserting a partition entry that > describes the existing filesystem. The ideal way to accomplish (2) would be for "dd" to have an "in reverse" option, but it doesn't seem to. OTOH, assuming that your filesystem is an exact multiple of 1 MiB in length, it's simple enough to write a loop that copies 1 MiB at a time in reverse, and then test it on some sample files. Unfortunately for (1) there seems to be no way to shrink an XFS filesystem, so if you haven't accidentally got at least 1 MiB or so free after the filesystem, there's little that you can do. See e.g. https://web.archive.org/web/20090105174540/http://www.xfs.org/index.php/XFS_FAQ#Q:_Is_there_a_way_to_make_a_XFS_filesystem_larger_or_smaller.3F I did run into something called "convertfs" which supposedly changes a filesystem of one format into a filesystem of another format *in place*. If so, you could convert the filesystem to e.g. ext4, shrink it, then convert it back to XFS. I'm sure it's deep magic, the only question is whether it actually works. At the very least, I'm sure it requires a lot of free space in the filesystem. https://web.archive.org/web/20160101214233/http://oss.sgi.com/archives/xfs/2002-01/msg02379.html https://web.archive.org/web/20240507233349/https://tzukanov.narod.ru/convertfs https://directory.fsf.org/wiki/ConvertFS http://tzukanov.narod.ru/convertfs/convertfs-13jan2005.tar.gz Dale
- Follow-Ups:
- [Discuss] Recovering a corrupted usb hard drive with XFS
- From: richard.pieri at gmail.com (Rich Pieri)
- [Discuss] Recovering a corrupted usb hard drive with XFS
- Prev by Date: [Discuss] Debian 11 -> 12
- Next by Date: [Discuss] Debian 11 -> 12
- Previous by thread: [Discuss] Recovering a corrupted usb hard drive with XFS
- Next by thread: [Discuss] Recovering a corrupted usb hard drive with XFS
- Index(es):