Rudd-O / zfs-fedora-installer

Fedora on ZFS root installer
35 stars 6 forks source link

problem with partitioning #2

Closed seriv closed 11 years ago

seriv commented 11 years ago

I was not able to get script working with real disks. It fails on the partition step:

[seriv@seriv zfs-fedora-installer]$ sudo ./install-fedora-on-zfs --pool-name my4 \
 --root-password 123456 /dev/sde
DEBUG:root:Running ['fdisk', '/dev/sde'] in cwd '/home/seriv/git/zfs-fedora-installer'
Welcome to fdisk (util-linux 2.22.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-7913471, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-7913471, default 7913471): Partition 1 of type Linux and of size 256 MiB is set

Command (m for help): Command (m for help): Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): Partition number (1-4, default 2): First sector (526336-7913471, default 526336): Using default value 526336
Last sector, +sectors or +size{K,M,G} (526336-7913471, default 7913471): Using default value 7913471
Partition 2 of type Linux and of size 3.5 GiB is set

Command (m for help): 
Disk /dev/sde: 4051 MB, 4051697664 bytes, 7913472 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b3a9e

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1            2048      526335      262144   83  Linux
/dev/sde2          526336     7913471     3693568   83  Linux

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
Traceback (most recent call last):
  File "./install-fedora-on-zfs", line 555, in <module>
    sys.exit(main())
  File "./install-fedora-on-zfs", line 550, in main
    args.swapsize, args.releasever, args.lukspassword, cleanup
  File "./install-fedora-on-zfs", line 235, in install_fedora
    assert 0, "partition 1 in device %r failed to be created"%voldev
AssertionError: partition 1 in device '/dev/sde' failed to be created
Rudd-O commented 11 years ago

Can you retry the operation but printing the content of the pertinent variable right before line 235? There should be a /dev/sde1 after thes process has executed Can you verify this is the case? Thanks. Let's collaborate on a reliabli bugfix.

seriv commented 11 years ago

Hi,

I added print command and got:

[seriv@localhost zfs-fedora-installer]$ git diff

diff --git a/install-fedora-on-zfs b/install-fedora-on-zfs index 0ff376a..e813aa9 100755 --- a/install-fedora-on-zfs +++ b/install-fedora-on-zfs @@ -232,6 +232,7 @@ def install_fedora(voldev, volsize, bootdev=None, bootsize=256, if not os.path.exists(bootpart): bootpart = voldev + "p1" if not os.path.exists(bootpart):

[seriv@localhost zfs-fedora-installer]$ sudo ./install-fedora-on-zfs /dev/sdb DEBUG:root:Running ['fdisk', '/dev/sdb'] in cwd '/home/seriv/work/zfs-fedora-installer' Welcome to fdisk (util-linux 2.22.2).

Changes will remain in memory only, until you decide to write them. Be careful before using the write command.

Command (m for help): Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): Partition number (1-4, default 3): Partition 1 is already defined. Delete it before re-adding it.

Command (m for help): Command (m for help): +: unknown command 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 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 x extra functionality (experts only)

Command (m for help): Command (m for help): Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): Partition number (1-4, default 3): Partition 2 is already defined. Delete it before re-adding it.

Command (m for help): Command (m for help): Command (m for help): Disk /dev/sdb: 16.0 GB, 16008609792 bytes, 31266816 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

Device Boot Start End Blocks Id System /dev/sdb1 2048 526335 262144 83 Linux /dev/sdb2 526336 31266815 15370240 83 Linux

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table. Syncing disks. bootpart=/dev/sdbp1 Traceback (most recent call last): File "./install-fedora-on-zfs", line 556, in sys.exit(main()) File "./install-fedora-on-zfs", line 551, in main args.swapsize, args.releasever, args.lukspassword, cleanup File "./install-fedora-on-zfs", line 236, in install_fedora assert 0, "partition 1 in device %r failed to be created"%voldev AssertionError: partition 1 in device '/dev/sdb' failed to be created


So, I in my case just omitting "p" would help, like:


         bootpart = bootdev + "-part1"
         if not os.path.exists(bootpart):

Regards,

Sergey Ivanov.

On Sun, Apr 21, 2013 at 1:04 AM, Rudd-O notifications@github.com wrote:

Can you retry the operation but printing the content of the pertinent variable right before line 235? There should be a /dev/sde1 after thes process has executed Can you verify this is the case? Thanks. Let's collaborate on a reliabli bugfix.

— Reply to this email directly or view it on GitHubhttps://github.com/Rudd-O/zfs-fedora-installer/issues/2#issuecomment-16716133 .

Regards, Sergey Ivanov | 443-844-6318 | sergey57@gmail.com http://www.linkedin.com/pub/sergey-ivanov/8/270/a09

seriv commented 11 years ago

I think this issue should be closed. I have tried with read block devices, and they have in Fedora entries under /dev/disk/by-id directory, not just /dev/sd?. And with /dev/disk/by-id/ the script has no problems creating partitions.

Rudd-O commented 11 years ago

Found yyour bug!!! I will be pushing a commit to fix it soon :-) You were right, FWIW.