How to mount two hard drives in Linux to the same directory?
In a Linux system, you can mount two hard drives to the same directory using LVM (Logical Volume Management).
The following are the specific steps:
- Show block devices.
- List all the partitions on the system.
- initialize a physical volume
pvcreate /dev/sdb
pvcreate /dev/sdc
- create a volume group
vgcreate myvg /dev/sdb /dev/sdc
- create a logical volume
lvcreate -L 100G -n mylv myvg
- Create a new file system
mkfs.ext4 /dev/myvg/mylv
- Create a directory for mounting the logical volume, for example:
mkdir /mnt/mylv
- To climb or scale a mountain.
mount /dev/myvg/mylv /mnt/mylv
- The file named /etc/fstab
/dev/myvg/mylv /mnt/mylv ext4 defaults 0 0
After completing the above steps, both hard drives will be mounted in the same directory and can be used together.