Setting up linux file system

Installing XFS & Creating XFS File System on Ubuntu

XFS file system gives its user many advantages and is becoming one of the preferred file systems. It is now also the default file system in RHEL 7. We have got many requests to make a tutorial on creating XFS filesystem on Ubuntu as by default XFS package is not present in Ubuntu.

In this tutorial, we will learn how to install the XFS package in Ubuntu, create xfs filesystem and then mount it.

Installing XFS and Creating XFS File System on Ubuntu

Ubuntu versions, though its package is not installed by default and we will have to install the package first. Read about advantage and disadvantage of XFS filesystem at Ubuntu wiki page.

Steps to Install XFS Package in Ubuntu

1. Verify if the “xfsprogs package” is installed or not on your server. Also, if the package is not installed on the server, you will not find “mkfs.xfs” command.

apt list --installed | grep -i xfs

2. Now, install the xfsprogs package if not present. Below is the command to do that and output from our Ubuntu terminal.

[email protected]:~# apt-get install xfsprogs Reading package lists. Done Building dependency tree Reading state information. Done The following additional packages will be installed: libreadline5 Suggested packages: xfsdump attr quota The following NEW packages will be installed: libreadline5 xfsprogs 0 upgraded, 2 newly installed, 0 to remove and 288 not upgraded. Need to get 696 kB of archives. After this operation, 3,744 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libreadline5 amd64 5.2+dfsg-3build1 [99.5 kB] Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 xfsprogs amd64 4.3.0+nmu1ubuntu1.1 [597 kB] Fetched 696 kB in 1s (443 kB/s) Selecting previously unselected package libreadline5:amd64. (Reading database . 177984 files and directories currently installed.) Preparing to unpack . /libreadline5_5.2+dfsg-3build1_amd64.deb . Unpacking libreadline5:amd64 (5.2+dfsg-3build1) . Selecting previously unselected package xfsprogs. Preparing to unpack . /xfsprogs_4.3.0+nmu1ubuntu1.1_amd64.deb . Unpacking xfsprogs (4.3.0+nmu1ubuntu1.1) . Processing triggers for libc-bin (2.23-0ubuntu9) . Processing triggers for man-db (2.7.5-1) . Setting up libreadline5:amd64 (5.2+dfsg-3build1) . Setting up xfsprogs (4.3.0+nmu1ubuntu1.1) . update-initramfs: deferring update (trigger activated) Processing triggers for libc-bin (2.23-0ubuntu9) . Processing triggers for initramfs-tools (0.122ubuntu8.8) . update-initramfs: Generating /boot/initrd.img-4.10.0-28-generic [email protected]:~#
[email protected]:~ # apt list --installed | grep -i xfs WARNING: apt does not have a stable CLI interface. Use with caution in scripts. xfsprogs/xenial-updates,now 4.3.0+nmu1ubuntu1.1 amd64 [installed]

Steps to Create XFS File System in Ubuntu

3. Now, once you have installed the XFS package following the above steps, now it is time to create your XFS file system. Take the block device and format it using “mkfs.xfs” command as given below.

[email protected]:~# mkfs.xfs /dev/sdb meta-data=/dev/sdb isize=512 agcount=4, agsize=32768 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=0 data = bsize=4096 blocks=131072, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=855, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [email protected]:~#

4. Now, once your block device is formatted as XFS, you can mount it using “mount” command.

[email protected]:~# mount /dev/sdb /mnt [email protected]:~# df -hP /mnt Filesystem Size Used Avail Use% Mounted on /dev/sdb 509M 27M 483M 6% /mnt

In the above example, we have mounted the file system temporarily, to mount it permanently put its entry in /etc/fstab file.

Читайте также:  Удаление postgresql linux centos

This is how simply you can install the XFS package and create your XFS filesystem.

We hope you enjoyed reading this tutorial and parallelly you have installed XFS and created your XFS file system. In case of any problem or doubt, please let us know through your comments and email. Do not forget to subscribe to Storage Tutorials and follow us on social networking websites like Twitter, Facebook, etc.

Источник

Оцените статью
Adblock
detector