mounting Linux FS

Hi there.
I completed the installation of FreeBSD on my comp.

My computer has 2 HDD. On the first HDD I have Ubuntu and I think but not sure that has ext3 FS.

I created the mount point an try some:
Code:
# fdisk -l
fdisk: illegal option -- l
usage: fdisk [-BIaipstu] [-b bootcode] [-1234] [disk]
       fdisk -f configfile [-itv] [disk]

and
Code:
# # ls /dev/
acd0            cuad0.init      kbdmux0         stdout          ttyvb
acpi            cuad0.lock      klog            sysmouse        ttyvc
ad6             cuad1           kmem            ttyd0           ttyvd
ad6s1           cuad1.init      log             ttyd0.init      ttyve
ad6s2           cuad1.lock      mdctl           ttyd0.lock      ttyvf
ad6s5           dcons           mem             ttyd1           ukbd0
ad8             devctl          net             ttyd1.init      ums0
ad8s1           devstat         net1            ttyd1.lock      urandom
ad8s1a          dgdb            net2            ttyp0           usb
ad8s1b          dumpdev         net3            ttyp1           usb0
ad8s1c          fd              net4            ttyv0           usb1
ad8s1d          fido            network         ttyv1           usb2
ad8s1e          fw0             nfs4            ttyv2           usb3
ad8s1f          fw0.0           nfslock         ttyv3           usb4
ata             fwmem0          null            ttyv4           usb5
atkbd0          fwmem0.0        pci             ttyv5           usb6
audit           geom.ctl        ptyp0           ttyv6           usb7
console         io              ptyp1           ttyv7           xpt0
consolectl      kbd0            random          ttyv8           zero
ctty            kbd1            stderr          ttyv9
cuad0           kbd2            stdin           ttyva

How can I mount the Linux HDD and where is in /dev?
it is ad6, ad6s1, ad6s2, ad6s5?

thanks
 
for view slices and partition type:

fdisk -p /dev/ad6
and then
Code:
mount -o ro -t ext2fs /dev/ad6s1 /mnt
or
mount -o ro -t ext2fs /dev/ad6s2 /mnt
 
Try fdisk ad6 and fdisk ad8. That should show you the ext3 partition. If it's on the first disk it's probably ad6s1.
 
Code:
# fdisk -p /dev/ad6                      
# /dev/ad6                                      
g c969021 h16 s63                               
p 1 0x83 63 953409492                           
a 1                                             
p 2 0x05 953409555 23358510
and
Code:
# fdisk ad6
******* Working on device /dev/ad6 *******
parameters extracted from in-core disklabel are:
cylinders=969021 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=969021 heads=16 sectors/track=63 (1008 blks/cyl)    

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 131 (0x83),(Linux native)                    
    start 63, size 953409492 (465531 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
sysid 5 (0x05),(Extended DOS)
    start 953409555, size 23358510 (11405 Meg), flag 0
        beg: cyl 1023/ head 254/ sector 63;
        end: cyl 1023/ head 254/ sector 63
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

I suppose that the disk ad6 has 2 partitions, one is ext2fs and the other is swap
So I suppose
ad6s1 is the root / partition with ext2fs
ad6s2 is the swap partition
ad6s5 .... I don't know
 
well I tried:
Code:
# mount -o ro -t ext2fs /dev/ad6s1 /disc01/
# ls /disc01
ls: /disc01: Bad file descriptor
# mount -o ro -t ext2fs /dev/ad6s2 /disc01/
mount: /disc01: Bad file descriptor

where is the problem?
 
You need to apply this patch to your kernel sources and rebuild at least the ext2fs kernel module:

http://pastebin.ca/raw/1280738

The ext2fs kernel module currently available in -STABLE (and maybe -CURRENT) does not support inode sizes higher than 128, and many distributions now use 256.

Adam
 
well after this I could not read the /disc01 directory (I created for mount point) so I restarted the system. A lot of numbers appear on the screen and finally "Giving up on 27 buffers". What does it means?
 
adamk said:
You need to apply this patch to your kernel sources and rebuild at least the ext2fs kernel module:

http://pastebin.ca/raw/1280738

The ext2fs kernel module currently available in -STABLE (and maybe -CURRENT) does not support inode sizes higher than 128, and many distributions now use 256.

Adam

Is there a PR that references this patch?
 
Yes there is brd@ you can find it in here:

http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/124621

Here you can find the patch that I used:

http://pflog.net/~floyd/ext2fs.diff

More on this topic:

mounting linux partitions
Fri May 9 18:05:26 UTC 2008
http://lists.freebsd.org/pipermail/freebsd-questions/2008-May/174588.html

bad file descriptor when mounting an ext2fs.
Tue Jun 10 11:08:46 UTC 2008
http://lists.freebsd.org/pipermail/freebsd-questions/2008-June/176506.html

mounting ext2fs partitions on FBSD7 ( third time a charm?)
Fri Jul 4 23:33:53 UTC 2008
http://lists.freebsd.org/pipermail/freebsd-questions/2008-July/178219.html

256-byte inode support
Sat Sep 6 23:46:33 UTC 2008
http://lists.freebsd.org/pipermail/freebsd-hackers/2008-September/025912.html

ext2 inode size patch - RE: PR kern/124621
Mon Nov 24 11:29:59 PST 2008
http://lists.freebsd.org/pipermail/freebsd-stable/2008-November/046758.html

ext2 inode size patch - RE: PR kern/124621
Wed Dec 3 14:53:46 PST 2008
http://lists.freebsd.org/pipermail/freebsd-stable/2008-December/046916.html

I´ve had a conversation with Josh (email) and he kindly explained me how to apply the patch and test it. So far, so _good_ to me ... not a single problem on daily usage.

Hope you find that info usefull :)

