You should only share data partitions. Do not share any program partitions.
/home
is fine but avoid bin, dev, etc, usr, var, opt, and pretty much anything other than home.
As for the filesystem, it will have to be something both kernels have drivers for. I'm not sure how good BSD's ext support is, but Linux's UFS support is good enough, which means that you probably want to stick with UFS or MSDOS. The swap partition can be shared as long as both recognize the same partition type for swap (which I believe they do, but I am not certain).
And if you're sharing partitions between operating systems don't do anything like trying to run one in a VM from the other. Operating systems need to have exclusive control over filesystems. Two different running operating systems that thing they both have exclusive control over a partition will lead to corruption real fast.
There are several ways to determine a drives filesystem type. Here's a list of the tools I'm familiar with.
1. blkid
Works whether device is mounted or not.
$ blkid
/dev/sda1: UUID="XXXX" TYPE="ext4"
/dev/sda2: UUID="XXXX" TYPE="LVM2_member"
2. mount
This is only useful once the block device has been mounted.
$ sudo mount | grep /dev/sda1
/dev/sda1 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
3. lsblk
Shows drive topologies, but not the filesystem types on the devices.
$ sudo lsblk -a
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 465.3G 0 part
tune2fs
$ tune2fs -l /dev/sda1 | grep magic
Filesystem magic number: 0xEF53
Shows the magic number associated with the device, you can look these up on this site, Linux Magic Numbers. It's also in a file, often here, /usr/share/magic
. You can locate it using locate /magic
.
dumpe2fs
$ sudo dumpe2fs /dev/sda1 | grep magic
dumpe2fs 1.42.7 (21-Jan-2013)
Filesystem magic number: 0xEF53
Same things apply as in tune2fs
.
/dev/mounts
This is the "file" maintained by the kernel that's used to display devices that have been mounted. NOTE: many of the tools on this list are typically using the contents of this file.
$ sudo cat /proc/mounts | grep /dev/sda1
/dev/sda1 /boot ext4 rw,seclabel,relatime,data=ordered 0 0
file
You can also use the file
command to display info about unmounted filesystems.
$ sudo file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (needs journal recovery) (extents) (huge files)
An alternative syntax (as root):
$ file - </dev/sda1
/dev/stdin: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (needs journal recovery) (extents) (huge files)
Your mounting issue
I'd suspect that the filesystem you're attempting to mount is not what you think it is. Either the entire device was formatted with a filesystem (/dev/sda
), in which case you'd be mounting the entire drive. You can test this hypothesis like this:
$ sudo mount /dev/sda /mnt
Of if you need to explicitly tell what filesystem to use:
$ sudo mount -o ext2 /dev/sda /mnt
NOTE: This is generally not the case that an entire filesystem is laid down on the entire device, /dev/sda
, rather they're partitioned into /dev/sda1
, etc.
Or perhaps the drive has been partitioned. In this case you'd see these partitions with the above command lsblk
, where they'd show up as /dev/sda1
, /dev/sda2
, etc. If that's the case for you then you'll need to mount the partition instead like so:
$ sudo mount /dev/sda1 /mnt
Again pay special attention to the formatting used on the filesystem of the device, you'll occasionally have to specify it literally to mount
.
Since your output from fdisk
shows that you have /dev/sda1
I'd be inclined to think that you have your filesystem on the 1st partition.
Device Boot Start End Blocks Id System
/dev/sda1 63 1953520064 976760001 83 Linux
So mounting it like this should do the trick:
$ sudo mount -o ext2 /dev/sda1 /mnt
/etc/fstab
If the above mounting commands work then you can add this to your /etc/fstab
file.
/dev/sda1 /media/HDD ext2 defaults 0 2
Best Answer
I suspect it's
If I remember correctly, the first BSD partition starts on a 32kB boundary relative to the whole disk. That's 64 sectors of 512B. Relative to the PC partition, the offset of the BSD partition is 63 sectors, because the PC partition starts at an offset of 1 sector relative to the whole disk: the first sector of the disk contains the partition table.
As suggested by rozcietrzewiacz, you can confirm the offset of the BSD partition with
There's a patch for the Linux kernel to support automatic access to partitions of loop devices. Debian applies it in their kernels. If you have this patch, then make sure the
loop
driver has a sufficiently largemax_part
parameter (you may need to dormmod loop; modprobe max_part=63
). Then the BSD partitions will appear as something like/dev/loop0p5
and/dev/loop0p6
.