[arch-general] arch-general Digest, Vol 204, Issue 3

Daniel Venturini danielventurini021 at gmail.com
Tue Oct 12 13:08:48 UTC 2021


Hi, Pete
One day I did something similar to it. I had four partition:
*/boot/efi*

*/              # /dev/sda2*

*/home    # /dev/sda3*

*/tmp       # /dev/sda4*
and my goal was to completely move my partition */home* after */tmp* and
increase */* partition with the new /home's free space.
I did it in a simple way: I moved the contents of / and /home to other
partitions, then I joined old / and /home and I moved all contents of old /
to this new partition.

Let's go:

I booted my laptop within a live usb and I created two new partitions
(sda5, sda6), mounted them and moved all contents*:*

# mounting things (you can create sda5 and sda6 either with fdisk, cfdisk
or even with gparted)
mount /dev/sda2 /tmp/root
mount /dev/sda3 /tmp/home
mount /dev/sda5 /tmp/root-tmp      # partition that I created now
mount /dev/sda6 /tmp/home-tmp   # partition that I created now

# moving contents
mv /tmp/root /tmp/root-tmp
mv /tmp/home /tmp/home-tmp

# I highly recommend you to format both partitions that are going to be
joined
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3

# joining / and /home
# to do it, use *fdisk* to delete both (/dev/sda2 /dev/sda3) and create a
new one
# or use *cfdisk* to increase /dev/sda2.

Suppose you're going to use fdisk (it was what I used):
*umount /dev/sda2*

*umount /dev/sda3*
*fdisk /dev/sda*
*> d                 # delete partition*
*> 2                 # partition /dev/sda2*
*> d*

*> 3                 # partition /dev/sda3*


*> n                 # new partition (fdisk will join free space on old
/dev/sda2 and /dev/sda3)*

*> 2                 # probably 2 due to /dev/sda2*
*> Enter 2x*
*> p                # print new partition scheme to verify*

*> w               # write change; JUST DO IT WHEN YOU'RE SURE ABOUT YOUR
CHANGES.*

# now, mount your new partition and move all content:
mount /dev/sda2 /tmp/root
mv /tmp/root-tmp /tmp/root

# move home files too:
mv /tmp/home-tmp /tmp/root-tmp  # root-tmp is your new home partition on
/dev/sda5

# finally, just update the partitions UUID on /tmp/root/*etc/fstab*:
blkid | grep sda2     # looking for your new / partition UUID
blkid | grep sda5     # looking for your new /home partition UUID
# get both UUID and update them on your fstab file on /tmp/root/etc/fstab

# I don't remember exactly, but maybe you need to update your grub:
grub-mkconfig

Once done, I restarted and all things were working well.
If you really want to try it, *I highly recommend you to test it before* on
a VM or something like that, unless you know what you are doing.

I hope it can fit your problem :).


Daniel Venturini
DevOps | CyberSecurity enthusiastic | GNU/Linux
btw, I use Arch


Em ter., 12 de out. de 2021 às 09:00, <
arch-general-request at lists.archlinux.org> escreveu:

> Send arch-general mailing list submissions to
>         arch-general at lists.archlinux.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.archlinux.org/listinfo/arch-general
> or, via email, send a message with subject or body 'help' to
>         arch-general-request at lists.archlinux.org
>
> You can reach the person managing the list at
>         arch-general-owner at lists.archlinux.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of arch-general digest..."
>
>
> Today's Topics:
>
>    1. System manipulation (pete)
>    2. Re: System manipulation (Josephine Pfeiffer)
>    3. Re: System manipulation (Ben Mezger)
>    4. Re: System manipulation (David Rosenstrauch)
>    5. Re: System manipulation (Tasnad Kernetzky)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 11 Oct 2021 14:51:52 +0100
> From: pete <pg.nikolic1 at gmail.com>
> To: General Discussion about Arch Linux
>         <arch-general at lists.archlinux.org>
> Subject: [arch-general] System manipulation
> Message-ID: <20211011145152.0823c123 at ds9.net>
> Content-Type: text/plain; charset=US-ASCII
>
> Hi Folks
>
> Found myself with a rather awkward situation my / partition has only got 5%
> free i need to enlarge it somewhat i have another drive i can throw at the
> job
> my question is how do i go about moving "/" to another drive  i have
> looked but
> cant find an answer i do not really want to do a complete reinstall as i
> have
> so much extra software installed some of which has been a real pain to get
> working  .
>
> Any help please
>
>
> Pete .
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 11 Oct 2021 17:53:32 +0200
> From: Josephine Pfeiffer <pfeifferj at archlinux.ch>
> To: arch-general at lists.archlinux.org
> Subject: Re: [arch-general] System manipulation
> Message-ID: <462dbff5-fb37-c5eb-cbca-cbcbe6c7c98c at archlinux.ch>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> I think you can use gparted to move the partition to another drive.
>
> Best,
> Josie
>
> On 10/11/21 15:51, pete via arch-general wrote:
> > Hi Folks
> >
> > Found myself with a rather awkward situation my / partition has only got
> 5%
> > free i need to enlarge it somewhat i have another drive i can throw at
> the job
> > my question is how do i go about moving "/" to another drive  i have
> looked but
> > cant find an answer i do not really want to do a complete reinstall as i
> have
> > so much extra software installed some of which has been a real pain to
> get
> > working  .
> >
> > Any help please
> >
> >
> > Pete .
> >
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 11 Oct 2021 10:58:22 -0300
> From: Ben Mezger <me at benmezger.nl>
> To: pete via arch-general <arch-general at lists.archlinux.org>, General
>         Discussion about Arch Linux <arch-general at lists.archlinux.org>
> Subject: Re: [arch-general] System manipulation
> Message-ID: <m2h7dnzmrl.fsf at benmezger.nl>
> Content-Type: text/plain
>
> Can't you do something like:
>
> $ dd if=/dev/sda of=/media/drive1/backuproot.img
> $ dd if=/media/drive1/backuproot.img of=/dev/sdb # write back to disk
>
> --
> Ben Mezger
>
> https://seds.nl
> https://github.com/benmezger
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 11 Oct 2021 10:28:50 -0400
> From: David Rosenstrauch <darose at darose.net>
> To: pete via arch-general <arch-general at lists.archlinux.org>
> Subject: Re: [arch-general] System manipulation
> Message-ID: <e08d2ffd-1755-93d4-8d5d-23400112c5ed at darose.net>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
>
>
> On 10/11/21 9:51 AM, pete via arch-general wrote:
> > Hi Folks
> >
> > Found myself with a rather awkward situation my / partition has only got
> 5%
> > free i need to enlarge it somewhat i have another drive i can throw at
> the job
> > my question is how do i go about moving "/" to another drive  i have
> looked but
> > cant find an answer i do not really want to do a complete reinstall as i
> have
> > so much extra software installed some of which has been a real pain to
> get
> > working  .
> >
> > Any help please
> >
> >
> > Pete .
>
> One strategy that you might want to consider that I've used before and
> has helped many times, is to not move the entire root filesystem, but
> rather, just pieces of it.  For example, on my system, /home, /var, and
> /usr/local/share all reside on different volumes.  That frees up a lot
> of space on the root partition.
>
> Couple of other suggestions:
>
> 1) If you do decide to take my suggestion above, best way to do it (IMO)
> is to drop to system rescue mode (best to not copy /home while you're
> logged in) tar up the sub-dir, un-tar it onto the other device, then
> delete it off of the root fs.  (Best to make sure the data all got
> copied over correctly before you delete it.)  Then, after you've
> verified all looks good, change your fstab to mount the new device.
>
> 2) You might want to consider using LVM
> (https://wiki.archlinux.org/title/LVM) going forward.  If you have
> /home, /var, etc. on other devices, then those dirs are the only ones
> likely to need significant more space going forward, while your root fs
> isn't likely to grow much.  If you use LVM, you can just throw some
> additional disk space from the VG to /home whenever you need more space
> there.  (Or even add new disks.)
>
> HTH,
>
> DR
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 11 Oct 2021 16:39:27 +0200
> From: Tasnad Kernetzky <tasnadk at gmail.com>
> To: arch-general at lists.archlinux.org
> Subject: Re: [arch-general] System manipulation
> Message-ID: <29ee0483-4b38-f895-7bad-f43ea8eb6fbf at gmail.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> Hi,
>
> If you are planning to move to another drive anyways soon, did you try
> to free up space?
>
> My usual suspects are
>
> * pacman -Sc or -Scc
>
> * journalctl --vacuum-size=50M
>
> * logs and other stuff on /var
>
> * nfs cache
>
>
> Also, ncdu can be of great help to find huge files and folders you might
> not need any more.
>
>
> Best,
>
> Tasnad
>
>
> On 11.10.21 15:51, pete via arch-general wrote:
> > Hi Folks
> >
> > Found myself with a rather awkward situation my / partition has only got
> 5%
> > free i need to enlarge it somewhat i have another drive i can throw at
> the job
> > my question is how do i go about moving "/" to another drive  i have
> looked but
> > cant find an answer i do not really want to do a complete reinstall as i
> have
> > so much extra software installed some of which has been a real pain to
> get
> > working  .
> >
> > Any help please
> >
> >
> > Pete .
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: OpenPGP_signature
> Type: application/pgp-signature
> Size: 495 bytes
> Desc: OpenPGP digital signature
> URL: <
> https://lists.archlinux.org/pipermail/arch-general/attachments/20211011/e2c12c6e/attachment-0001.sig
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> arch-general mailing list
> arch-general at lists.archlinux.org
> https://lists.archlinux.org/listinfo/arch-general
>
>
> ------------------------------
>
> End of arch-general Digest, Vol 204, Issue 3
> ********************************************
>


More information about the arch-general mailing list