Ubuntu merge disks by Logical Volume Management (LVM)

avatar
作者
猴君
阅读量: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

  1. Install LVM (if not already installed):

    sudo apt update sudo apt install lvm2 
  2. Create Physical Volumes:

    sudo pvcreate /dev/sdX /dev/sdY 

    Replace /dev/sdX and /dev/sdY with your actual disk identifiers.

  3. Create a Volume Group:

    sudo vgcreate my_volume_group /dev/sdX /dev/sdY 
  4. Create a Logical Volume:

    sudo lvcreate -l 100%FREE -n my_logical_volume my_volume_group 
  5. Format the Logical Volume:

    sudo mkfs.ext4 /dev/my_volume_group/my_logical_volume 
  6. Mount the Logical Volume:

    sudo mkdir /mnt/my_mount_point sudo mount /dev/my_volume_group/my_logical_volume /mnt/my_mount_point 
  7. 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)

  1. Install GParted:

    sudo apt update sudo apt install gparted 
  2. Run GParted:

    sudo gparted 
  3. Select the Disks:

    • Identify the disks you want to merge.
    • Resize and move partitions as necessary to create unallocated space.
  4. Create a New Partition:

    • Use the unallocated space to create a new partition.
  5. 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!

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!