阅读量:0
To merge two disks in Ubuntu, you typically use Logical Volume Management (LVM) or file system tools. Here’s how to do it using LVM:
Using LVM
Install LVM (if not already installed):
sudo apt update sudo apt install lvm2
Create Physical Volumes:
sudo pvcreate /dev/sdX /dev/sdY
Replace
/dev/sdX
and/dev/sdY
with your actual disk identifiers.Create a Volume Group:
sudo vgcreate my_volume_group /dev/sdX /dev/sdY
Create a Logical Volume:
sudo lvcreate -l 100%FREE -n my_logical_volume my_volume_group
Format the Logical Volume:
sudo mkfs.ext4 /dev/my_volume_group/my_logical_volume
Mount the Logical Volume:
sudo mkdir /mnt/my_mount_point sudo mount /dev/my_volume_group/my_logical_volume /mnt/my_mount_point
Update
/etc/fstab
(optional for persistent mounting):echo '/dev/my_volume_group/my_logical_volume /mnt/my_mount_point ext4 defaults 0 2' | sudo tee -a /etc/fstab
Using GParted (Graphical Tool)
Install GParted:
sudo apt update sudo apt install gparted
Run GParted:
sudo gparted
Select the Disks:
- Identify the disks you want to merge.
- Resize and move partitions as necessary to create unallocated space.
Create a New Partition:
- Use the unallocated space to create a new partition.
Apply Changes:
- Click the green checkmark to apply changes.
Important Notes
- Backup Important Data: Always back up data before modifying disk partitions.
- Data Loss Risk: Merging disks can lead to data loss if not done correctly. Proceed with caution.
If you need further assistance or a specific use case, let me know!