Linux - GeneralThis forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
I have a spare hard disk of 500 gigs. I am trying to creating one very large primary partition for storage and another smaller one for swap.
Using parted, I am able to create the big one and format it to ext3 with no bother. However whenever I try to add the swap it will not work.
Running parted and printing the table gives:-
Code:
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 0.51kB 465GB 465GB primary ext2
2 465GB 465GB 8225kB primary linux-swap
Clearly the swap is to small.
So, I thought I would use the GUI Gparted to have a look. I want to understand how to do this without graphical tools.
Basically Gparted showed me that the sizes being reported by parted where different. However parted will only report in Gigs and not anything.
Can anyone advise me how I can resize or more partitions using command lind tools and how I can get accurate information on things like start and end points?
This is an old problem relating to the way hard drive manufacturers label the capacity of their hard drives as opposed to the way every one else in IT determines capacity. To make a long story short, your 500GB hard drive is really only 465GB as stated in the usual definition of gigabyte.
Hard drive manufacturers use a decimal definition of 1 KB = 1000 bytes. Everyone else uses the binary definition of 1 KB = 2exp10 = 1024 bytes. The net result is that as far as your OS is concerned, your hard drive is about 7% less than the size stated by the hard drive manufacturer(.93 x 500 = 465). It gets more confusing because you can never be really sure whether a given tool is using binary or decimal as many have been changed to deal with the hard drive manufacturer's labeling practices. Here's a more lengthy explanation:
I managed to get a working setup using cfdisk which was very nice. However I would really like to be able to go more low level and do it myself for situations at work on cranky old servers which have been stripped down to the nuts and dont have these new fangled curses and gui based tools. GParted is very nice to use but frankly I need to be able to figure it out without a gui.
I guess, that if an accurate disk capacity can be gained from a tool then this would allow fdisk or parted to work correctly then as it all seems to stem from knowing the initial size.
I guess, that if an accurate disk capacity can be gained from a tool then this would allow fdisk or parted to work correctly then as it all seems to stem from knowing the initial size.
I would be *most* surprised if either fdisk or parted are getting the actual size of the device wrong.
The fact that you (still) don't understand the situation is (much) more likely the problem.
Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders, total 488281250 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xe686f016
Device Boot Start End Blocks Id System
/dev/sda1 63 96389 48163+ de Dell Utility
/dev/sda2 * 96390 84003884 41953747+ 7 HPFS/NTFS
/dev/sda3 84003885 478528154 197262135 f W95 Ext'd (LBA)
/dev/sda4 478528155 488263544 4867695 db CP/M / CTOS / ...
/dev/sda5 84003948 167911379 41953716 7 HPFS/NTFS
/dev/sda6 167911443 251818874 41953716 6 FAT16
/dev/sda7 251818938 335726369 41953716 83 Linux
/dev/sda8 335726433 419633864 41953716 83 Linux
/dev/sda9 419633928 423826829 2096451 82 Linux swap
/dev/sda10 423826893 434317274 5245191 b W95 FAT32
/dev/sda11 434317338 478528154 22105408+ 83 Linux
The output of fdisk -lu gives all the information you need.
"Disk /dev/sda: 250.0 GB, 250000000000 bytes" is the disk size in gigabytes (250 x 10^9). Note that this is different to the size in Gibibyte 250000000000/1024/1024/1024 = 232.830643654 GiB
"255 heads, 63 sectors/track, 30394 cylinders, total 488281250 sectors
Units = sectors of 1 * 512 = 512 bytes" gives the disk layout for addressing and the units for the Start and End columns in the table. The Blocks column shows standard Linux disk blocks of 1024bytes.
The layout of the disk is:
Sector 0 to 62 (Master Boot Record) which is not shown.
Sector 63 to 96389 First primary partition containing Dell Utility (plus after Blocks indicates that this partition does not finish on a cylinder boundary)
Sector 96390 to 84003884 Second primary partition containing Windows (asterisk denotes boot partition, plus after Blocks indicates that this partition does not start on a cylinder boundary)
Sector 84003885 to 478528154 Extended partition containing logical volumes.
Sector 478528155 to 488263544 Third primary partition that I believe contains the disk image for restore of Windows partition from restore CD provided at purchase.
Note the gap between the start of the Extended partition and the start of the first logical volume from Sector 84003885 to 84003947. This is the location of the extended partition table.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.