суббота, 26 марта 2016 г.

Enabling G-Journal in FreeBSD

Example 1

First of all, login to your system.
Then look at your fstab file and find a partition to enable geom journal on. Note that it is impossible to enable journal for the root / file system.
I am going to enable journal for the partition of the /var directory located on the ada0p4 geom.

First of all I check if the gjournal kernel module is loaded. If it is not loaded, I add it to the loader configuration (/boot/loader.conf) and load it.
Then I add a new partition for journal provider.
You can see that ada0s6 will become the journal provider.

To enable journaling for a partition you should make sure that the partition is not mounted. If it is mounted, you should to unmount it:
# umount -f /var/
and enable journaling using the next command:
# gjournal label -f ada0p4 ada0s6
where ada0p4 is a data provider and ada0s6 is a journal provider.
After journaling is enabled you should edit the fstab file.
For example if your data provider geom was ada0p4, you should replace its device with /dev/ada0p4.journal. You also should use asynchronous mounting for journaled partition using the async option.
After that you should to disable soft updates for the partition and tune its file system to set gjournal.
This was the last stepping stone to enable journaling for the partition, so you may mount it back now.

Example 2

The full geom journal enabling typescript may look like this.
$ su
# gpart add -t freebsd -a 4k ada0
# umount -f /usr/
# gjournal label -f ada0p5 ada0p7
# cp /etc/fstab /etc/fstab.old
# ed
e e /etc/fstab
e 5c
e /dev/ada0p5    /usr    ufs    rw,async    2    2
e .
e w
e q
# tunefs -J enable -n disable /dev/ada0p5.journal
# mount /usr/

Continue reading -> Bootstrapping package manager.

пятница, 25 марта 2016 г.

Installing FreeBSD 10.2

Today I will show you how to install the FreeBSD 10.2 operating system upon your computer. This process is quite easy and fast.

First of all you have to put previously prepared installation DVD to the tray of your optical drives reader and (re-)boot the computer.

After the computer boot you will see the next screen.
Press B or ENTER to boot FreeBSD installer immediately.

After boot process complete you will see the Installer welcome screen.
Press ENTER or I to start installation. The first stepping stone is key map selection.
Use arrow keys (UP and DOWN) to select the keyboard map you prefer.
Then press ENTER.
Press UP and, then, ENTER keys to continue with the selected map.
This screens asks you to type the name of the computer. Do it.
Then press ENTER to confirm. The next dialog allows to select operating system's components you wish to install. Move the selection using the UP and DOWN keys and check or uncheck components using the SPACE bar.
If you see a [*] mark on the contrary component, it means the component will be installed.


I usually install all the components except the extra documentation.
Disk partitioning is the most important part of the installation.
The Auto (UFS) option is the simplest. Just press ENTER...

...and again to grant FreeBSD access to the entire hard drive.
Select the GPT partition scheme as it is modern and the most commonly used and compatible scheme.
This user friendly pseudo graphical partition editor suggests you very easy and flexible disk setup. But I like to use separate file systems for a /usr and /var directories. To achieve this I set the selection over the ada0p2 partition (in using double press DOWN key) and delete it (press D) because of the aforementioned reason. Then I select ada0p3 partition and delete it too because I want to have a larger swap partition.
Then I select ada0 scheme and press C to create a new partition for the root file system. The partition editor shows the window where I specify the type (freebsd-ufs), the size (4GB) of the creating partition and the mount point (/).
After pressing the ENTER key I create the the partition for swap. I set partition type to freebsd-swap, size to 2GB (this is a required minimum for desktop systems) and leave mount point and label empty for this partition.
Then I create one more partition. This time is for the /usr directory.
And, finally, I create 4GB partition for the /var directory.
The rest free space I am going to use for G-Journals for the /usr and /var directories file systems.
I press F here to finish partitioning...
...and ENTER here to commit changes to the disk.

  *  *  *

FreeBSD starts copying files from check sums verification...
...and then extracts distribution files of the selected components from archives.
This stage takes a few minutes (up to ten).
Files copied! Next screen asks to type root's password.
Now FreeBSD installer tries to configure the network.
I pressed ENTER here.
And here.
Here too.
And here :-)
Of course YES :-) and wait few seconds.
Then...
...accept correctly determined network settings.
Here...
  ...I didn't know (it is the virtual machine), so I selected <No>...
 ...and pressed ENTER.
Then I select my region and...
...country.
Then I choose my primary time zone...
 ...and accepted time zone abbreviation.
The next screen offers different services.
I usually activate all of them exclude local caching validation resolver.
Then Installer asks us if we want to add users to the system.
I usually agree and add myself.
Note, that you should list groups separate them by space.
After confirmation I got the clean installed FreeBSD.
Here I press ENTER,
N (to prevent opening post installation shell)
and ENTER or R to reboot to the installed system.

That's enough for today: FreeBSD has been installed!

Read the next: Enabling G-Journal in FreeBSD.