-2

Right now, I have everything in a partition (except EFI system partition). How can I split the partition into two, one for / and one for /home?

How would you use parted to do that step by step?

How would you use gparted to do that step by step?

How would you use LVM to do that step by step? Stephen suggested so.

One thing I am not sure of is that I can't just shrink the partition and create a second partition on the space that is freed by shrinking, because that doesn't move /home to the new partition.

Thanks.

enter image description here

$ sudo parted -l
[sudo] password for t: 
Model: ATA TOSHIBA MQ01ABF0 (scsi)
Disk /dev/sda: 500GB
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   500GB  500GB  ext4

$ sudo df -h
[sudo] password for t: 
Filesystem      Size  Used Avail Use% Mounted on
udev            1.7G     0  1.7G   0% /dev
tmpfs           340M  1.4M  338M   1% /run
/dev/sda2       457G  6.7G  428G   2% /
tmpfs           1.7G   27M  1.7G   2% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.7G     0  1.7G   0% /sys/fs/cgroup
/dev/sda1       511M  6.1M  505M   2% /boot/efi
tmpfs           340M   20K  340M   1% /run/user/1000
tmpfs           340M     0  340M   0% /run/user/106
Tim
  • 101,790
  • I don't think so. I don't have time to argue with you. – Tim Feb 22 '19 at 14:04
  • just move the contents of old /home to the new partition after creating the new one. gparted cannot do that. And use a Live USB for that. – pLumo Feb 22 '19 at 14:07
  • Why would resizing be an issue? Your /home is not a partition, it's just a normal subdirectory of /. Resizing the / partition will not affect /home, why would it? If you want to use the new partition as your /home, that's a different issue but it is still quite simple: just copy the contents of /home to the new partition and set the new partition's mountpoint as /home. You can easily find dozens of tutorials about this sort of basic partition setup. – terdon Feb 22 '19 at 14:17

1 Answers1

4
  • Boot a livecd with gparted available
  • Use gparted to resize the root partition and create the new one.
  • Mount the partitions somewhere.
  • Move the data with mv
  • Edit the fstab so the new partition will be mounted on /home
  • Reboot back into your regular system
plugwash
  • 4,352
  • Thanks. Do you know how to use LVM step by step instead? I was suggested to use LVM https://unix.stackexchange.com/questions/502300/can-parted-move-a-partition-like-gparted#comment926085_502304 – Tim Feb 22 '19 at 14:10
  • @Tim please try a google search for "lvm tutorial" and then ask a new question about a specific part of it if you are still having trouble. – terdon Feb 22 '19 at 14:15
  • LVM does have it's advantages, but it also has it's downsides. For example as I understand it shrinking a LV requires you to manually coordinate the resizing of the filesystem and the LV. – plugwash Feb 22 '19 at 15:06