You are not logged in.

#1 2025-02-03 03:11:41

boarim
Member
Registered: 2022-05-28
Posts: 29
Website

Which CLI tools to shrink ext4 partition and increase exFAT partition?

I have an external HDD with the following layout:

$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 465.73 GiB, 500074283008 bytes, 976707584 sectors
Disk model: My Passport 0748
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: dos
Disk identifier: 0xb646ac8b

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048 195037183 195035136    93G 83 Linux
/dev/sdb2       195037184 976707583 781670400 372.7G  7 HPFS/NTFS/exFAT

I would like to shrink the ext4 partition to roughly 20GB and fill the new available space with the exFAT partition. From what I have understood reading other topics in the forum, I need first to shrink the ext4 filesystem and then shrink the partition itself. And I guess, I would need then to increase the exFAT filesystem and finally the corresponding partition.

Is this the right way to do it? Which command line tool can I use to achieve this?


Simplicity is the ultimate sophistication. — Leonardo da Vinci (1452–1519)

Offline

#2 2025-02-03 05:22:31

cryptearth
Member
Registered: 2024-02-03
Posts: 2,130

Re: Which CLI tools to shrink ext4 partition and increase exFAT partition?

backup data to another drive
wipe the drive
create new partitions
restore from backuo

or

buy a new drive

yes, what you want to do can be done - but a drive as old to be formatted in legacy ... I wouldn't trust it any further as I can throw it - and I'm bad at throwing harddrives

Offline

#3 2025-02-03 09:26:46

boarim
Member
Registered: 2022-05-28
Posts: 29
Website

Re: Which CLI tools to shrink ext4 partition and increase exFAT partition?

Well, the idea is to postpone the time I would need to buy another drive and squeeze as much as I can from this one. I know it is quite old, but it feels bad to throw it away since I have not any issue with it so far.


Simplicity is the ultimate sophistication. — Leonardo da Vinci (1452–1519)

Offline

#4 2025-02-03 15:54:05

cryptearth
Member
Registered: 2024-02-03
Posts: 2,130

Re: Which CLI tools to shrink ext4 partition and increase exFAT partition?

I don't advise against keep using the drive - I just advise for doing it properly
resizing filesystems and partitions is quite simple as just a few metadata needs to be changed at the start of it
but what you want is to also move a filesystem which is the more complicated part and maybe unsupported
shrinking the ext4 is no problem: first shrink the filesystem - then shrink the partition
but the next step moving the start of the exfat partition can already break things as the filesystem headers are usually expected at the start of the partition
you could end up no longer able to mount the exfat filesystem after moving the start of its partition - I don't know if exfat supports any modification at all - it was designed and developed by microsoft but just made public
hence the cleaner approach is to backup your files (you should do so anyway), wipe the drive, set it up in modern uefi how you like and restore your data from backup onto it

Offline

#5 2025-02-03 17:39:32

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 1,327

Re: Which CLI tools to shrink ext4 partition and increase exFAT partition?

The easiest way is to use gparted or kde partition manager or something in that direction. These GUIs will do all the labor; I have always found it impossible to manually do it because I never understood how. damnit misread CLI for GUI lol
BACK UP YOUR DATA

Last edited by jl2 (2025-02-03 17:40:55)


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Upload longer text output like this

Offline

Board footer

Powered by FluxBB