Instructions for setting up Ubuntu 20.04 image with XFS file system

I’ve seen that from this link that it’s strongly recommended to use the XFS file system on Linux:

However the ubuntu instructions don’t mention setting up XFS or how to do so:

I’m struggling to find any instructions elsewhere for doing this (I want to set up an Ubuntu 20.04 image with the XFS file system, for me to then install MongoDB 4.4).

I don’t really want to have multiple file systems mounted on my image to keep things as simple as possible, but I’m not very familiar with Linux setup so any links to how to do this would be greatly appreciated


If you are setting up a production mongodb on Ubuntu a certain level of proficiency(or access to some who as) is going to be necessary. Aside from installation and configuration there will be a need for ongoing maintenance of the system.

If you are setting up a system to learn mongodb, xfs is not going to be required.

Mongodb Atlas alleviates this and allows you to concentrate on mongodb.

You are going to need to create or identify a partition to use and format it XFS.
There is no reason not to use XFS for the entire system, RHEL7+ use XFS by default, you’ll have to reinstall though.

Operating on existing partitions and filesystems can be a destructive process and render your system unusable.

You can use disks(graphical) to partition and format.
Or fdisk/gdisk to partition and mkfs to create the filesystem.
The filesystem will need to be mounted at boot for mongod to auto start, disks again can do this otherwise you can edit /etc/fstab.

1 Like

Thanks for your reply much appreciated.
It is going to be (eventually) a production system and I’m very familiar with mongodb, and pretty familiar with Linux in general just less so with the particular commands I need to mount a different filesystem.

I’m happy to use XFS as the only file system if that’s easy to do and I’m setting up everything from scratch anyway so no problem there.

Thanks for the pointers - can you clarify if I can use fdisk/gdisk to use XFS for the entire file system?

Hi there
I’m still unclear from your reply how I could use XFS for the entire file system and then reinstall.

What I want to be able to do is:
Write the Ubuntu OS on to my SD card using Raspberry Pi Imager ideally or another mechanism is fine
Set up the XFS file system on part of that SD card - how can I do this without wiping out the OS, while running this on a single SD card?

Hi @Ted_Francis

If you’re looking to install MongoDB on a Raspberry Pi, there’s a guide here: Install & Configure MongoDB on the Raspberry Pi.

Note that installing and managing MongoDB on a Raspberry Pi vs. a regular Linux server may involve different steps and set of skills (i.e. a small embedded server vs. a full high performance server). The XFS recommendation is mainly for a regular Linux server, and may not necessarily apply to your use case.

Best regards,


Thanks @kevinadi that guide is certainly useful - I’m glad to say I had already done (almost) all of those steps based on information found elsewhere, but there were a few new things in there that I hadn’t considered. Much appreciated.

Thanks also for the info about the XFS recommendation being more appropriate to a full high performance server, that’s very useful to know.