Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Fishstick
Jul 9, 2005

Does not require preheating
I need some help trying to mount a UFS disk in linux. The disk is sata and was in a freebsd (5.x) system in a raid 1. It's attached to the linux machine currently with a usb -> sata cable.

I'm using a 2.6.9.x linux kernel (centosplus), with ufs compiled as a module. So far so good, but none of the ufs types are recognized:
code:
# mount /dev/sdc /mnt/bsd/ -r -t ufs -o ufstype=5xbsd
mount: wrong fs type, bad option, bad superblock on /dev/sdc,
ufs_read_super: bad magic number
The 44bsd or ufs2 ufstypes don't seem to work either, even though I'm sure they should.

code:
(parted) select /dev/sdc
Using /dev/sdc
(parted) check 1                                                          
Error: Unable to open /dev/sdc - unrecognised disk label.
(parted) print all                                                        
Error: Unable to open /dev/sdc - unrecognised disk label.  
Checking out dmesg shows that sdc should be said disk:
code:
SCSI device sdc: 625142448 512-byte hdwr sectors (320073 MB)
sdc: Write Protect is off
sdc: Mode Sense: 00 38 00 00
sdc: assuming drive cache: write through
SCSI device sdc: 625142448 512-byte hdwr sectors (320073 MB)
sdc: Write Protect is off
sdc: Mode Sense: 00 38 00 00
sdc: assuming drive cache: write through
 sdc: unknown partition table
sd 2:0:0:0: Attached scsi disk sdc
sd 2:0:0:0: Attached scsi generic sg2 type 0

--
# cat /proc/scsi/usb-storage/2 
   Host scsi2: usb-storage
       Vendor: JMicron
      Product: USB to ATA/ATAPI Bridge
Serial Number: D57CA0D48104
     Protocol: Transparent SCSI
    Transport: Bulk


-- 
# cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST3250310AS      Rev: 3.AA
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: ATA      Model: ST3250310AS      Rev: 3.AA
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: WDC WD32 Model: 00YS-01PGB0      Rev: 0M21
  Type:   Direct-Access                    ANSI SCSI revision: 02
BSD disk labels are also compiled into the kernel, so I'm out of ideas. Im able to dd copy the disk, but i'd like to be able to mount it without having to attach it to a bsd machine.
Entertaining suggestions!

Fishstick fucked around with this message at 11:07 on Apr 24, 2008

Adbot
ADBOT LOVES YOU

Fishstick
Jul 9, 2005

Does not require preheating

H110Hawk posted:

Are you sure the UFS and BSD partition modules are loaded? Is the raid1 completely transparent? Can you make a raid1 of a linux disk, then split it off onto this machine and use that?

I'm going to suggest you upgrade your kernel to something recent. 2.6.9 is pretty old. http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.tar.bz2 Give that a whirl and report back.

Unfortunate typo on my part on the kernel version, it's actually a 2.6.18-53.1.14.el5.centos.plus.

The UFS and bsd_label modules are active, before activating them mount will just spit out "unknown filesystem option" if you try to use ufs, now it lists the ufstypes option as well. Modprobe doesn't error either.

I'm not clear on what you mean by this though:

quote:

Can you make a raid1 of a linux disk, then split it off onto this machine and use that?
What exactly would that achieve? The machine this disk belongs to was BSD and needs to be BSD, I just need to be able to retrieve the data some way. I'm actually already setting up a VM bsd just to mount this goddamn thing.

Fishstick
Jul 9, 2005

Does not require preheating
It's the same hardware/setup we use on other machines, just bsd.

It's a 3ware hardware raid, and on our linux machines I've always been able to just remove a drive from the array, replace it with a fresh one, and pull data off of the removed drive just by mounting it as ext2/3. Unless i'm once again misunderstanding what you mean.

Fishstick
Jul 9, 2005

Does not require preheating
Yeah, but machine wasn't recognizing any of the slices, so that was my desperate attempt :smith:.

In the meantime i've been able to get the BSD box running again using a 4month old disk that was taken out of the raid 1 at some point (these guys had an awesome backup scheme!), and booting from there. I've hooked the data disc (with the recent data) on a sata port outside of raid. But it's not looking too good:

code:
# fdisk /dev/ad2
******* Working on device /dev/ad2 *******
parameters extracted from in-core disklabel are:
cylinders=155061 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=155061 heads=16 sectors/track=63 (1008 blks/cyl)

fdisk: invalid fdisk partition table found
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 156301425 (76319 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 436/ head 15/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
After some googling and a lot of loving around (fsck -b is apparently fsck_ffs or fsck_ufs -b on bsd?), I was able to compile scan_ffs and found the partitions.

If I understand correctly, I should be able to retrieve the disklabels through scan_ffs, match it with the disklabels of the older raid-removed disk - that is now the bootdrive - and apply them to the hosed disk, after making a copy with dd. This way I should hopefully be able to recover the slices and mount it.

However, there's a 2block difference in the labels between the bootdisk and the datadisk, could this be due to disk geometry (bootdisk is 160gb with 80gb partition, data disk is 80gb with 80gb partition) or should I correct the label with what I know is correct, versus what scan_ffs has found on it?

code:
#Boot/Old removed disk:
h: 120176370 36119952    4.2BSD     2048 16384 28552
# Disk to be recovered:
X: 120176368 36121039 4.2BSD 2048 16384 0 # /usr
This was pretty interesting as my virgin experience with freebsd!


E: Welp, that worked. Too bad it was for nought since half the goddamn folders were busted in the end anyway. Lessons learned.

Fishstick fucked around with this message at 18:52 on Apr 25, 2008

  • Locked thread