You are not logged in.

#1 2021-11-14 11:53:40

creepylove
Member
Registered: 2021-11-14
Posts: 2

Extending partition to the left

Hello everybody,
I've been dual-booting archlinux and windows 10 for almost a year now and am beginning to run out of space on my 100G archlinux partition.
Now I have shrunk down my windows 10 partition by 260G and want to extend my archlinux partition by those 260G.
The 260G partition (/dev/nvme0n1p6) is directly to the left of my 100G (/dev/nvme0n1p5) partition.
If I were to just try it out right now I would do:

Format "/dev/nvme0n1p6"
Boot into live usb
Mount the 2 drives to "/mnt/archold" and "/mnt/archnew"
Execute "sudo dd if=/mnt/archold of=/mnt/archnew" and wait for it to finish
Mount "/dev/nvme0n1p2" to "/boot/EFI" (I'm using UEFI and it says that "/dev/nvme0n1p2" is of type "EFI System" in "fdsik -l")
Execute "arch-chroot /mnt/archnew", "pacman -S grub efibootmgr os-prober", "grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=grub" and "grub-mkconfig -o /boot/grub/grub.cfg"
Boot into the new system to check that everything is fine
Boot into live usb
Format "/dev/nvme0n1p5" and merge the partitions

Are these steps correct and is it safe for me to do it like this or is there a better way?
Please let me know if I missed anything. Thanks in advance and have a nice day big_smile

Offline

#2 2021-11-14 14:15:24

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,339
Website

Re: Extending partition to the left

I think you should use rsync instead of dd. See https://wiki.archlinux.org/title/Rsync# … tem_backup for a method.

Also note that the EFI system partition should be mounted to /mnt/archnew/boot/EFI/ because it will not be accessible from the chroot environment if you mount it under /boot/EFI/.


Para todos todo, para nosotros nada

Offline

#3 2021-11-14 15:44:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,300

Re: Extending partition to the left

You could also "just" make the partition space free and then move the entire partition without reformatting. This is a bit of a hairy operation with commandline tools, but e.g. a gparted live disk should make this fairly trivial. Still  would be a good idea to have backups of important data anyway.

Offline

#4 2021-11-14 16:11:00

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,230

Re: Extending partition to the left

V1del wrote:

Still  would be a good idea to have backups of important data anyway.

doubleplusgood


Seriously, don't even think about it unless you have known good backups.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2021-11-15 17:30:07

creepylove
Member
Registered: 2021-11-14
Posts: 2

Re: Extending partition to the left

V1del wrote:

You could also "just" make the partition space free and then move the entire partition without reformatting. This is a bit of a hairy operation with commandline tools, but e.g. a gparted live disk should make this fairly trivial. Still  would be a good idea to have backups of important data anyway.

I actually tried gparted but it's way too slow and would take multiple days

Head_on_a_Stick wrote:

I think you should use rsync instead of dd. See https://wiki.archlinux.org/title/Rsync# … tem_backup for a method.
Also note that the EFI system partition should be mounted to /mnt/archnew/boot/EFI/ because it will not be accessible from the chroot environment if you mount it under /boot/EFI/.

Good idea although since the file system stays the same and I got more space on the new partition wouldn't it just be easier to use dd? Also if I were to use rsync would I use the file system cloning or the full system backup command shown in the wiki?
Also thanks very much for telling me about the boot mount thing.

Offline

#6 2021-11-15 17:57:58

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,339
Website

Re: Extending partition to the left

creepylove wrote:

Good idea although since the file system stays the same and I got more space on the new partition wouldn't it just be easier to use dd?

*shrugs* If you find it easier then yes :-)

creepylove wrote:

if I were to use rsync would I use the file system cloning or the full system backup command shown in the wiki?

The method I linked would be my preference. If you need to preserve the filesystem metadata then use the cloning method.


Para todos todo, para nosotros nada

Offline

#7 2021-11-15 18:05:56

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,230

Re: Extending partition to the left

Backups?

(ewwaller whistles nervously as he walks past graveyard)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2021-11-15 18:33:44

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Extending partition to the left

Personally I'd just boot a gparted iso and move the partition left then expand it....
Backups are always required if you value any of your data.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#9 2021-11-15 19:02:57

twobooks
Member
From: rainforest
Registered: 2020-06-23
Posts: 46

Re: Extending partition to the left

fsarchiver is the way to go, you will have a backup during the process, and the new partition will have an exact same UUID, you don't need to change grub config. fsarchiver works great with ext4 or xfs. the -j 4 option will speed up the process if you have more cores just increase the numbers after -j.

Last edited by twobooks (2021-11-15 19:07:06)

Offline

Board footer

Powered by FluxBB