Regards
 
Reading the above links I don't understand if it's possible or not to mount Linux volumes.

All my information are in Linux volume and I don't know how to transfer them in FreeBSD.

I tried to mount the FreeBSD volume in Linux but no chance ... :(
 
You can mount ext2/3fs as long as they have an "Inode size" equal to 128.

Otherwise (if "Inode size" equals 256), you won't be able to mount those ext2/3 partitions unless you apply Josh's patch. Or to be more spesific ... you will be able to mount them but you won't be able to acces the data on them .. and you'll get a "Bad file descriptor" every time you try to acces said mounted partition.

In order to find out whether your ext2/3 partitions have a 128 or a 256 "Inode size", issue the following command as root:

Code:
root@inferna:~ # tune2fs -l /dev/ad4s6 | grep "Inode size"
Inode size:               256

of course .. you will have to change "/dev/ad4s6" to the correct ext2/3 linux partition in your drive ...

At leas that was my experience ..

Hope that helps :)
 
gnemmi said:
In order to find out whether your ext2/3 partitions have a 128 or a 256 "Inode size", issue the following command as root:

Code:
root@inferna:~ # tune2fs -l /dev/ad4s6 | grep "Inode size"
Inode size:               256

well I tried
Code:
# tune2fs -l /dev/ad6s1 | grep "Inode size"
tune2fs: Command not found.
# whatis tune2fs
tune2fs: nothing appropriate
maybe I have to install something?
 
Code:
[gonzalo@inferna ~]% which tune2fs
/usr/local/sbin/tune2fs
[gonzalo@inferna ~]% pkg_info -W /usr/local/sbin/tune2fs
/usr/local/sbin/tune2fs was installed by package e2fsprogs-1.41.3
[gonzalo@inferna ~]% pkg_info -xqo e2fsprogs
sysutils/e2fsprogs
[gonzalo@inferna ~]%

Hope it helps :)
 
gnemmi said:
Hope it helps :)

yes, it helps but unfortunately in my case:
Code:
 tune2fs -l /dev/ad6s1 | grep "Inode size"                              Inode size:               256

at this time as my system works I'm afraid to apply Josh's patch. I never apply a patch to my kernel sources and rebuild ... it's complicated?
 
It's not too hard, really.
If you
Code:
# cd /usr/src/sys/gnu/fs
# patch < ~djn/ext2fs.diff  (change to where you stored the patch, obviously)
# cd /usr/src/sys/modules/ext2fs
# make install clean
This will compile and install the patched version of the ext2fs module. If it's already loaded you need to kldunload ext2fs; kldload ext2fs, otherwise you should just be able to kldload it and try.

If you have ext2fs compiled into the kernel (options EXT2FS) you would need to cd /usr/src ; make buildkernel installkernel to compile a new kernel. I doubt you have, though - it's not the default.
 
