Practical questions about disk partitioning, moving the /home directory and shrinking the / system directory.

Bas G. Roufs basroufs at gmail.com
Mon Jul 15 17:52:28 UTC 2024


Hey dear Nils and others.


Op ma 15 jul. 2024 08:49 schreef Nils Kassube <kassube at gmx.net>:

Thanks for your reply of this morning.

It helps me on the way to some solution that works for me.

You said before....

> > First of all, GPT is needed only if the drive is >2TB, (snip)


(...)

My reaction....


> > At my old SSD, I have used GPT too - so, I have sticked to this.
>


Your reply. ..



> Oh, sorry. Somehow I thought you wanted to change it TO GPT.


It is OK.

When trying to  fresh - install Kubuntu 24.04 LTS a few months ago, I had
many hiccups until I found some useful article that explained to me a few
useful details. I followed a few advises there.

OTOH, that wouldn't make sense because you already have an EFI partition
> which is only used with GPT.
>

The GPT Partition table, the EFI partition and other partions I showed you
in my previous post, have been advised to me in that article. By manually
partitioning in that way, I managed to get installed started Kubuntu 24.04
LTS.

You wrote before. ...


> > > And you should do it from a live system (...)
>

(snip)

You added later...


> Of course that part of my description wasn't useful because there is no
> extended partition with GPT.
>

Exactly.

Don't worry. I appreciate your effort to help me.

I explained....



> > Partition table entries in disk order, from left to right, according to
> > GParted. (Etc., snip...)
>

(...)

I said also...

>

> > However, it was not possible to format it from GParted at the Ventoy USB.
> > Instead, I used GParted within Kubuntu 24.04 - SDA5 was not in use.
>

Understandably, you write...


> I think that's a bit strange. There shouldn't be a difference here if you
> run gparted from a live system or from within Kubuntu.


In theory, you are right. However,  practice worked out differently...

But luckily you found the solution.
>

Exactly.

I explained. ...



> > When running sudo fdisk -l in the terminal, I get this result for the 1
> TB
> > SSD:
>

(Etc., snip....)

You advised....

>
> > > Now you should remove the old disk because your fstab probably uses
> UUID
> > > entries and the UUIDs of the cloned partitions are identical to the
> > > original ones.
>

I replied. ..


> From this point onwards, I have followed a slightly different strategy.
> > I had already removed before - right the old disk after the cloning
> > operation. And I also had formatted the yet empty sda5 with ext4. I have
> > labeled the sda5 partition as «Camino-casa». Then, via Midnight
> Commander,
> > sudo mc, I have recursively copied everything from home in sda3 to -for
> the
> > time being- home-new in sda5. I copied everything including symlinks,
> > permissions, etc.
> >
> > At some point, I'll rename home in sda3 as home-ori and home-new in sda5
> as home.
>

Then I asked....

> However, what exactly do I need to do at this point - in what order? And
> do
> > I need to rewrite something in the file /etc/fstab?
> > Thanks for considering these practical questions.
>


Your reply of this morning. ...


> Ah OK, so you made a copy of /home to the new partition. But IMHO that
> isn't ideal. You want to mount the new partition as /home, so the contents
> of /home should now be in the top folder of sda5. As an example, your $HOME
> was /home/bas before . If you now mount sda5 to /home, you would find the
> bas folder in /home/home-new/bas which is not exactly what you want.
>

You might be right...

Three times, I tried to start the laptop this morning. ...  The first two
attempts ended up in a complicated emergency mode... Only the third attempt
was successful. However,  I quickly shut down again. Probably,  the system
is confused because of the presence of two identical home directories in
two different partitions.

I wait with the next laptop working session,  till your reply to this mail
will come in.  Consciously, I have been using my phone to work out this
mail.


> I think you have two options now.
>
> 1. Move everything from the home-new folder to the top folder of sda5.
> Then you need only one fstab entry:
>

(...)

I tend to act according to the possible solution you summarise here
above....

Concretely, I think about the following steps in ONE SINGLE  SESSION. Any
suggestions when reading them?

Step 1.  «Home-ori» in sda3.
=====≠=================
I open the terminal and launch Midnight Commander via sudo mc. Then, I
navigate to the old home in sda3 at the left side. I navigate to sda5,
Camino-casa, at the right side. Then, I rename the old home in sda3 to
home-ori: via the root-command line  down under Midnight Commander.

Step 2. «home-new» > «home» @ sda5.
================================

At this stage, I stay in Midnight Commander. I want to deal with
Camino-casa, sda5 - more then 3 quarter of the 1 TB disk. There, I want to
rename «home-new» into «home». Like this, «home» will get at the «top
folder position» of sda5.


Step 3. Comparison old and new home.
================================
In this stage, I'll compare the old home folder at sda3 with the new one at
sda5. Primarily, I wanna do so via sudo mc, Midnight Commander in the
terminal. However, at some point, I also might invoke Dolphin.

Step 4. Delete home-ori @sda3.
=========================
In this stage, I still stay with sudo mc, Midnight Commander.  If the
comparison in step 3 will go well, I'll delete home-ori at sda3.

Step 5. Adaptation of /etc/fstab
==========================
Midnight Commander allows to quickly find /etc/fstab. It offers several
possibilities to edit it when using sudo mc. I'll do so according to your
suggestion. ....



> LABEL=Camino-casa /home ext4 defaults 0 2
>

Do I need to copy-paste EXACTLY this string into fstab?




> 2. Keep the additional home-new folder and use bind mount to virtually
> move the contents of home-new one folder upwards. (snip, etc.,. ...)
>

Too complicated. Thanks for the suggestion.

>


With both options the contents of your old home folder in sda3 is no longer
> accessible because it is now the mount point for sda5. I'm not sure if that
> is what you want. And if you rename home (of sda3) to home-ori in the
> future, don't forget to also create a new empty home folder in sda3 for the
> mount point of the sda5 partition.
>

This is exactly the reason I have the adaptation of fstab in mind as last
step, after everything else.

Thanks for all your advise.

I would appreciate one more reaction from you.

Yours.

Bas, in The Netherlands.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kubuntu-users/attachments/20240715/af244af8/attachment.html>


More information about the kubuntu-users mailing list