- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Join Several Partitions on Linux
In this article, we will create a single partition on Linux using 2 drives of 20 GB each to make a 40 GB single mount point so that we can store the data in one place with more space on the volume. Here, we are using a package called ‘mhddfs‘ which is a driver for Linux that combines several mount points into a virtual disk. This is a fuse based driver which provides an easy solution for large data storage that combines many small file systems into a single big virtual file system.
Features of Mhddfs
- We can get System information and file system attributes.
- It can set attributes of the filesystem.
- Files and Directories can be Created, Read, Removed and Written.
- Supports hard links and file locks on a single device.
Advantages
- Very friendly for home users.
- Easy and simple to use.
- No Data loss.
- Files are not split into multiple hard disks.
Dis-Advantages
- No inbuilt drivers for Linux.
- Requires lot of processing of power during runtime.
- Hard-links moving will not be supported.
- No redundancy solution.
Installation of Mhddfs in Linux
Before proceeding further, please note that installation is needed to be a root user
# sudo -i
Execute the below command to install ‘mhddfs’ package.
# apt-get install mhddfs Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: mhddfs 0 upgraded, 1 newly installed, 0 to remove and 64 not upgraded. Need to get 0 B/26.0 kB of archives. After this operation, 96.3 kB of additional disk space will be used. Selecting previously unselected package mhddfs. (Reading database ... 91977 files and directories currently installed.) Preparing to unpack .../mhddfs_0.1.39+nmu1ubuntu1_amd64.deb ... Unpacking mhddfs (0.1.39+nmu1ubuntu1) ... Processing triggers for man-db (2.7.4-1) ... Setting up mhddfs (0.1.39+nmu1ubuntu1) ... # df -h Filesystem Size Used Avail Use% Mounted on udev 473M 0 473M 0% /dev tmpfs 98M 4.9M 93M 5% /run /dev/dm-0 19G 3.1G 15G 18% / tmpfs 488M 0 488M 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 488M 0 488M 0% /sys/fs/cgroup /dev/sda1 236M 51M 173M 23% /boot tmpfs 98M 0 98M 0% /run/user/1000 /dev/sdb1 20G 44M 19G 1% /backup /dev/sdc1 20G 44M 19G 1% /backup1
Take a note of the mount point’s name from output, which we will be using later in next steps.
Create a directory /mnt/virtual HDD where these file system will be grouped together and mounted.
# mkdir /mnt/virtualhdd
Then we needed to mount the /backup and /backup1. We need root permissions to who is a member of FUSE group.
# mhddfs /backup,/backup1 /virtualhdd/ -o allow_other mhddfs: directory '/backup' added to list mhddfs: directory '/backup1' added to list mhddfs: mount to: /virtualhdd/ mhddfs: move size limit 4294967296 bytes
We used the mount point names of all the HDDs. Obviously, the mount point in your case will be different. Also, notice “-o allow_other” is used to make Virtual file system to be visible to all other users who using this Linux system.
Now run “df -h” see all the disks and mount points which we created.
# df -l Filesystem 1K-blocks Used Available Use% Mounted on udev 483472 0 483472 0% /dev tmpfs 99888 4972 94916 5% /run /dev/dm-0 19213004 3158668 15055324 18% / tmpfs 499420 0 499420 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 499420 0 499420 0% /sys/fs/cgroup /dev/sda1 240972 51472 177059 23% /boot tmpfs 99888 0 99888 0% /run/user/1000 /dev/sdb1 20504628 44992 19395016 1% /backup /dev/sdc1 20504628 44992 19395016 1% /backup1 /backup;/backup1 41009256 89984 38790032 1% /virtualhdd
For automatic creation of Virtual File system to boot every time, we should add the below line at the end of /etc/fstab.
# vi /etc/fstab # /etc/fstab: static file system information. # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> /dev/mapper/server--vg-root / ext4 errors=remount-ro 0 1 # /boot was on /dev/sda1 during installation UUID=40f8b7fe-3195-414a-a0e4-a4443cceb78c /boot ext2 defaults 0 2 /dev/mapper/server--vg-swap_1 none swap sw 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0 mhddfs /backup,/backup1 /virtualhdd/ -o allow_other fuse defaults allow_other 0 0
Unmount the Virtual Drive
# umount /mnt/virtualhdd
After this configuration using ‘mhddfs’ utility it made very simple to combine different hard disks into a single storage. The best thing is that it is very easy to set up and we never lose data in this filesystem. If you have a larger data, then the disk you have and needed to save date in a single point, then we can your is setup and configured such that we can save that big or huge data.
- Related Articles
- Great tools to check linux disk partitions and usage in linux
- How to join lines of two files on a common field in Linux?
- How to use MySQL JOIN without ON condition?
- How to Install Git on Linux
- How to activate virtualenv on Linux?
- How to use tmux on Linux?
- How to make several plots on a single page using Matplotlib?
- How to run Linux libraries on Docker on Windows?
- How to limit network bandwidth on linux
- How to Install Atom 1.6.0 on Linux
- How to Install C++ Compiler on Linux?
- How to configuring Java Environment on Linux?
- How to free Inode usage on Linux?
- How to use chmod recursively on Linux?
- How to make several plots on a single page using Matplotlib(Python)?
