24/7/365 Support

Ubuntu advanced installation

Much of the Ubuntu Server installation process fulfils a majority of user needs, and it is used in the same manner by most of the users (newbie or advanced), but the part that requires much more attention and which is customized by many advanced system administrators depending on their needs is the partitioning step. In this section, we will have a look at how to perform an advanced partitioning for

a specific hard disk schema.

Using RAID

The RAID technology (an acronym for Redundant Array of Inexpensive Disks) refers to the techniques used to distribute data across multiple hard drives (creating a storage unit from several hard disks). The unit thus created has an improved fault tolerance (high availability) or a greater performance (the capacity/write speed). The distribution of data on several hard drives allows you to increase the safety and reliability of the associated services.

For more information about this technology, you can take a tour at http://www.tldp.org/HOWTO/Software-RAID-HOWTO.html . In this section, we will see how to install Ubuntu Server using two RAID1 partitions on two different hard disks, one for the root and the other for Swap:

  1. In the Partition disk step, select manual. Then, select one by one all the disks that you want and which should be a part of the RAID partitions (in our case, only two disks). For each disk, create a new empty partition table on it.
  2. Select the free space on the first drive. Then, choose Create a new partition. Set the size that you want for Swap; it should be twice the RAM size and up to 2 GB. Then, choose Primary and select Beginning. The physical volume for RAID option should be chosen in the Use as: line. Finally, select Done setting up partition.
  3. With the remaining free space, perform the same steps for the root partition. The only exception is that after setting the size, choose Continue and then select Primary. Also, select the Bootable flag: line to change the value to on.
  4. Return to the Partition Disks step and select Configure Software RAID at the beginning of the page. Then, choose yes to write the modifications to disk.
  5. In the Create MD device setup and for this example, choose RAID1, but if

you are applying another architecture, choose the one that fits your needs.

  1. Now, enter the number of hard drives that you have chosen for the array (in our case, we have two active devices). Then, select Continue.
  2. Next, enter the number of spare devices (choose the default setting for RAID1, which is 0) and then select Continue.
  3. At this step, choose the partitions that you wish to use. For the Swap partition, choose sda1 and sdb1. Select Continue to go to the next step.
  4. Repeat steps 3 to 7 to prepare the root partition, and at the end, choose sda2 and sdb2. Finally, select Finish.

We should now have a list of RAID devices and hard drives. The next remaining steps are required to format and set the mount point for the RAID devices. Deal with the RAID devices as a local hard disk; format and mount accordingly:

  1. Getting back to the initial partitioning page again, we will see our newly created RAID devices #0 and #1 partitions.
  2. Under the RAID1 device #0 partition, select #1 and press the Enter key.
  3. In the Use as: file, select swap area and then apply this partition by using the Done setting up partition entry.
  4. Under the RAID1 device #1 partition, select #1 and press the Enter key.
  5. In the Use as: file, select Ext4 journaling file system.
  6. In the Mount point field, choose / (the root file system). You can change the other options as you wish. Then, apply that partition by using the Done setting up partition entry.
  7. Finally, select Finish partitioning and write changes to disk.

The installation process will then continue normally.

Using LVM

LVM (Logical Volume Manager) allows the creation and the management of logical volume on Linux. The use of logical volumes somehow replaces the disks'

partitioning. This is a much more flexible system as it allows you, for instance, to reduce the size of a file system to expand another one regardless of their location

on disks.

For more information about this technology, you can take a tour at http://tldp.org/HOWTO/LVM-HOWTO/ . In this section, we will have a look at the partitioning step of Ubuntu Server installation process with the /srv partition mounted on a LVM volume. This section

will be divided into two parts—the first part is during the Ubuntu installation within

only one PV (physical volume), which will be a part of the VG (volume group), and the second part will be after the Ubuntu installation. While performing this process, we will demonstrate how to add a second PV to the VG:

  1. In the Partition disks screen, choose Manual.
    1. Select the hard disk. Then, choose Yes to confirm the Create a new empty partition table on this device order.
    2. [ 14 ]
  2. Next, create standard swap and / partitions with the file system that

you want.

  1. For our /srv LVM partition, create a new logical partition and change the Use as field to physical volume for LVM. Then, select Done setting up the partition.
  2. Now, choose Configure the Logical Volume Manager and select Yes.
  3. On the next screen and for LVM configuration action, select Create volume group. Name the VG (for example, vg01). Then, select the partition prepared for LVM and choose Continue.
  4. Return to the LVM configuration action page and select Create logical volume. Choose the newly created VG and name the new LV. Then, choose a size and at the end, select Finish. You will be taken to the main Partition Disks page again.
  5. Now, let's add a file system to our new LVM. To do this, select the partition under the LVM that you created and set up the file system that you want and

choose /srv as the mount point. Next, select Done setting up the partition.

9. Finally, apply the Finish partitioning and write changes to disk order.

Then, confirm the changes and continue your installation.

Now, we will continue with the second part that started after the Ubuntu Server installation and which covers adding a second hard disk, creating a PV, adding it to

the existing VG, extending LV with the srv command, and finally extending the file

system. In this part, we will use a second hard disk named /dev/sdb, and we will

use it entirely as a PV. You can configure and use as much of PV as you want:

1. First of all, create the PV using the following command:

sudo pvcreate /dev/sdb

2. Next, extend the VG (called vg01 in our example), as follows:

sudo vgextend vg01 /dev/sdb

  1. Use the vgdisplay command to find out the size that you can allocate (for free physical extents, see the Free PE / size line). We will assume in our example a free size of 511 PE (which is equivalent to 2 GB with a size of 4 MB PE), and we will use the entire available free space.
  2. We can now use the PE to extend the LV via the following command (there are other methods, but they are beyond the scope of this book):

sudo lvextend /dev/vg01/srv -l +511

  1. We used the -l option here to extend the LV using PE. If you want to extend using MB, GB, and TB, you can use the -l option.
  2. Before expanding an ext3 or ext4 file system, it is recommended that you unmount it before hand (as best practice). In case you want to reduce an LV, it will be mandatory to unmount it. The following commands unmount the partition and then check it:

sudo umount /srv sudo e2fsck -f /dev/vg01/srv

7. Finally, you can resize the file system by using the following command:

sudo resize2fs /dev/vg01/srv

8. Now, you can mount the partition and check its new size using the following command:

mount /dev/vg01/srv /srv && df -h /srv

Help Category:

What Our Clients Say