Rusty's suggestion should work, but it's a bit intimidating. The same thing can be done with fdisk
a bit more simply:
- Launch
fdisk
on the disk by typing sudo fdisk /dev/sda
.
- Verify that you're working on the right disk by typing
p
to see the partition table and verify that it shows the same partitions you've posted.
- Type
d
and, when prompted for a partition number, type 1
.
- Type
n
to create a new partition. When prompted, enter p
for the partition type, 1
for the partition number (actually, I think that fdisk
won't prompt for this detail), 616448
for the first sector, and 257433597
(the start point of the extended partition minus 1) for the last sector. (That last-sector value may be the default, in which case you can just hit Enter.)
- Type
p
to verify that the partitions are correct. They should look just like what you've got now, except that the end point of /dev/sda1
should be one sector before the start of /dev/sda4
.
- Type
w
to save your changes and exit.
Whether you follow my procedure or rusty's, be aware that there's a chance that the filesystem within /dev/sda1
thinks that it can use beyond sector 257,433,597. If so, repairing the disk in this way could cause problems on that partition. There's really no way around this problem, and avoding it by not repairing your current problem runs the risk of damaging your partition table in a way that will cause /dev/sda5
to disappear or its contents to be damaged, so fixing the problem is definitely in order. To mitigate the risk of damage to /dev/sda1
, though, I recommend you run CHKDSK
in Windows (or use its GUI front-ends) to verify that integrity of /dev/sda1
. I'm not positive, but I'd expect that CHKDSK
would detect a too-small container partition. You might need to do a filesystem resize to fix the problem if the partition is too small for the filesystem -- but do this after resizing the partition to minimize the risk of damaging /dev/sda5
. All this is largely precautionary, though; there's a good chance that the filesystem in /dev/sda1
isn't sized to the very end of /dev/sda1
, in which case resizing the partition in the way that I and rusty suggest won't cause problems. (We're both telling you to do the same thing; we just differ in the tools used to do the job.)
sudo sfdisk -d /dev/sda