How to combine multiple partitions into one large in CentOS


mhddfs is a FUSE filesystem module which allows to combine several smaller filesystems into one big “virtual” one, which will contain all the files from all its members, and all their free space.

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?

Step 1: install mhddfs

Step 2: check the partition setup in your system

[root@tutorialspots ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/md127       50G   38G  9.4G  81% /
devtmpfs         47G     0   47G   0% /dev
tmpfs            47G     0   47G   0% /dev/shm
tmpfs            47G   50M   47G   1% /run
tmpfs            47G     0   47G   0% /sys/fs/cgroup
/dev/sde2       927G   77M  880G   1% /mnt/HDD5
/dev/sdd1       927G   77M  880G   1% /mnt/HDD4
/dev/sdh1       927G   77M  880G   1% /mnt/HDD8
/dev/sdc1       927G   77M  880G   1% /mnt/HDD3
/dev/sda2       926G  193M  879G   1% /mnt/HDD1
/dev/sdf1       927G   77M  880G   1% /mnt/HDD6
/dev/sdg1       927G   77M  880G   1% /mnt/HDD7
/dev/sdb1       926G   77M  879G   1% /mnt/HDD2
/dev/md126      478M  125M  324M  28% /boot
tmpfs           9.3G     0  9.3G   0% /run/user/0

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

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

Step 4: mount mhddfs

[root@tutorialspots ~]# mhddfs /mnt/HDD1,/mnt/HDD2,/mnt/HDD3,/mnt/HDD4,/mnt/HDD5,/mnt
/HDD6,/mnt/HDD7,/mnt/HDD8 /mnt/virtual -o allow_other
mhddfs: directory '/mnt/HDD1' added to list
mhddfs: directory '/mnt/HDD2' added to list
mhddfs: directory '/mnt/HDD3' added to list
mhddfs: directory '/mnt/HDD4' added to list
mhddfs: directory '/mnt/HDD5' added to list
mhddfs: directory '/mnt/HDD6' added to list
mhddfs: directory '/mnt/HDD7' added to list
mhddfs: directory '/mnt/HDD8' added to list
mhddfs: mount to: /mnt/virtual
mhddfs: move size limit 4294967296 bytes

Now, check on the mounted partition again

[root@tutorialspots ~]# df -h
Filesystem
 Size  Used Avail Use% Mounted on
/dev/md127
  50G   38G  9.4G  81% /
devtmpfs
  47G     0   47G   0% /dev
tmpfs
  47G     0   47G   0% /dev/shm
tmpfs
  47G   50M   47G   1% /run
tmpfs
  47G     0   47G   0% /sys/fs/cgroup
/dev/sde2
 927G   77M  880G   1% /mnt/HDD5
/dev/sdd1
 927G   77M  880G   1% /mnt/HDD4
/dev/sdh1
 927G   77M  880G   1% /mnt/HDD8
/dev/sdc1
 927G   77M  880G   1% /mnt/HDD3
/dev/sda2
 926G   77M  879G   1% /mnt/HDD1
/dev/sdf1
 927G   77M  880G   1% /mnt/HDD6
/dev/sdg1
 927G   77M  880G   1% /mnt/HDD7
/dev/sdb1
 926G   77M  879G   1% /mnt/HDD2
/dev/md126
 478M  125M  324M  28% /boot
tmpfs
 9.3G     0  9.3G   0% /run/user/0
/mnt/HDD1;/mnt/HDD2;/mnt/HDD3;/mnt/HDD4;/mnt/HDD5;/mnt/HDD6;/mnt/HDD7;/mnt/HDD8
 7.3T  609M  6.9T   1% /mnt/virtual

Step 5: Run mhddfs on every boot

Open /etc/fstab then add this line at the end of file.

mhddfs# /mnt/HDD1,/mnt/HDD2,/mnt/HDD3,/mnt/HDD4,/mnt/HDD5,/mnt/HDD6,/mnt/HDD7,/mnt/HDD8 /mnt/virtual fuse defaults,allow_other 0 0

Leave a Reply