View previous topic :: View next topic |
Author |
Message |
bulletbill22 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 15 Oct 2022 Posts: 34
|
Posted: Mon Jul 08, 2024 5:03 pm Post subject: Best way to turn a partition into the entire disk |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
szatox Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
Joined: 27 Aug 2013 Posts: 3329
|
Posted: Mon Jul 08, 2024 5:27 pm Post subject: |
|
|
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 ![Laughing :lol:](images/smiles/icon_lol.gif) _________________ Make Computing Fun Again |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lekto Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 20 Sep 2014 Posts: 198 Location: Ancient Rome
|
Posted: Mon Jul 08, 2024 5:57 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
gentoo_ram Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 25 Oct 2007 Posts: 495 Location: San Diego, California USA
|
Posted: Tue Jul 09, 2024 4:14 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|