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:
- The obvious one: not losing any data.
- 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:
- Boot a Live-CD.
- Open
gparted
. - Resize partition
2
to 32GB less than it is now (512GB). - Move it to the end of the SSD.
- Create a 32GB partition in the free space.
- Save changes and exit
gparted
. - Install the new distro into this new 32GB partition, configuring
/home
to be mounted in the previously resized partition. - Move
/home
subdirectories to root of the old partition and delete everything else.