3

When I got my notebook with a 512GB SSD, I reformatted it and installed Ubuntu. I've followed Ubuntu's suggestion to partition the drive, so I have it partitioned as follows:

$ sudo parted -l
Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name                  Flags
 1      1049kB  538MB  537MB  fat32        EFI System Partition  boot, esp
 2      538MB   512GB  512GB  ext4

The drive is now 81% full, as shown by df -h:

/dev/nvme0n1p1  511M   26M  486M   6% /boot/efi
/dev/nvme0n1p2  468G  358G   87G  81% /

I want to keep partition 1 as it is and split partition 2 in two, so that / will be in one partition and /home will be in another partition. So the final partition table would look like this:

Number  Start   End    Size   File system  Name                  Flags
 1      1049kB  538MB  537MB  fat32        EFI System Partition  boot, esp
 2      538MB    32GB   32GB  ext4
 3       32GB   512GB  480GB  ext4

The reason I want to do that is I want to install a new version of Ubuntu (I don't want to upgrade) while keeping my /home untouched.

Is there a way to do this? I am able to use a live distro in order to manipulate the SSD partitions when they are unmounted. Will that make this task easier?

My requirements are:

  1. The obvious one: not losing any data.
  2. Not having to copy everything to another device.

So basically what I'm asking is:

Is there a way of splitting one of the partitions into two without having to reformat any of them?

Edit:

It seems like, for my specific case, the best option will be:

  1. Boot a Live-CD.
  2. Open gparted.
  3. Resize partition 2 to 32GB less than it is now (512GB).
  4. Move it to the end of the SSD.
  5. Create a 32GB partition in the free space.
  6. Save changes and exit gparted.
  7. Install the new distro into this new 32GB partition, configuring /home to be mounted in the previously resized partition.
  8. Move /home subdirectories to root of the old partition and delete everything else.
  • You're missing the step where you make a backup. If you have local space (like an external hard drive) for a backup, you can always do a test run on backed up data (i.e. clone the real drive to a VM and perform the operation) – nijave Dec 24 '18 at 2:37
0

Use gparted from a live system, to resize the partition, and add the new one.

You can get the gparted live OS, or install it into another live OS. (You can not re-size/move a partition that you are using).

(Remember to backup important data, ensure plugged in to power, and battery is charged.)

Alternatively

Put the new OS in a virtual-box. This is a good answer for most situations, but as fast for 3D stuff (e.g. Games, and CAD), but fast enough for most usages (Once the guest addons are installed). And you can use both OSs at the same time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.