Slackware This Forum is for the discussion of Slackware Linux.
|
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
07-29-2006, 03:03 PM
|
#16
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
A question. When you overwrite the partition table while running, do the changes show up in /proc/partitions ?
Note that logical cylinder boundary is not the same as logical partition.
If you are using an extended partition then you need to take into account that the partition table in the MBR will only hold the address of the sector where the extended partition info is kept. This extra sector must be counted in the total.
The cylinder boundaries affect the final sector even if the disk is not full. They come from the mismatch between the byte capacity of one or more full cylinders. If you choose a partiton 1MB smaller, say, the last two sectors would be 'skipped' as partition capacity but counted in the total number of sectors. The new partition begins on a cylinder boundary not on the next unclaimed sector.
|
|
|
07-29-2006, 03:32 PM
|
#17
|
Senior Member
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
|
Quote:
Originally Posted by gnashley
Several things I see:
You have a null number of sectors for the first partition.
The partitions are mixed physically and logically -as if some had been created, then some removed or resized or recreated.
Logical cylinder boundaries. One of the things that sucks about DOS fdisk is that you can't be very specicfic about partition sizes -some sizes are uncreatable. Linux tools are better of course, they'll warn you sometimes like this:
'number of heads/tracks/sectors doesn't match logical cylinder boundaries'
If the point is to 'occupy' all the available space on the disk, then you need to get down to block-size also so you can ask for the proper number of K's for the partition. Most of choose a 'rounded' size like 100MB or 128MB. The logical cylinder boundaries may not match these fiures. When they don't, the last unused sectors are skipped. The next partition starts at a new logical cylinder boundary.
If you want to see how sfdisk or whatever does it you could try reading the sources.
|
I would add to this that you should make a point of defining new partitions on integral cylinder boundaries and avoid using every last bit of space.
|
|
|
07-29-2006, 04:19 PM
|
#18
|
Senior Member
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191
Original Poster
Rep:
|
Thanks, cwwilson721!
I added your warning to the top post.
Also, I made a pretty large mistake in my proof by evaluating when I shouldn't have. The resulting equation was one that only worked for my specific disk. I have fixed both the equation and the proof.
Also, thanks gnashley and Randux!
I will head this advice. Although this is probably more math then I feel like doing at the moment. Maybe in a few days I will give it a shot.
...drkstr
regards,
...drkstr
Last edited by drkstr; 07-29-2006 at 04:22 PM.
|
|
|
07-29-2006, 04:23 PM
|
#19
|
Senior Member
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649
Rep:
|
Thanks. I just thought that needed to be said for such low-level hdd mucking about.
But was serious about the pizza....lol
|
|
|
07-29-2006, 04:32 PM
|
#20
|
Senior Member
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191
Original Poster
Rep:
|
Quote:
A question. When you overwrite the partition table while running, do the changes show up in /proc/partitions ?
|
No, the host system cache's the partition table as you said, which is fine. I don't need the host system to see the new table, as long as I can access it. All I need to do is force the change (while live), do a few things, restore the original, then reboot (hopefully back to the original working system). I'm not sure if the reboot is necessary, but couldn't hurt.
regards,
...drkstr
|
|
|
07-30-2006, 11:29 AM
|
#21
|
Senior Member
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
|
Did somebody say something about pizza? I'll bring the brewskies.
|
|
|
07-31-2006, 10:04 AM
|
#22
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
here's some output from a couple of disks. If you are writing code that is gonna process output from sfdisk. You need to understand that all these programs write the info in hexcode and that linux uses a DOS-type partition table. So, the tools have to follow some rules that are governed by that and write info which is useful to other programs which may not do the same thing. I mean, you can write a DOS table with partition info that can be read and used by a linux program, but not by DOS or Windows or MacOS.
Finding out which sector is the last used is easy enough. But knowing why that is, or should or must be is fifferent. Some tools only create partitions the way they 'should' be. Others create them the they 'must' -letting you specify. Others do the 'best thing' for you if you leave them alone -this means that for creating partitions there is no better tool than linux fdisk. But that doesn't help if you are working with already created partitions.
bash-3.00# sfdisk -l /dev/hdc
Disk /dev/hdc: 9733 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/hdc1 * 0+ 126 127- 1020096 b W95 FAT32
/dev/hdc2 127 9732 9606 77160195 f W95 Ext'd (LBA)
/dev/hdc3 0 - 0 0 0 Empty
/dev/hdc4 0 - 0 0 0 Empty
/dev/hdc5 127+ 381 255- 2048256 b W95 FAT32
/dev/hdc6 382+ 1034 653- 5245191 b W95 FAT32
/dev/hdc7 1035+ 3358 2324- 18667498+ 83 Linux
start: (c,h,s) expected (1023,254,63) found (1023,1,1)
/dev/hdc8 3359+ 9732 6374- 51199123+ 83 Linux
start: (c,h,s) expected (1023,254,63) found (1023,1,1)
bash-3.00# sfdisk -d /dev/hdc
# partition table of /dev/hdc
unit: sectors
/dev/hdc1 : start= 63, size= 2040192, Id= b, bootable
/dev/hdc2 : start= 2040255, size=154320390, Id= f
/dev/hdc3 : start= 0, size= 0, Id= 0
/dev/hdc4 : start= 0, size= 0, Id= 0
/dev/hdc5 : start= 2040318, size= 4096512, Id= b
/dev/hdc6 : start= 6136893, size= 10490382, Id= b
/dev/hdc7 : start= 16627338, size= 37334997, Id=83
/dev/hdc8 : start= 53962398, size=102398247, Id=83
bash-3.00# fdisk -l /dev/hdc
Disk /dev/hdc: 80.0 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 127 1020096 b W95 FAT32
/dev/hdc2 128 9733 77160195 f W95 Ext'd (LBA)
/dev/hdc5 128 382 2048256 b W95 FAT32
/dev/hdc6 383 1035 5245191 b W95 FAT32
/dev/hdc7 1036 3359 18667498+ 83 Linux
/dev/hdc8 3360 9733 51199123+ 83 Linux
bash-3.00# sfdisk -d /dev/hda
# partition table of /dev/hda
unit: sectors
/dev/hda1 : start= 63, size= 2000817, Id= c, bootable
/dev/hda2 : start= 2000880, size= 4305168, Id=83
/dev/hda3 : start= 0, size= 0, Id= 0
/dev/hda4 : start= 0, size= 0, Id= 0
bash-3.00# sfdisk -l /dev/hda |grep Disk
Warning: The partition table looks like it was made
for C/H/S=*/16/63 (instead of 782/128/63).
For this listing I'll assume that geometry.
Disk /dev/hda: 782 cylinders, 128 heads, 63 sectors/track
bash-3.00# fdisk -l /dev/hda
Disk /dev/hda: 3228 MB, 3228696576 bytes
16 heads, 63 sectors/track, 6256 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1985 1000408+ c W95 FAT32 (LBA)
/dev/hda2 1986 6256 2152584 83 Linux
|
|
|
08-01-2006, 02:01 AM
|
#23
|
Senior Member
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191
Original Poster
Rep:
|
Thanks a bunch gnashley!
I have a lack of disks to test this on so your output is very usefull. This got me thinking, it would probably be pretty usefull to start a thread asking for as many people who are willing to just post their output. I would like to be able to look at as many different partition tables that I can.
I'm going to go pop one in the software forum, it will be interesting to see how many people respond.
thanks!
...drkstr
|
|
|
All times are GMT -5. The time now is 07:33 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|