DD SGI XFS drive from Linux?

ReVolt

New member
Feb 8, 2023
5
1
3
I've never dealt with an SGI or XFS before but wanted to backup an o2 drive before tinkering with it. I installed Linux (Mint 21) on an old desktop then slapped an Adaptec AHA-2940UW SCSI card in (latest firmware) and attached the o2 drive. The SCSI drive appeared as /dev/sdb and shows partitions but they weren't accessible and if memory serves I don't think it listed their type (as if unrecognized). I proceeded with a simple dd which completed with no errors. I put the drive back into the o2 and it booted fine. Unfortunately A few minutes later the power supply popped and the o2 is dead, for now.

sudo dd bs=4M /if=/dev/sdb /of=o2.img /status=progress

I've been playing with this disk image but any mount attempts result in the ever so common error...

wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error

sfdisk does at least list information about partitions in the image...

sfdisk -l o2.img

Disk o2.img: 8.48 GiB, 9104138240 bytes, 17781520 sectors
Geometry: 255 heads, 63 sectors/track, 1106 cylinders
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: sgi

Device Start End Sectors Size Id Type Attrs

o2.img1 266240 17781519 17515280 8.4G a SGI xfs boot
o2.img2 4096 266239 262144 128M 3 SGI raw swap
o2.img9 0 4095 4096 2M 0 SGI volhdr
o2.img11 0 17781519 17781520 8.5G 6 SGI volume
Next I tried...

sudo losetup -f --show -P o2.img

lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 8.5G 0 loop
├─loop0p1 259:6 0 8.4G 0 part
├─loop0p2 259:7 0 128M 0 part
├─loop0p9 259:8 0 2M 0 part
└─loop0p11 259:9 0 8.5G 0 part
Okay, so now at least the image partitions are attached as block devices.

sudo mount -t xfs -o nouuid /dev/loop0p1 /mnt

mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop0p1, missing codepage or helper program, or other error.
Bummer, so I did some searching online and tried xfs_repair, but I threw in -n for no changes since I just want to see if it balks. I tried this on all four partitions, same result.

sudo xfs_repair -v -n /dev/loop0p1

Phase 1 - find and verify superblock...
bad primary superblock - bad magic number !!!
attempting to find secondary superblock...
..Sorry, could not find valid secondary superblock
Exiting now.
I would like to know if dd imaging the entire drive was appropriate or not and I would like to learn more about accessing SGI drives (and images of drives). Are certain Linux distros preferable for accessing XFS? Some recovery software I have, R-studio, doesn't support XFS but did a raw file scan of the image and turned up lots of things so I know the data is there. Even though the o2 is currently down I can of course use other methods to re-image the drive in the event it should be done differently. Some guidance would be appreciated. Thank you.
 

Elf

Storybook / Retired, ex-staff
Feb 4, 2019
792
252
63
Mountain West (US)
Ah, hard drives used by IRIX it starts with a volume header (sometimes known as a disklabel), which is something like a partition table in the PC world. The volume header (as you are seeing from sfdisk) contains the offsets to the different slices, which have the filesystems on the disk (or other usages like swap).

When you initially tried to mount the entire image it tried to treat the beginning of the image as an XFS partition, when it actually starts with the volume header (and not anything XFS), which is why you saw the message about the bad superblock.

I think you are on the right track with using losetup to create separate loopback devices based on the slices at different points in the image. However it's possible that your offsets are wrong, or you aren't mounting the right slice?

I am not very familiar with using loopback devices under Linux since it has been well over a decade since I last had to bother. But, I would try to investigate where the partition you want actually starts, and make sure that the loopback device you are using actually starts at that offset into the image as well.

If you end up questioning the output of sfdisk, the structure of the SGI volume header can be found in dvh.h (attached).
 

Attachments

Ginzanix

Active member
Aug 28, 2019
60
122
33
I have this noted from somewhere:

"The biggie is that Linux supports XFSv2 ONLY so drives built with IRIX 6.2 or an early version of 6.5 (or 6.3, or 6.4, or 5.3XFS) will not be readable.

Your Linux kernel also has to be configured with (a) XFS support and (b) SGI disklabel support.

