Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I have the unfortunate situation of a hard disk with bad sectors, these showed up when I tried to resize my NTFS (WinXP) partition. I believe they're from a Partition Magic resizing gone bad (even though I've since completely wiped out that partition and reinstalled Windows). Anyway, GParted didn't want to resize because of these bad sectors, and recommended I run the chkdsk command under Windows and reboot. This I did, but still got the errors. Upon looking closer, I saw that the ntfsresize command needed to be run with the -b option. I did this manually, and successfully resized to 10240 MB (10 GB). BUT, now GParted shows the disk still at 20 GB, and says 15 GB are full! What to do??? When I ran the ntfsresize command it mentioned something about using fdisk to reduce the size of the partition, but I didn't understand.
As you can guess, I'm pretty much a newbie to command line stuff, I'm not afraid of it but if directing me to use such please give complete directions.
Thanks
pb
If you wish to enlarge a filesystem, you must first make sure you can expand the size of the underlying partition first.Now expand the file system.
If you wish to shrink ,first shrink the size of filesystem. Then you may use fdisk to shrink the size of the partition. When shrinking the size of the partition, make sure you do not make it smaller than the new size of the filesystem!
When u create a partition using fdisk , does it hold a file system by default?No
They are empty or raw partitions.Then u will format it with a file system like ext2 or vfat.Similarly when u resize u have to resize both of them.
So u shrinked the file system and u have to shrink the partition now.
I think u will understand it now.
Well, I understand that I need to shrink the partition, but I don't know how to do this. I've looked at the fdisk man page, but still can't understand. Please help!
The concept is simple - the partition table entry merely describes the partition; basically start and size. You delete the partition entry (doesn't affect the data), then define a new (smaller in your case) partition starting at the same location.
Needs to be no smaller than the filesystem you resized.
Try the FAQ at linux-ntfs.org - seems to be offline at present, but has a bit more detail about how to do this safely.
hi,
u can use both fdisk and parted for the purpose.parted is easy.
like syg00 said,
Quote:
define a new (smaller in your case) partition starting at the same location
its too important.
when use fdisk note the start cylinder of the partition u wish to resize, then delete it and recreate the partition with the same cylinder as start and the end cylinder is ur desired size.
parted on the other hand is too easy.
give the command ,
parted /dev/sda
where sda is ur hard disk name
then give command print, it will print partition structure in easy format
mine is,
(parted) print
Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
No cylinder infn, for our easy doing.Then use resize command to resize the partition u like.
from parted help,
Quote:
resize NUMBER START END resize partition NUMBER and its file
system
NUMBER is the partition number used by Linux. On MS-DOS disk labels,
the primary partitions number from 1 to 4, logical partitions from 5
onwards.
START and END are disk locations, such as 4GB or 10%. Negative values
count from the end of the disk. For example, -1s specifies exactly the
last sector.
The partition must have one of the following FS-TYPEs: ext3, ext2,
fat32, fat16, hfsx, hfs+, hfs, linux-swap
suppose if i like resize mu 10th partition(10 63.1GB 80.0GB 16.9GB logical),
i have to do,
Well, I managed to get the partition resized using fdisk, here are the commands I used (from another page I found):
Code:
# fdisk /dev/hda
Command (m for help): p
Command (m for help): d
Partition number (1-4): 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (8-3648, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (8-3648, default 3648): +10240M
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)
Command (m for help): a
Partition number (1-4): 1
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1246 10008463+ 7 HPFS/NTFS
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Command (m for help):q
Just thought this might be useful for someone else, searching though the forums...
pb
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.