# 2 hard drives with FreeBSD



## bsmith (May 8, 2017)

As I mentioned in another post my laptop that had FreeBSD crashed and I wanted to dual boot with Linux.  The problem was my hardware was too new.  Not wanting to give up on FreeBSD I purchased a used laptop that was on the approved list for compatible computers.  This laptop has a docking station with a 320 gb hd.  The internal hd has windows 10 on it which I have no use for.  I was thinking of using the external drive for a backup but I have a few questions.   What file system would I need and how would I format it?  I've found some scripts for backup that should work but does anyone has something they can recommend?  Thanks for all the help you've given me.


----------



## Beastie (May 8, 2017)

UFS. The handbook already has everything you need to know. Just use the appropriate device.

Also before nuking the internal disk, make sure the laptop doesn't come with a special hidden partition (other than Windows' partition(s)). Some manufacturers often include such annoyances and their machines will be bricked without them.


----------



## bsmith (May 8, 2017)

Thanks for letting me know that.   I wasn't aware.  And sorry for the dumb question but I've been going through 
ALL the FreeBSD documentation and I hadn't found that yet.  FreeBSD is exceptionally well documented but I'd be lying if I said I understood it all.


----------



## ShelLuser (May 9, 2017)

bsmith said:


> And sorry for the dumb question but I've been going through
> ALL the FreeBSD documentation and I hadn't found that yet.


Nothing dumb about that question. What would have been dumb is not asking and then leaving yourself in the dark about it or worse: picking up the wrong information.

We all got to start somewhere. And heck, it's what these forums were made for 



bsmith said:


> FreeBSD is exceptionally well documented but I'd be lying if I said I understood it all.


I can relate to that. Well, sort off; not anymore but definitely when I started out myself.

There are many topics which simply rely on knowledge about other (related) topics. Yet without those it'll be hard to fully wrap your fingers around the main issue (sorry for being vague, kind of hard to come up with examples from mind).

Anyway...  Remember this command: `sysctl kern.disks`. It's a nice and easy way of letting the kernel tell you what storage devices are currently accessible to it. So no need to muck around with dmesg or such. After that you can use gpart(8) to set up the required partitioning scheme and then use newfs(8) to set up the actual file systems.


----------



## Beastie (May 9, 2017)

On some computers the links on this forum seem to not appear clearly. So in case you missed it, in my last post there was a link to a specific page in the handbook. It has all the steps you'll be needing.

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-adding.html


----------



## tingo (May 9, 2017)

Another data point: in my experience, getting various Linux distros to mount disk partitions with UFS filesystems on can be difficult. Fortunately, FreeBSD can easily mount partitions with ext2 filesystems on it. So if you need to share a disk partition between Linux and FreeBSD, make the filesystem on that partition ext2.
Note: FreeBSD can also mount ext3 and ext4 filesystems, but that requires you to install a port first.
HTH


----------



## ShelLuser (May 9, 2017)

You can indeed access EXT3 / 4 through use of the Fuse port but keep in mind that those are limited to readonly access. So it might not be a good solution if you need to store data from FreeBSD as well.


----------



## bsmith (May 14, 2017)

sorry I did not respond sooner but I missed the email until I was just cleaning my inbox.   Thanks for all the responses. I really appreciate it.

Anyway, as I mentioned in my first post this computer has a docking station with a 320 gb hd but it's actually listed first in bios.  Changing the boot order is simple so I could change it to boot with whichever hd I want.  I really wanted the second hd for my backup but I certainly don't need that much space.  I have Debian and slackware on my linux laptop but I thought about trying gentoo on this laptop.  So could I just use gparted live and partition the hd with ext4 and not put a filesystem on the backup partition and then follow the instructions and be able to restore with no problems?  That would certainly be an easy solution but I haven't been able to boot anything yet from the hd.  Do I need to use gpart instead?  Sorry if that's a lot of questions but I would hate to do a backup and not be able to restore. 

Also in the instructions it says to create the new file system with /dev/ada1p1.  I don't understand where the p1 comes from.  Mine would ada0 but I'm not sure what to use next.

Thanks


----------



## Beastie (May 14, 2017)

bsmith said:


> Also in the instructions it says to create the new file system with /dev/ada1p1.  I don't understand where the p1 comes from.  Mine would ada0 but I'm not sure what to use next.


p1 is the GPT partition created after the `# gpart add ...` command. It's how GPT partitions show: p1, p2, p3, etc.
And it's ada1 because that page is about adding a _second_ disk, hence the _1_, with ada0 being the first disk.

Using `gpart show` will help you identify which disk you should be partitioning.


----------



## bsmith (May 14, 2017)

The disk number is what's confusing.  
	
	



```
$ gpart show ada1
=>       63  125045361  ada1  MBR  (60G)
         63          1        - free -  (512B)
         64  125045359     1  freebsd  [active]  (60G)
  125045423          1        - free -  (512B)

$ gpart show ada0
=>       63  625142385  ada0  MBR  (298G)
         63          1        - free -  (512B)
         64  625137281     4  !166  [active]  (298G)
  625137345       5103        - free -  (2.5M)
```

The ada0 is the external hd.  I can tell because ada1 shows FreeBSD plus the disk sizes.  The external hd is 300GB.  So I'm confused when you say it should be ada1.  I'm just trying to clarify everything first.

As to the fs and partitioning I saw that was answered in a previous post.  Sorry about that.  Thanks


----------



## Beastie (May 15, 2017)

I was commenting on the specific example in the handbook. Follow the output of `gpart show`. In your case it's ada0 indeed.


----------



## bsmith (May 15, 2017)

Thanks for the help.  Much appreciated.


----------



## bsmith (May 16, 2017)

Sorry to bug everyone again but I'm still not sure what command to use for ext4, or ext2 if need be, to create my file system and partitions for linux. I want to create a / swap and /home.  The FreeBSD partition would be formatted and then simply used for backup.  I understand how to do it for FreeBSD because of the documentation.  Did I miss something?   I don't have to put linux on that hd.  I've thought of using one of the other BSDs.  I'm open to any suggestions.

Thanks


----------



## ShelLuser (May 16, 2017)

bsmith said:


> Sorry to bug everyone again but I'm still not sure what command to use for ext4, or ext2 if need be, to create my file system and partitions for linux.


I'd use a Linux livecd for that. Seems like the easiest solution. Probably also the best chance you got considering the fact that Fuse only provides read-only ext4 access.


----------



## bsmith (May 16, 2017)

Ok, thanks for that.  I guess I can stop beating my head against the wall now.


----------



## bsmith (May 17, 2017)

I went to install Gentoo and immediately ran into problems with my well supported wireless wpa encrypted network.  I just had to manually configure everything in slackware and I don't want to go through that for another linux distro.  I checked distrowatch but really didn't find anything.   Any suggestions for an alternative?

Thanks


----------