It does work, though- I've done it.
..
BTW older versions xfs did have limited support for v1 directories. It didn't work in all cases (nfs was a big problem) but it should would well enough to get your data off. I would grab an older kernel off the oss ftp site. "
IRIX 6.5.5 added support for XFS v2 folders, however this had to be specified manually when installing, and v2 folders was only made default in the installation script when installing IRIX 6.5.14 and later.

So you could have problems if you have a pre IRIX 6.5.14 installation.
 
  • Like
Reactions: Elf

Guest

New member
Jan 12, 2023
1
0
1
Your Linux kernel also has to be configured with (a) XFS support and (b) SGI disklabel support.
FWIW you can confirm if you have partition/disklabel support via zgrep -i sgi_partition /proc/config.gz if you have config.gz enabled (pretty common). Should be set to CONFIG_SGI_PARTITION=y if it's enabled. And of course, you should also see
Code:
CONFIG_XFS_FS=y
 

ReVolt

New member
Feb 8, 2023
5
1
3
I think it's 6.5.12. I tried to find out the file system version and it looks like XFSv1 so I'm at a dead end. Thanks for the info.

#sudo xfs_db -r /dev/loop0p11 -F

xfs_db: /dev/loop0p11 is not a valid XFS filesystem (unexpected SB magic number 0x0be5a941)
xfs_db: size check failed
xfs_db: V1 inodes unsupported. Please try an older xfsprogs.
 

weblacky

Active member
Jan 13, 2020
181
45
28
Seattle, WA
I researched this a few years ago, XFS v1 & v2 support was removed from Linux after ~2017, answer, install a Linux distribution that’s older! Find an early 2017 or 2016 distribution and you’ll be able to read the file system.
Just install a VM and introduce the image that way. I’ve done this now a few times. Yes, I agree removing support is stupid however SGI intended to use XFS v4 with their Linux distributions before going out of business.

I just used an old Debian Linux to do this.
 
  • Like
Reactions: Elf

ghost180sx

Active member
Dec 13, 2019
144
55
28
The Great White North
No need to install an older distro. I'm using Mint 21 and have this working with exactly the same Adaptec SCSI adapter.
> I used ddrescue to image my drives, in case there were bad sectors. Just a tip.
> if you haven't already, sudo apt install xfsutils xfsdump
> I've confirmed on the latest kernel that Mint 21 has CONFIG_SGI_PARTITION=y
 

weblacky

Active member
Jan 13, 2020
181
45
28
Seattle, WA
No need to install an older distro. I'm using Mint 21 and have this working with exactly the same Adaptec SCSI adapter.
> I used ddrescue to image my drives, in case there were bad sectors. Just a tip.
> if you haven't already, sudo apt install xfsutils xfsdump
> I've confirmed on the latest kernel that Mint 21 has CONFIG_SGI_PARTITION=y
Good luck, it won’t read it by loopback mounting with newest XFS program tools package , that was the entire point. XFS v1 & v2 was removed in order to clean up the code back in 2017, because only old SGI workstations use those versions, and Linux never intended too. When XFS came for Linux they were already in v3 with v4 in the works.

That’s why the original post complains of inode errors!

If you want to mount an Irix disk, you have to use obsolete versions of the package. XFS dump might work but not mounting nor altering specific contents. Hence, older distro.

however, the newest Linux package is still support EFS.
 

ghost180sx

Active member
Dec 13, 2019
144
55
28
The Great White North
Good luck, it won’t read it by loopback mounting with newest XFS program tools package , that was the entire point. XFS v1 & v2 was removed in order to clean up the code back in 2017, because only old SGI workstations use those versions, and Linux never intended too. When XFS came for Linux they were already in v3 with v4 in the works.

That’s why the original post complains of inode errors!

If you want to mount an Irix disk, you have to use obsolete versions of the package. XFS dump might work but not mounting nor altering specific contents. Hence, older distro.

however, the newest Linux package is still support EFS.
Interesting. Thanks.
 

About us

  • Silicon Graphics User Group (SGUG) is a community for users, developers, and admirers of Silicon Graphics (SGI) products. We aim to be a friendly hobbyist community for discussing all aspects of SGIs, including use, software development, the IRIX Operating System, and troubleshooting, as well as facilitating hardware exchange.

User Menu