How to combine multiple partitions into one large in CentOS by mergerfs


Read previous article: How to combine multiple partitions into one large in CentOS

mergerfs is a union filesystem geared towards simplifying storage and management of files across numerous commodity storage devices. It is similar to mhddfs, unionfs, and aufs.

Suppose, you have eights hard drives – sized 1TB each drive. And 7TB of video files, which you need to store on these drives. How would you do it?

mergerfs

Step 1: install mergerfs

yum install mergerfs

Step 2: check the partition setup in your system

[root@tutorialspots ~]# df -h
Filesystem       Size  Used Avail Use% Mounted on
/dev/md126        50G  4.9G   42G  11% /
devtmpfs         111G     0  111G   0% /dev
tmpfs            111G     0  111G   0% /dev/shm
tmpfs            111G   18M  111G   1% /run
tmpfs            111G     0  111G   0% /sys/fs/cgroup
/dev/sdb3        950G  897G  4.4G 100% /mnt/SSD2
/dev/sdf3        950G  901G  1.3G 100% /mnt/SSD6
/dev/sdh3        950G   18G  885G   2% /mnt/SSD8
/dev/sde3        950G  889G   14G  99% /mnt/SSD5
/dev/sdc3        950G  899G  2.5G 100% /mnt/SSD3
/dev/sda1        950G  893G  8.8G 100% /mnt/SSD1
/dev/sdg3        950G  189G  714G  21% /mnt/SSD7
/dev/sdd3        950G  887G   15G  99% /mnt/SSD4
/dev/md127       479M  145M  305M  33% /boot
tmpfs             23G     0   23G   0% /run/user/0

Step 3: create a new mount point to hold the virtual storage

[root@tutorialspots ~]# mkdir /mnt/virtual

Step 4: mount mergerfs

mergerfs -o defaults,allow_other,use_ino /mnt/SSD\* /mnt/virtual

Now, check on the mounted partition again

[root@tutorialspots ~]# df -h
Filesystem       Size  Used Avail Use% Mounted on
/dev/md126        50G  4.9G   42G  11% /
devtmpfs         111G     0  111G   0% /dev
tmpfs            111G     0  111G   0% /dev/shm
tmpfs            111G   18M  111G   1% /run
tmpfs            111G     0  111G   0% /sys/fs/cgroup
/dev/sdb3        950G  897G  4.4G 100% /mnt/SSD2
/dev/sdf3        950G  901G  1.3G 100% /mnt/SSD6
/dev/sdh3        950G   18G  885G   2% /mnt/SSD8
/dev/sde3        950G  889G   14G  99% /mnt/SSD5
/dev/sdc3        950G  899G  2.5G 100% /mnt/SSD3
/dev/sda1        950G  893G  8.8G 100% /mnt/SSD1
/dev/sdg3        950G  189G  714G  21% /mnt/SSD7
/dev/sdd3        950G  887G   15G  99% /mnt/SSD4
/dev/md127       479M  145M  305M  33% /boot
tmpfs             23G     0   23G   0% /run/user/0
1:2:3:4:5:6:7:8  7.5T  5.5T  1.7T  78% /mnt/virtual

Leave a Reply