diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index e7dc26794c..9f7af06a4e 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -2365,9 +2365,15 @@ int home_create_luks( image_sector_size = UINT32_MAX; /* Let cryptsetup decide if the sector size is not specified in home record */ luks_sector_size = 0; - } else - luks_sector_size = image_sector_size = user_record_luks_sector_size(h); - + } else { + if (S_ISBLK(st.st_mode)) { + /* For physical block devices always use the actual device logical + * sector size. Else the partition will not be discoverable by kernel. */ + image_sector_size = UINT32_MAX; + luks_sector_size = user_record_luks_sector_size(h); + } else + image_sector_size = luks_sector_size = user_record_luks_sector_size(h); + } r = make_partition_table( setup->image_fd, image_sector_size,