Create and Extend XFS filesystem based on LVM: Difference between revisions

From roonics
Jump to navigation Jump to search
Line 36: Line 36:
Calling ioctl() to re-read partition table.
Calling ioctl() to re-read partition table.
Syncing disks.
Syncing disks.
</pre>
==Create LVM components : pvcreate, vgcreate and lvcreate==
<pre>pvcreate /dev/sdb1</pre>
<pre style="color: silver; background: black; width: 800px">
[root@james-test ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
</pre>
<pre>vgcreate vg_xfs /dev/sdb1</pre>
<pre style="color: silver; background: black; width: 800px">
[root@james-test ~]# vgcreate vg_xfs /dev/sdb1
  Volume group "vg_xfs" successfully created
</pre>
<pre>lvcreate -L +6G -n xfs_db vg_xfs</pre>
<pre style="color: silver; background: black; width: 800px">
[root@james-test ~]# lvcreate -L +6G -n xfs_db vg_xfs
  Logical volume "xfs_db" created.
</pre>
</pre>

Revision as of 09:42, 16 August 2019

Create a partition using fdisk

Run this command and set the options as below obviously changing the bits that are unique to your setup (i.e size):

fdisk /dev/sdb
[root@james-test ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x26d678c7.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-104857599, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +40G
Partition 1 of type Linux and of size 40 GiB is set

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Create LVM components : pvcreate, vgcreate and lvcreate

pvcreate /dev/sdb1
[root@james-test ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
vgcreate vg_xfs /dev/sdb1
[root@james-test ~]# vgcreate vg_xfs /dev/sdb1
  Volume group "vg_xfs" successfully created
lvcreate -L +6G -n xfs_db vg_xfs
[root@james-test ~]# lvcreate -L +6G -n xfs_db vg_xfs
  Logical volume "xfs_db" created.