I don't have nothing in /usr/src
Code:
# ls -al /usr/src/
total 4
drwxr-xr-x   2 root  wheel  512 Feb 24  2008 .
drwxr-xr-x  17 root  wheel  512 Dec  9 10:02 ..

do I need something to install? the kernel sources or something like that?
 
You need to install the sources first ..
You can do so using "sysinstall" ...

Code:
root@inferna:~ # sysinstall

Then go to "Configure" -> "Distributions", select (at least) "base" and "kernels" or go for "All" if you want to .. then hit "OK" and that should pretty much do it :)

You should check the Handbook first though ... it's been a while since I don't use "sysinstall" so I might be wrong :s
 
Djn said:
This will compile and install the patched version of the ext2fs module. If it's already loaded you need to kldunload ext2fs; kldload ext2fs, otherwise you should just be able to kldload it and try.

If you have ext2fs compiled into the kernel (options EXT2FS) you would need to cd /usr/src ; make buildkernel installkernel to compile a new kernel. I doubt you have, though - it's not the default.
I installed kernel sources and I downloaded ext2fs.diff and then:

Code:
# cd /usr/src/sys/gnu/fs/
# patch < ~/ext2fs.diff
Hmm...  Looks like a unified diff to me...     
The text leading up to this was:
--------------------------
|diff -ud ext2fs.orig/ext2_fs.h ext2fs/ext2_fs.h
|--- ext2fs.orig/ext2_fs.h      2005-06-16 06:51:38.000000000 +0000
|+++ ext2fs/ext2_fs.h   2008-09-03 14:10:27.000000000 +0000
--------------------------
Patching file ext2fs/ext2_fs.h using Plan A...
Hunk #1 succeeded at 150.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -ud ext2fs.orig/ext2_inode.c ext2fs/ext2_inode.c
|--- ext2fs.orig/ext2_inode.c   2006-09-26 04:15:58.000000000 +0000
|+++ ext2fs/ext2_inode.c        2008-09-03 13:54:49.000000000 +0000
--------------------------
Patching file ext2fs/ext2_inode.c using Plan A...
Hunk #1 succeeded at 91.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -ud ext2fs.orig/ext2_vfsops.c ext2fs/ext2_vfsops.c
|--- ext2fs.orig/ext2_vfsops.c  2008-04-03 18:51:13.000000000 +0000
|+++ ext2fs/ext2_vfsops.c       2008-09-03 13:55:37.000000000 +0000
--------------------------
Patching file ext2fs/ext2_vfsops.c using Plan A...
Hunk #1 succeeded at 424.
Hunk #2 succeeded at 578.
Hunk #3 succeeded at 1013.
done
# cd /usr/src/sys/modules/ext2fs/
# make install clean
install -o root -g wheel -m 555   ext2fs.ko /boot/kernel
install: ext2fs.ko: No such file or directory
*** Error code 71

something is missing? what went wrong?
 
I didn't understand the command so I paste it like this:
Code:
# /usr/src/sys/modules/ext2fs # make clean && make
/usr/src/sys/modules/ext2fs: Permission denied.
 
are you doing this as root?
could you please do a "ls -a" inside that directory and paste the output in here?
 
hirohitosan, you should exec this this as root:
Code:
# cd /usr/src/sys/modules/ext2fs
# make depend
# make obj
# make
# make install
# make unload
# make load

That way you build all dependencies for the module, build the module itself, install it, unload the current loaded module and load the new one.
 
lme@ said:
hirohitosan, you should exec this this as root:
Code:
# cd /usr/src/sys/modules/ext2fs
# make depend
# make obj
# make
# make install
# make unload
# make load

That way you build all dependencies for the module, build the module itself, install it, unload the current loaded module and load the new one.

Thanks everything went well. Just
Code:
# make unload
/sbin/kldunload -v ext2fs.ko
kldunload: can't find file ext2fs.ko
*** Error code 1

Stop in /usr/src/sys/modules/ext2fs.
# make load
/sbin/kldload -v /usr/obj/usr/src/sys/modules/ext2fs/ext2fs.ko
Loaded /usr/obj/usr/src/sys/modules/ext2fs/ext2fs.ko, id=4

but I suppose that ext2fs was not loaded ....
 
Back
Top