2

I installed Lubuntu without partitioning my hard drive. Now there is one partition for UEFI, and one partition for anything else on the hard drive, wherein there is a swap file half size of my RAM.

  1. I heard that it is important to separate /home and / into different partitions? For example, for protection of the data in /home, in case something goes wrong in /. Correct?

    If yes, can LVM help to separate the current /home and / on my disk for that purpose, given that /home and / are in the same partition right now?

  2. I also consider if it is worth to create a swap partition twice size as my RAM, for suspending Lubuntu purpose. Can LVM also help to create a swap partition on top of the partition?

I haven't used LVM before, so just want to know if LVM can help to solve the above two problems without the hassle of repartitioning the hard drive? Or do I have to repartition my hard drive into a partition for / and a partition for /home, most likely by reinstalling Lubuntu?

Thanks.

$ 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

$ df -h Filesystem Size Used Avail Use% Mounted on udev 1.7G 0 1.7G 0% /dev tmpfs 340M 1.3M 338M 1% /run /dev/sda2 457G 6.5G 428G 2% / tmpfs 1.7G 0 1.7G 0% /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

Tim
  • 25,177
  • There's all sorts of discussion about this very subject, and most of it gets marked as "primarily opinion based" I ran for a long time with just a single partition - it works well. I now keep "/home" in a separate partition, because I can tell Ubuntu to erase "/" and reinstall, without affected the files in "/home". You should consider a backup plan (regular backups) to protect the data in "/home". – Charles Green Feb 21 '19 at 00:07
  • I am asking about if LVM can help to solve my problem. But your comment doesn't even mention LVM. How is that opinion based? Please retract your close vote if it was you. Thank you! – Tim Feb 21 '19 at 00:14
  • 1
    LVM can help, but it's not required for what you are trying to do. But the big part of your question seems to be "Is it important to separate /home and / into different partitions? For example, for protection of the data in /home, in case something goes wrong in /?" – Charles Green Feb 21 '19 at 00:17
  • Please try to re-understand my post. I have already installed everything into a single partition, now I want to protect / and /home from each other, can LVM help or do I need to repartition the hard drive into a partition for / and a partition for /home (most likely by reinstalling Lubuntu)? – Tim Feb 21 '19 at 00:18
  • 1
    You don't have a lot of data on your system yet, it will probably be easier to re-install - You can add LVM at that point if you decide you need it. LVM can manage all of this for you, but it may be like driving a dump truck, when you need a pickup truck. – Charles Green Feb 21 '19 at 00:29
  • AU usually asks users to focus on single questions - the third question you are asking is again, "it depends". I do hibernate, but I'm thinking of stopping that practice. It does not work as well as I would like, although it is convenient when it does work. Not all systems can hibernate - this is a good reference https://askubuntu.com/a/821122/283721 – Charles Green Feb 21 '19 at 00:31
  • I would like to protect / and /home from each other from now, not later when there is a lot of data. Also I want to know now if LVM can help, or if I need to repartition / and /home into different partitions. My post is a single question, (see my title). – Tim Feb 21 '19 at 00:43
  • There's few answered questions on converting "/" to an LVM after installation of Ubuntu - maybe this one would help? https://askubuntu.com/a/380301/283721 – Charles Green Feb 21 '19 at 01:06
  • Thanks. I will take a look. Also, if one plans to use LVM immediately after installing Ubuntu, how shall they partition their disk when installing Ubuntu: not partition at all (and then like me now have no clue what to do next after installing Ubuntu), or partition their disk into some partitions (needed by LVM)? – Tim Feb 21 '19 at 01:08
  • About swap: with modern computers it's become unnecessary to create swap partition, especially where RAM is above 4GB range and if you use SSD. I personally have 1 GB swap file just in case, no partition, and like 8 GB of RAM – Sergiy Kolodyazhnyy Feb 21 '19 at 01:14
  • @SergiyKolodyazhnyy Why unnecessary? When I suspend Ubuntu, do I need a swap partition instead of a swap file, and a swap partition twice size of RAM? – Tim Feb 21 '19 at 01:16
  • @Tim Well, correction: "Unnecessary to create twice the size of RAM". Because it's already been mentioned many times by other people - RAM is the fastest and no tricks help aside from actually increasing RAM itself. And with modern computes there's pretty good amounts in average computers already preinstalled – Sergiy Kolodyazhnyy Feb 21 '19 at 01:23
  • @Tim You can hibernate to a swapfile, but its more involved than hibernating to a partition. In the RESUME kernel parameter of grub, you will need to specify both the UUID of the disk the swapfile is on, and the offset from the beginning of the partition to the swapfile. https://askubuntu.com/a/1053227/283721 – Charles Green Feb 21 '19 at 01:36
  • @SergiyKolodyazhnyy My 8G RAM is often used fully and my swap gets used, I can't afford more RAM or a new laptop which can support more RAM. When suspending Ubuntu, why do you not need enough swap size (which is twice size of RAM) to store both RAM and swap? – Tim Feb 21 '19 at 01:38
  • @Tim Hibernation needs swap. Suspending IIRC doesn't. RAM being used is good - it's not the type of resource you want to hold on to, but you might want to examine swappiness value and maybe tune the amount of resources applications consume. There should be a bit of RAM to start new processes. Swap is meant for freeing RAM for that purpose, removing pages that are not used too often. – Sergiy Kolodyazhnyy Feb 21 '19 at 01:42
  • Tim... for a 500GB drive, it makes NO SENSE to move to LVM and reinstall everything. – heynnema Feb 21 '19 at 17:22
  • @heynnema can you explain why no sense? What makes sense instead? – Tim Feb 21 '19 at 17:30
  • Tim... for 1) using LVM on such a small drive would waste disk space, 2) the extra time required to manage LVM, 3) the time to backup, init the HDD, reinstall Ubuntu with LVM, 4) performing a complete backup would require separate backup scripts for / and /home. If you had larger/multiple HDD it would make more sense. Regarding swap... normally twice RAM is too much, even if you hibernate... but that's a whole different discussion. – heynnema Feb 21 '19 at 17:33

0 Answers0