You are not logged in.
I just wanted to shrink my partition by 256GB and I did with cfdisk, now while booting up my pc I see "error: attempt to read or write outside of partition." 5 times
Update: I just restored what I did using cfdisk again and now the system is bootable and working, I need a way to correctly shrink my partition.
Last edited by xii69 (2024-09-12 08:50:55)
Offline
You have to shrink whatever is on this partition first. See lsblk, mount, etc...
For example if it's an ext4 filesystem, you can shrink it with resizefs (from a livecd / while it's not mounted).
If there are other layers involved (mdadm, lvm, ...) you have to deal with those too.
(If you don't care about keeping data, just wipefs / format / reinitialize it entirely.)
Last edited by frostschutz (2024-09-12 07:31:59)
Offline
what format is the partition? ext4, btrfs, other? Please specify.
In any case, the general rule is to shrink the filesystem first before shrinking the partition. How to shrink the filesystem depends on what format the partition is in.
It works the other way if you're enlarging the partition. Enlarge the partition first, then enlarge the filesystem.
EDIT: Ninja'd by frostschutz.
Last edited by kermit63 (2024-09-12 07:32:38)
Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.
Offline
Yes I do care about keeping my data and I don't want it to be wiped or deleted.
ext4 for / and fat32 for the /boot
Disk /dev/nvme0n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: KINGSTON SNVS2000GB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D0613309-F52A-463F-BF1B-EC0F75BEFA9E
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 2099199 2097152 1G EFI System
/dev/nvme0n1p2 2099200 3907029134 3904929935 1.8T Linux root (x86-64)
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot
└─nvme0n1p2 259:2 0 1.8T 0 part /Last edited by xii69 (2024-09-12 07:46:26)
Offline
man resize2fsShould be done while the partition is not mounted. Since this is your root partition, you'll have to do it from a live medium.
Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.
Offline
man resize2fsShould be done while the partition is not mounted. Since this is your root partition, you'll have to do it from a live medium.
Thanks.
Offline
i've resized the partition using resize2fs and did the file system check provided by the resize2fs warning, I can't see any Unused Space in gparted now, but my partition looks like this now:
Size: 1.82TiB
Used: 119.62GiB
Unused: 1.45TiB
where is that 256GB i shrink with resize2fs?
[xii69@xii69 ~]$ sudo fdisk -l
Disk /dev/nvme0n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: KINGSTON SNVS2000GB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D0613309-F52A-463F-BF1B-EC0F75BEFA9E
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 2099199 2097152 1G EFI System
/dev/nvme0n1p2 2099200 3907029134 3904929935 1.8T Linux root (x86-64)
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot
└─nvme0n1p2 259:2 0 1.8T 0 part /Last edited by xii69 (2024-09-12 08:37:02)
Offline
I think you are mixing the words filesystem and partition. resize2fs resizes the filesystem, not the partition. After resizing the filesystem using resize2fs, you still need to resize the partition using whatever partition tool you're comfortable with.
Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.
Offline
Thanks kermit63
I was able to resolve the issue by resizing the partition with cfdisk to match the size I used with resize2fs, and now I can boot into Arch without any problems. I’ll outline the steps I followed in case it helps someone else in the future:
-Boot into the Arch Live ISO.
-List the partitions with fdisk -l.
-Resize the ext4 partition using resize2fs /dev/nvme0n1p2 1606G (replace /dev/nvme0n1p2 with the correct partition for your setup).
-Open cfdisk with cfdisk /dev/nvme0n1, select the partition, and choose the resize option.
-Enter the same size (1606G in my case), write the changes, and reboot.
that’s it, hopefully this helps anyone encountering a similar issue.
Offline