diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
index 759b455..4d7d3dc 100644
--- a/payload_consumer/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -57,42 +57,6 @@
   }
   install_plan_ = GetInputObject();
 
-  // For delta updates (major version 1) we need to populate the source
-  // partition hash if not pre-populated.
-  if (install_plan_.payload_type == InstallPayloadType::kDelta &&
-      install_plan_.partitions.empty() &&
-      verifier_mode_ == VerifierMode::kComputeSourceHash &&
-      DeltaPerformer::kSupportedMinorPayloadVersion <
-          kOpSrcHashMinorPayloadVersion) {
-    LOG(INFO) << "Using legacy partition names.";
-    InstallPlan::Partition part;
-    string part_path;
-
-    part.name = kLegacyPartitionNameRoot;
-    if (!boot_control_->GetPartitionDevice(
-        part.name, install_plan_.source_slot, &part_path))
-      return;
-    int block_count = 0, block_size = 0;
-    if (utils::GetFilesystemSize(part_path, &block_count, &block_size)) {
-      part.source_size = static_cast<int64_t>(block_count) * block_size;
-      LOG(INFO) << "Partition " << part.name << " size: " << part.source_size
-                << " bytes (" << block_count << "x" << block_size << ").";
-    }
-    install_plan_.partitions.push_back(part);
-
-    part.name = kLegacyPartitionNameKernel;
-    if (!boot_control_->GetPartitionDevice(
-        part.name, install_plan_.source_slot, &part_path))
-      return;
-    off_t kernel_part_size = utils::FileSize(part_path);
-    if (kernel_part_size < 0)
-      return;
-    LOG(INFO) << "Partition " << part.name << " size: " << kernel_part_size
-              << " bytes.";
-    part.source_size = kernel_part_size;
-    install_plan_.partitions.push_back(part);
-  }
-
   if (install_plan_.partitions.empty()) {
     LOG(INFO) << "No partitions to verify.";
     if (HasOutputPipe())
diff --git a/payload_consumer/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc
index 1b5d32a..fdc94d9 100644
--- a/payload_consumer/filesystem_verifier_action_unittest.cc
+++ b/payload_consumer/filesystem_verifier_action_unittest.cc
@@ -327,54 +327,4 @@
   while (loop_.RunOnce(false)) {}
 }
 
-// Disabled as we switched to minor version 3, so this test is obsolete, will be
-// deleted when we delete the corresponding code in PerformAction().
-// Test that the rootfs and kernel size used for hashing in delta payloads for
-// major version 1 is properly read.
-TEST_F(FilesystemVerifierActionTest,
-       DISABLED_RunAsRootDetermineLegacySizeTest) {
-  string img;
-  EXPECT_TRUE(utils::MakeTempFile("img.XXXXXX", &img, nullptr));
-  ScopedPathUnlinker img_unlinker(img);
-  test_utils::CreateExtImageAtPath(img, nullptr);
-  // Extend the "partition" holding the file system from 10MiB to 20MiB.
-  EXPECT_EQ(0, truncate(img.c_str(), 20 * 1024 * 1024));
-
-  InstallPlan install_plan;
-  install_plan.source_slot = 1;
-
-  fake_boot_control_.SetPartitionDevice(
-      kLegacyPartitionNameRoot, install_plan.source_slot, img);
-  fake_boot_control_.SetPartitionDevice(
-      kLegacyPartitionNameKernel, install_plan.source_slot, img);
-  FilesystemVerifierAction action(&fake_boot_control_,
-                                  VerifierMode::kComputeSourceHash);
-
-  ObjectFeederAction<InstallPlan> feeder_action;
-  feeder_action.set_obj(install_plan);
-
-  ObjectCollectorAction<InstallPlan> collector_action;
-
-  BondActions(&feeder_action, &action);
-  BondActions(&action, &collector_action);
-  ActionProcessor processor;
-  processor.EnqueueAction(&feeder_action);
-  processor.EnqueueAction(&action);
-  processor.EnqueueAction(&collector_action);
-
-  loop_.PostTask(FROM_HERE,
-                 base::Bind([&processor]{ processor.StartProcessing(); }));
-  loop_.Run();
-  install_plan = collector_action.object();
-
-  ASSERT_EQ(2U, install_plan.partitions.size());
-  // When computing the size of the rootfs on legacy delta updates we use the
-  // size of the filesystem, but when updating the kernel we use the whole
-  // partition.
-  EXPECT_EQ(10U << 20, install_plan.partitions[0].source_size);
-  EXPECT_EQ(kLegacyPartitionNameRoot, install_plan.partitions[0].name);
-  EXPECT_EQ(20U << 20, install_plan.partitions[1].source_size);
-  EXPECT_EQ(kLegacyPartitionNameKernel, install_plan.partitions[1].name);
-}
-
 }  // namespace chromeos_update_engine
