Create and Manage disk on linux

1.Goals

I am a “basic” gui user and primary focused in using IHM to make a lot of tasks. To reduce the consumption of memory and cpu, all my linux server are now installed without some “sexy” elements likes graphical user interface such as KDE, GNOME or others.

I had to make some disk formating and creation basicaly so in order to do that, I had to understant the process in order to create a “partition” etc … . This post covers all the steps that I followed to succesfully create a partition for my future ftp server.

 

2.Tasks

The scenario to have it is describe below.

 

2.Tools

To do that ….

  • fdisk
  • lv / vg command
  • mkfs

3.Operations

3.1 Starting point

We start with a fresh server deployment and we want to use /dev/sdb and having the capacity to extend easily the partition.

  • We create a dedicated vmdk
  • We will create all the pieces and we will use logical volume in order to easily manage / extend capacity.

3.1 Create physical partition

We use fdisk tool to create the logical disk.

#fdisk /dev/sd[a,b …|xy]

We answer to several questions … . In my case, I don’t have to provide capacity because I am using all the disk :

Partition type : primary (limit 4 / disk) or extended …

Partition number : 1 to 4

First sector : Depends

Last sector :  I is more easy to provides the capacityif we have to

And the partition is created …

3.2 Create Volume Group

Next step, we will create a volume group which will rely on all /dev/sdb1

#vgcreate vol_data_ftp /dev/sdb1

3.2 Create Logical Volume

Now we create the logical volume. In the example screen, I have created to logical volume of 10G and 5G capacity.

#lvcreate -L size in G -n lv_name and vol_group_name

3.3 Formating the logical volume

I format the two logical volumes in xfs filesystem.

#mkfs.xfs /dev/volum_group_name/logical_volume_name

3.3 Mount Point Creation

We then create a mount point ( /ftp01 et /ftp02)

#mkdir /mount_point_name

3.4 Assign logical partition with mount point

We associate each mount point with the logical partition.

#mount -t xfs /dev/volume_group_name/logical_volume_name /mount_point

 

3.Control

The mount command will display all the current mount point usable.

 

 

4. Don’t forget ….

 

After a reboot, the mount point will still exist but not the association with the logical volume. To make it permanent, we have to make entries in /etc/fstab.

…. reboot the server and launch “mount” command again to check that all is functional.

 

Leave a Reply

Your email address will not be published. Required fields are marked *