Reassembling Disk Partitions from Separate Images in Linux

Abstract: Reassemble split disk partition images into a single raw file using cat to preserve sector layout and enable mounting or restoration.

Created: 2026-10-07 by

To reassemble separate disk partition images into a coherent whole in Linux, use the cat command with explicit file ordering to concatenate the binary data streams. This approach creates a single raw image file that preserves the original sector layout and partition boundaries without introducing padding errors or corruption.

When dealing with fragmented disk backups, such as those split by tools like dd with bs=1M limits or specialized imaging software, you often end up with multiple small files (e.g., disk.img.01, disk.img.02). The goal is to merge these back into a single logical drive image so you can mount it, inspect the filesystem, or restore it to hardware. The previous advice suggesting complex piping methods was flawed because it ignored strict byte-level alignment. Correct reassembly requires treating each chunk as a contiguous block of bytes in the exact order they appeared on the source media.

Understanding Disk Image Structure

Before merging files, it is crucial to understand what you are working with. A raw disk image is a bit-for-bit copy of a storage device. It contains the Master Boot Record (MBR) or GUID Partition Table (GPT) at the very beginning, followed immediately by the partition data. If you simply concatenate files without ensuring they represent sequential sectors, you will create a "Frankenstein" image where partition tables point to invalid memory addresses, leading to read errors or complete data loss. The most common scenario involves images created by splitting a large file. For example, if you ran dd if=/dev/sda of=disk.img bs=1M and the system ran out of space, resulting in disk.img.01, disk.img.02, etc., these files are direct slices of the original stream. They do not contain headers or footers; they are pure data. Therefore, the reassembly process is strictly linear. You must ensure that .01 comes first, followed by .02, and so on. Any deviation in this sequence shifts all subsequent partition offsets, rendering the partition table unreadable by standard Linux tools like fdisk or parted.

Step-by-Step Reassembly Process

The safest and most reliable method for reassembling these images is using the cat utility. This command reads files sequentially and writes their contents to standard output. By redirecting this output to a new file, you reconstruct the original binary stream. First, navigate to the directory containing your split image parts. Ensure you have sufficient free space on your destination drive to hold the fully reassembled image. Then, execute the concatenation command. You must list the files in ascending numerical order.
cat disk.img.01 disk.img.02 disk.img.03 > reassembled_disk.img
This command reads the first part, appends the second, then the third, and writes the combined result to reassembled_disk.img. It is critical to verify the order. If your files are named with zero-padded numbers (e.g., 001, 002), shell globbing patterns like *.img might sort them alphabetically in a way that breaks the sequence if not handled carefully. Always specify the filenames explicitly if there is any doubt about the sorting order. After the command completes, verify the integrity of the new image. Check the file size against the sum of the individual parts. If disk.img.01 is 1GB, .02 is 1GB, and .03 is 500MB, the final image must be exactly 2.5GB. Use the ls -lh command to confirm the total size matches expectations. A mismatch indicates missing files or incorrect concatenation order.

Validating the Partition Table

Once the image is assembled, you need to confirm that the partition table is intact before attempting to mount any partitions. Use fdisk to inspect the structure. Run the following command, replacing reassembled_disk.img with your actual filename:
sudo fdisk -l reassembled_disk.img
If successful, fdisk will display the partition table, showing start and end sectors for each partition. You should see entries like /dev/sda1 or /dev/sda2 with specific file system types (e.g., Linux filesystem, Windows NTFS). If fdisk reports an error or shows no partitions, the reassembly failed, likely due to wrong file order or corrupted chunks. In this case, do not attempt to mount anything, as doing so could overwrite data. If the partition table looks correct, you can proceed to mount individual partitions. However, mounting a partition from a disk image requires mapping it to a loop device. You cannot mount the entire image directly unless it contains only one partition and no boot sector conflicts. Instead, identify the starting sector of the desired partition from the fdisk output. Calculate the offset by multiplying the start sector by the sector size (usually 512 bytes). Then, use losetup to create a loop device with the correct offset:
sudo losetup -o 1048576 /dev/loop0 reassembled_disk.img
sudo mount /dev/loop0 /mnt/recovery
In this example, -o 1048576 specifies a 2048-sector offset (2048 * 512 = 1048576). Adjust the offset value based on your specific partition's start sector. Once mounted, you can copy your data off the drive. Remember to unmount and detach the loop device when finished to prevent data corruption.

Common Pitfalls and Verification

One frequent mistake is assuming that file names imply order without verification. Always double-check the sequence. Another issue arises with sparse files. If your original images were created as sparse files, cat will expand them, potentially consuming more disk space than expected. To save space, you can use tar with compression during the initial backup phase, but for reassembly of raw dd images, simple concatenation is best. Additionally, always work on copies. Never modify the original split image files until you have verified the reassembled image works correctly. If you encounter checksum mismatches during recovery, refer to guides on handling corrupted filesystems. For instance, if you are dealing with BTRFS, you may need to run checksum verification tools after mounting. Also, once your data is safe, remember that your system configuration files like /etc/fstab might need updates if you plan to boot from the restored drive or integrate it permanently.

Frequently Asked Questions

Can I use rsync to reassemble split images?

No, rsync is designed for synchronizing directories and transferring files over networks, not for concatenating binary data streams. Using rsync would treat each chunk as a separate file rather than a continuous block of disk data, resulting in a broken image. Stick to cat or dd for this task.

What if my image files have different extensions?

If your split images have different extensions (e.g., .img.gz vs .img), you must decompress them first or use appropriate filters. cat does not handle compression transparently. You should gunzip the compressed files into temporary uncompressed files before concatenating them, or use zcat alongside cat if mixing compressed and uncompressed parts, though this is rare and risky.

How do I know which partition number to mount?

Use fdisk -l on the reassembled image to view the partition table. Look for the "Start" column. The partition number corresponds to the entry listed (e.g., sda1, sda2). When using losetup, calculate the byte offset from the "Start" sector value multiplied by 512. Do not guess the partition number; rely on the output of fdisk.

Is it safe to delete the original split image files after reassembly?

Yes, once you have verified that the reassembled image mounts correctly and contains all your data, you can safely delete the original split chunks to free up space. However, always keep a backup of the reassembled image itself until you have successfully recovered all necessary files. Deleting the source is only safe after confirming the target is valid.

What should I do if fdisk shows no partitions?

If fdisk reports no partition table, the reassembly order is likely incorrect, or the image is corrupted. Verify that you concatenated the files in the exact numerical order they were created. Check the file sizes to ensure no chunks are missing. If the order is correct, the source disk may have been uninitialized or the image creation failed midway. In such cases, you may need to recover the partition table using tools like testdisk.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More