Provisioning and Installing a New Filesystem on a New Logical Volume: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 23: Line 23:
<pre>
<pre>
lvcreate -y --type linear --extent 100%VG --name nfs_lv nfs_vg
lvcreate -y --type linear --extent 100%VG --name nfs_lv nfs_vg
</pre>
Create an ext4 filesystem with [[mkfs.ext4]]:
<pre>
mkfs.ext4 /dev/nfs_vg/nfs_lv
</pre>
Alternatively, an XFS can be created with [[mkfs.xfs]].
[[/etc/fstab#Mount_a_File_System_at_Boot|Mount the filesystem at boot]] by specifying it in /etc/fstab:
<pre>
/dev/mapper/nfs_vg-nfs_lv  /storage  ext4  defaults  1 2
</pre>
</pre>

Latest revision as of 01:21, 27 May 2017

Internal

Procedure

Create a new partition on the new block storage. We assume the entire block storage is available, so we won't partition it but we will use it in its entirety. If partitioning is required, use use fdisk or sfdisk.

Use pvcreate to initialize the storage for use as a physical volume with the Logical Volume Manager.

pvcreate /dev/sdb

Use vgcreate to create a volume group that uses the entire physical volume.

vgcreate nfs_vg /dev/sdb

Create a logical volume with lvcreate:

lvcreate -y --type linear --extent 100%VG --name nfs_lv nfs_vg

Create an ext4 filesystem with mkfs.ext4:

mkfs.ext4 /dev/nfs_vg/nfs_lv

Alternatively, an XFS can be created with mkfs.xfs.

Mount the filesystem at boot by specifying it in /etc/fstab:

/dev/mapper/nfs_vg-nfs_lv   /storage   ext4  defaults  1 2