# mount ext4 & ntfs in virtualbox



## islamux (Jul 15, 2017)

Hi
I'm new to FreeBSD, I've been using Linux for 10 years and I want really to install FreeBSD in my harddisk but before that I want to practice enough in FreeBSD and read a lot in FreeBSD until that installed FreeBSD in virtualbox. And all things done well. All the problem I faced search in FreeBSD forum and handbook and solved it but one problem I can't find any thing about it.

I want to mount partitions of ext4 & NTFS in virualbox how to do that

I search a lot I didn't find any thing useful please help

I'm new in FreeBSD, I've been using Linux for 10 years

this in my virtualbox i want mount my realy partions

```
islamux@FreeBSD:~ % gpart show

=>      63  41942977  ada0  MBR  (20G)

        63         1        - free -  (512B)

        64      4032     3  freebsd  (2.0M)

      4096  36825088     1  freebsd  [active]  (18G)

  36829184   5113856     2  ebr  (2.4G)


=>       0  36825088  ada0s1  BSD  (18G)

         0  35651584       1  freebsd-ufs  (17G)

  35651584   1173503       2  freebsd-swap  (573M)

  36825087         1          - free -  (512B)



=>      0  5113856  ada0s2  EBR  (2.4G)

        0  3244032       1  linux-data  (1.5G)

  3244032  1869824   51493  ntfs  (912M)



=>   0  4032  ada0s3  BSD  (2.0M)

     0  4032          - free -  (2.0M)
```


```
islamux@FreeBSD:~ % sudo fdisk
******* Working on device /dev/ada0 *******
parameters extracted from in-core disklabel are:
cylinders=41610 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=41610 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 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 4096, size 36825088 (17981 Meg), flag 80 (active)
   beg: cyl 4/ head 1/ sector 2;
   end: cyl 1023/ head 255/ sector 63
The data for partition 2 is:
sysid 5 (0x05),(Extended DOS)
    start 36829184, size 5113856 (2497 Meg), flag 0
   beg: cyl 1023/ head 254/ sector 63;
   end: cyl 1023/ head 254/ sector 63
The data for partition 3 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 64, size 4032 (1 Meg), flag 0
   beg: cyl 0/ head 1/ sector 2;
   end: cyl 4/ head 1/ sector 1
The data for partition 4 is:
<UNUSED>
```


----------



## scottro (Jul 15, 2017)

You can mount (might be read only, I"m not sure) ext4 partitions by installing fuse-ext4fuse.


```
pkg install fuse-ext4fuse
kldload fuse
ext4fuse /dev/ada0s2 /mnt
```

Assuming the LInux partition is ada0s2 (the 2nd partition of the first disk.  FreeBSD uses slices in a similar manner to the way Linux uses partitions)


----------



## islamux (Jul 15, 2017)

thanx @*scottro*
`pkg install fuse-ext4fuse
kldload fuse`
i did it and 
`[SIZE=4]pkg install virtualbox-ose-additions-5.1.22_[/SIZE]`
`[SIZE=4] pkg install fusefs-ntfs[/SIZE]`
`vi /boot/loader.conf`
`fuse_load="YES"`
this my rc.conf

```
dbus_enable="YES"
hald_enable="YES"
vboxguest_enable="YES"
vboxservice_enable="YES"
vboxservice_flags="--disable-timesync"
fusefs_enable="YES"
```
this my loader.conf

```
hw.psm.synaptics_support="1"
fuse_load="YES"
```


by the way
`/dev/ada0s2`
it's not a real partition i made it in virtualbox for testing only 
this is my dev in *FreeBSD*

```
islamux@FreeBSD:~ % ls /dev/
acpi       bpsm0       kbd0       pci       ttyv6
ada0       console       kbd1       psm0       ttyv7
ada0s1       consolectl   kbdmux0       pts       ttyv8
ada0s1a       ctty       klog       random       ttyv9
ada0s1b       devctl       kmem       reroot       ttyva
ada0s2       devctl2       led       sndstat       ttyvb
ada0s3       devstat       log       stderr       ufssuspend
ada0s5       dsp0.0       mdctl       stdin       ugen0.1
ada0s6       dumpdev       mem       stdout       ugen1.1
apm       ext2fs       midistat   sysmouse   urandom
apmctl       fd       mixer0       ttyv0       usb
atkbd0       fido       netmap       ttyv1       usbctl
audit       full       nfslock       ttyv2       vboxguest
auditpipe   fuse       ntfs       ttyv3       xpt0
bpf       geom.ctl   null       ttyv4       zero
bpf0       io       pass0       ttyv5
```

and this my fstab in *FreeBSD*


```
islamux@FreeBSD:~ % vi /etc/fstab

# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/ada0s1a    /               ufs     rw      1       1
/dev/ada0s1b    none            swap    sw      0       0
# IslamBSD for kde to mount file system automatically.
proc            /proc           procfs  rw      0       0
#edited by islamBSD adding bash
fdesc          /dev/fd          fdescfs rw      0       0
```



my real partitions dosen't apper in freebsd.
*i can't see any partition of my real hd *
they appears like that in *arch*

```
[islamux@arch ~]$ sudo fdisk -l
[sudo] password for islamux:
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x9ca463a2

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1            4096  61431807  61427712 29.3G 83 Linux
/dev/sda2        61432560 122881184  61448625 29.3G 83 Linux
/dev/sda3       190466701 976768064 786301364  375G  f W95 Ext'd (LBA)
/dev/sda4  *    122882048 190466047  67584000 32.2G 83 Linux
/dev/sda5       190466703 245770894  55304192 26.4G 83 Linux
/dev/sda6       251915328 480600539 228685212  109G  7 HPFS/NTFS/exFAT
/dev/sda7       480600603 641234474 160633872 76.6G  7 HPFS/NTFS/exFAT
/dev/sda8       641234538 976768064 335533527  160G  7 HPFS/NTFS/exFAT
/dev/sda9       245772288 251914239   6141952    3G 82 Linux swap / Solaris

Partition 3 does not start on physical sector boundary.
Partition 5 does not start on physical sector boundary.
Partition 7 does not start on physical sector boundary.
Partition 8 does not start on physical sector boundary.
Partition table entries are not in disk order.
```


----------



## Jov (Jul 16, 2017)

You did not add your real partiton to vbox?
If you want to mount the real partiton in FreeBSD, you should add the partition to vbox as a disk first, then you will see the disk in /dev on FreeBSD. After that, you can mount the disk from FreeBSD using fuse.


----------



## islamux (Jul 16, 2017)

Jov said:


> You did not add your real partiton to vbox?
> 
> If you want to mount the real partiton in FreeBSD, you should add the partition to vbox as a disk first, then you will see the disk in /dev on FreeBSD. After that, you can mount the disk from FreeBSD using fuse.


thanx Jov 
i shared folders in virtualbox and made them auto-mount & make permanent


----------



## SirDice (Jul 19, 2017)

The FreeBSD VirtualBox guest additions do not support shared folders. There were some people working on this but I have no idea what the status is.


----------

