Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Best way to turn a partition into the entire disk
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
bulletbill22
n00b
n00b


Joined: 15 Oct 2022
Posts: 34

PostPosted: Mon Jul 08, 2024 5:03 pm    Post subject: Best way to turn a partition into the entire disk Reply with quote

I have a disk with a single partition that starts at 2048 and doesn't go to the end of the disk because there used to be other partitions on it. I want to have the entire drive formatted as an ext4 filesystem. The partition on it has about 60G over 7 files, most of which are only a few MB and 1 that holds all the data.

I don't want to reformat it and copy a backup onto it because that will take centuries (Its an HDD), although it would work. I've got it backed up just in case. But I'm wondering if there's a slick way to move the ext4 fs root and dd it over the MBR or something, so the filesystem will use the whole disk.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3430

PostPosted: Mon Jul 08, 2024 5:27 pm    Post subject: Reply with quote

You _could_ delete all partitions, and create 1 starting exactly from the same sector as already existing one and then grow the filesystem wit resize2fs.
Mind that _could_ doesn't mean you _should_. Copying 60G onto a HDD will take like 5 minutes, which is less than you're going to spend figuring out the numbers in fdisk prompt and less error prone, so just do it.

Really, sometimes plan B is so good you can just skip plan A completely instead of failing it first
I know, I know, 5 minutes can feel like centuries when you're on the wrong side of the door to the toilet :lol:
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 207
Location: Ancient Rome

PostPosted: Mon Jul 08, 2024 5:57 pm    Post subject: Reply with quote

For me, the easiest way to resize or move a partition is to use GParted. It is available in the portage tree (sys-block/gparted) or as a live OS (https://gparted.org/). This program is so easy to use; I was using it without any issue when I was a teenager and barely understood English.
Back to top
View user's profile Send private message
gentoo_ram
Guru
Guru


Joined: 25 Oct 2007
Posts: 502
Location: San Diego, California USA

PostPosted: Tue Jul 09, 2024 4:14 am    Post subject: Reply with quote

The easiest approach would be to keep the disk partitioned but extend the ending sector of the partition as far as your partition editor program will allow. Then you can extend the filesystem. No data would have to be moved.

You could potentially wipe out the partition table to create a non-partitioned disk but when you mount the filesystem you'll need to add a parameter to tell the mount program the offset in the drive where to find the superblock since it will be in a non-standard location. I'm not sure how that extra complication is worth it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum