After ntfsresize (ntfs resize), what is the exact line to type in for fdisk?

1

I was told that after ntfsresize (ntfs resize), the fdisk command needs to be run...

But how can it be run? What is the exact line?

In a book Knoppix Hacks, it seems to suggest needing some parameter except it is not using any in its example. Does any one know how?

Is the line:

sudo fdisk /dev/hda

all that's needed?

This is a part of that page:

alt text

nonopolarity

Posted 2009-11-21T05:12:05.527

Reputation: 7 932

Answers

2

fdisk is an interactive partition table editor, so the only argument it needs is the hard disk device you want to work on.

If you resized the partition /dev/hda1, then yes, sudo fdisk /dev/hda is all you need. Or if you resized /dev/sdb2, then you need to run sudo fdisk /dev/sdb.

Once you get fdisk running, you'll have to delete the partition you resized, then recreate it with the new size. Make the new partition slightly larger than the size you requested in the ntfsresize step.

Remember, if you don't think you've done it right, you can always quit fdisk without writing the changed partition table, and restart fresh. Don't write out the new partition table until you're sure you've gotten it right.

Here's the list of commands to use from inside fdisk:

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes          <------ use this if unsure
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit         <------ don't do this until you're certain
   x   extra functionality (experts only)

quack quixote

Posted 2009-11-21T05:12:05.527

Reputation: 37 382

Agree with @quack quixote to keep a working drive :) I seriously recommend you do it via GParted if you're in any way new to all this, because it helps avoid several nasty mistakes, even when it uses the same CLi applications under-the-hood. Otherwise here's a detailed memo to do ntfsresize+fdisk

– tuk0z – 2015-07-27T13:40:24.550

1

If you've never used fdisk at all, this might be a little scary. It's good to practice for a while without (w)riting. After you get into fdisk ("sudo fdisk /dev/hda" or "sudo fdisk /dev/sda" or "sudo fdisk /dev/hdb" or something similar depending on what disk you want to partition), use 'p' to print the partitions.

Look at them carefully. Maybe write them down. Then use 'd' to delete the partition (you'll be prompted for the partition number, which you should have identified when you (p)rinted out the partitions). Next use 'n' to create a new partition. Answer the start & size questions making sure the start is at the same place as the old partition that you just deleted. Then use 't' to set the partition's type to whatever it was before. Then do 'p' to print the partition list again. Check to see if everything looks right.

Then use 'q' to quit without making any permanent changes. Do this a few times. So long as you use 'q' to quit before ever using 'w' to write the partition table out, you will not have made any changes to the disk. So if you're not sure about the process, you can try different things, each time seeing how things turn out by using 'p' to print out how the partitions would look if written to disk.

By practicing like this you can get a feel for how fdisk works and how the partitions will look if and when you finally (w)rite the partition table out to disk. When you feel confident, then use 'w' to write the partition table to the disk. Of course, you should have a backup of your system just in case.

Marnix A. van Ammers

Posted 2009-11-21T05:12:05.527

Reputation: 1 978