Tuesday, June 18, 2019

Creating ext4 or xfs file system in EC2 for /dev/xvd*

Identify the disks by verifying with,
lsblk
ls /dev/xvd*

Use below command to know about device, and its file system. If the output shows simply data then there is no file system on the device.

file -s /dev/xvdd
/dev/xvdd: data

or If the device has a file system, it will show the file system type, as example below.
file -s /dev/xvdd
/dev/xvdd: Linux rev 1.0 ext4 filesystem data, UUID=5b906ad5-f67a-474e-a7d4-7787586c72a3 (needs journal recovery) (extents) (64bit) (large files) (huge files)
--------------------------------------------------

If there is no file system then you can create it by
mkfs.ext4 /dev/xvdd
mkdir -p /cassandra/data1
mount /dev/xvdd /cassandra/data1

or 

mkfs -t xfs /dev/xvdf
If there is no xfs installed do it by "yum install xfsprogs"
mkdir -p /cassandra/commitlog
mount /dev/xvdf /cassandra/commitlog
----------------------------------------------------
Make the changes persistent by adding the entires in /etc/fstab

as example:vi /etc/fstab
/dev/xvdd /cassandra/data1 ext4 defaults 0 0
/dev/xvdf /cassandra/commitlog ext4 defaults 0 0

then on command prompt
do
mount -a (refresh the file system)

***

No comments:

Post a Comment