[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: persistent partition



Thanks - I need to get out of having a "representative" disk because
I'll be working with many, many applications and disks. I guess I'll
have to settle for working out how to extract the information I need
from 'sfdisk -lm '

Thanks again,
David


On Mon, 2009-03-09 at 23:11 -0700, Jordan Share wrote:
> David Cottrill wrote:
> > See below - at the beginning it gets upset about the formatting and it
> > never seems to recover.
> > I'm not good enough at partitioning to be able to explain it properly.
> > fdisk has no problem and cfdisk has only a little grumble but still
> > works ok.
> > 
> > If I follow through with sfdisk it prompts me to zero the first 512b of
> > any FAT partition (the boot record). I'm not sure of how to ressurect
> > the boot sector afterwards but it certainly doesn't boot whether I zero
> > it as instructed or just ignore the warning. 
> > 
> > David
> > 
> > 
> > Debian:/# sfdisk /dev/sda
> > Checking that no-one is using this disk right now ...
> > OK
> > 
> > Disk /dev/sda: 1009 cylinders, 16 heads, 62 sectors/track
> > Old situation:
> > Warning: The partition table looks like it was made
> >   for C/H/S=*/188/22 (instead of 1009/16/62).
> > For this listing I'll assume that geometry.
> > Units = cylinders of 2117632 bytes, blocks of 1024 bytes, counting from
> > 0
> > 
> >    Device Boot Start     End   #cyls    #blocks   Id  System
> > /dev/sda1   *      0+    146-    147-    303103+  83  Linux
> > 		end: (c,h,s) expected (146,106,20) found (37,187,22)
> > /dev/sda2          0       -       0          0    0  Empty
> > /dev/sda3          0       -       0          0    0  Empty
> > /dev/sda4          0       -       0          0    0  Empty
> > Input in the following format; absent fields get a default value.
> > <start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
> > Usually you only need to specify <start> and <size> (and perhaps
> > <type>).
> > 
> > /dev/sda1 :;
> > /dev/sda1          0+   1008    1009-    500463+  83  Linux
> > /dev/sda2 :,,L
> > /dev/sda2          0       -       0          0   83  Linux
> > partition ends on cylinder 1023, beyond the end of the disk
> > /dev/sda3 :;
> > /dev/sda3          0       -       0          0    0  Empty
> > /dev/sda4 :;
> > /dev/sda4          0       -       0          0    0  Empty
> > New situation:
> > Units = cylinders of 507904 bytes, blocks of 1024 bytes, counting from 0
> > 
> >    Device Boot Start     End   #cyls    #blocks   Id  System
> > /dev/sda1          0+   1008    1009-    500463+  83  Linux
> > /dev/sda2          0       -       0          0   83  Linux
> > /dev/sda3          0       -       0          0    0  Empty
> > /dev/sda4          0       -       0          0    0  Empty
> > Warning: partition 2 has size 0 but is not marked Empty
> > Warning: no primary partition is marked bootable (active)
> > This does not matter for LILO, but the DOS MBR will not boot this disk.
> > end of partition 2 has impossible value for cylinders: 1023 (should be
> > in 0-1008)
> > I don't like this - probably you should answer No
> > Do you want to write this to disk? [ynq] 
> 
> What are you trying to do, exactly?  It looks like you accept the first 
> partition as is, and then don't specify a start for sda2, although you 
> do specify the type.  I think this is the source of your difficulties. 
> (Here is my pastie where I do your steps and get similar errors: 
> http://gist.github.com/76769 )
> 
> For sfdisk, I usually:
>     * partition once by hand (on a representative disk)
>     * sfdisk -d /dev/sda > ~/partitions.txt
>     * edit ~/partitions.txt, removing the "size = xxxx" section from the 
> partition I want to expand (assuming it is the last partition on the disk).
>     * cat ~/partitions.txt | sfdisk /dev/sda
>        * or whatever, basically dump the edited file back into sfdisk on 
> the new box.
> 
> A sample file that I use all the time is:
> # partition table of /dev/sda
> unit: sectors
> 
> /dev/sda1 : start=       63, size=   995967, Id=83
> /dev/sda2 : start=   996030, Id=8e
> /dev/sda3 : start=        0, size=        0, Id= 0
> /dev/sda4 : start=        0, size=        0, Id= 0
> 
> (Note that the "size= xxxxx" bit has been removed from sda2's 
> definition, but a start is defined.)
> 
> In this case, I am making a /boot partition at the start of the disk 
> (perhaps overly generously allocated), and then using the rest of the 
> disk as an LVM volume.  You would change the Id=xx to whatever is 
> appropriate for you.
> 
> Jordan


Reply to: