Attempting to install TWRP on my new OnePlus device, as I believe this is the best way to make an initial backup of the stock ROM before flashing, so far so good?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
You're on the right track! Installing TWRP (Team Win Recovery Project) is a common and effective way to back up your stock ROM and gain more control over your OnePlus device. Here’s a quick overview to ensure you’re on the right path and to help you avoid potential pitfalls:
Steps to Install TWRP and Back Up Stock ROM:
Unlock Bootloader:
Before installing TWRP, you need to unlock your OnePlus device's bootloader. This process varies slightly depending on your OnePlus model, but generally involves:
Enabling Developer Options and OEM Unlocking in your device settings.
Using the fastboot command to unlock the bootloader. Be aware that this will factory reset your device.
Download TWRP:
Visit the official TWRP website and download the correct TWRP image for your specific OnePlus model.
Install TWRP:
Boot your device into Fastboot mode (usually by holding Volume Up + Power or Volume Down + Power).
Connect your device to your computer and use the fastboot flash recovery twrp.img command to flash TWRP.
Replace twrp.img with the actual filename of the TWRP image you downloaded.
Boot into TWRP:
After flashing TWRP, use the fastboot reboot recovery command to boot into TWRP.
Back Up Stock ROM:
Once in TWRP, go to Backup and select the partitions you want to back up (usually Boot, System, Data, and Vendor).
Swipe to start the backup process. TWRP will save the backup to your device’s internal storage or an external SD card, depending on your selection.
Optional: Flash Custom ROM or Mods:
If you plan to flash a custom ROM or mods, now is the time to do so. However, since you’re focusing on backing up the stock ROM, you can skip this step for now.
Important Considerations:
Warranty: Unlocking the bootloader and installing TWRP will likely void your warranty. Make sure you’re comfortable with this before proceeding.
Data Loss: Unlocking the bootloader will factory reset your device, so back up any important data beforehand.
Model Specifics: OnePlus devices can have slightly different procedures, especially newer models. Always refer to model-specific guides or forums (like XDA Developers) for detailed instructions.
Rooting: Installing TWRP doesn’t automatically root your device. If you want root access, you’ll need to flash a root file (like Magisk) after installing TWRP.
Final Thoughts:
You’re on the right track, but take your time and double-check each step, especially when dealing with bootloader unlocking and flashing. If you’re unsure about any step, there are plenty of resources and communities (like XDA) that can provide model-specific guidance. Good luck, and enjoy the flexibility TWRP brings to your OnePlus device!
User
Now, there's a warning on the TWRP page for my device (OnePlus 5), that I'm not sure I understand clearly:
This device uses dm-verity!
This means that swiping to allow system modifications will prevent you from being able to boot if you are using the stock kernel. In order to bypass dm-verity's boot prevention, you will have to install a kernel that has dm-verity disabled in the fstab.
Assistant
The warning on the TWRP page for your OnePlus 5 regarding dm-verity is an important one to understand, as it can affect your device's ability to boot if not handled properly. Let’s break it down clearly:
What is dm-verity?
dm-verity (Device Mapper Verification) is a security feature in Android that verifies the integrity of the system partition. It ensures that the system files haven’t been tampered with (e.g., by rooting or flashing custom ROMs). If dm-verity detects modifications, it will prevent the device from booting to protect against potentially malicious changes.
Why Does This Matter for TWRP?
When you use TWRP to make system modifications (like flashing a custom ROM, kernel, or mods), dm-verity will detect these changes and prevent your device from booting. This is why the warning mentions that swiping to allow system modifications in TWRP will prevent you from booting if you’re using the stock kernel.
How to Bypass dm-verity?
To avoid boot issues, you need to disable dm-verity. There are two main ways to do this:
1. Install a Kernel with dm-verity Disabled
The warning suggests installing a custom kernel that has dm-verity disabled in its fstab (filesystem table). Many custom kernels for the OnePlus 5 come with dm-verity disabled by default.
Popular kernels like ElementalX, FrancoKernel, or Mishaal Kernel often include this feature. Flash the kernel via TWRP after installing TWRP itself.
2. Patch the Stock Kernel
If you want to keep the stock kernel, you can use tools like Magisk or Kernel Auditor to patch the kernel and disable dm-verity.
Magisk is the most user-friendly option. It installs as a systemless root solution and includes a dm-verity/ForceEncrypt disabler.
Steps to Safely Proceed:
Install TWRP: Follow the steps you’ve already taken to install TWRP.
Download a Custom Kernel: Find a custom kernel for the OnePlus 5 that has dm-verity disabled (check XDA forums for recommendations).
Flash the Custom Kernel: Boot into TWRP, go to Install, and flash the custom kernel ZIP file.
Disable dm-verity in TWRP: After flashing the kernel, go to (if available).
User
Is bootloader and fastboot the same here? I just saw on both LineageOS and TWRP on the instructions for my device that running adb reboot bootloader would boot into fastboot, but I thought they were different..
Assistant
You're correct to be confused, as the terms bootloader, fastboot, and ADB are related but refer to different things. Let’s clarify these concepts:
1. Bootloader
The bootloader is a low-level piece of software that runs when you power on your device. Its primary job is to load the operating system (Android, in this case) into memory. The bootloader is the first stage of the boot process and is responsible for initializing the hardware and loading the kernel.
Locked vs. Unlocked Bootloader: Most devices come with a locked bootloader to prevent unauthorized modifications. Unlocking it allows you to flash custom recoveries (like TWRP), custom ROMs (like LineageOS), or custom kernels.
2. Fastboot
Fastboot is a protocol and tool that comes with the Android SDK (Software Development Kit). It allows you to communicate with the bootloader on your device when it’s in Fastboot Mode. Fastboot Mode is a specific state where the bootloader is waiting for commands from a computer via USB.
fastboot oem unlock: Unlock the bootloader (if supported).
How to Enter Fastboot Mode:
Power off your device.
Hold a specific key combination (e.g., Volume Down + Power for OnePlus 5) to enter Fastboot Mode.
Alternatively, use adb reboot bootloader from a computer to reboot your device into Fastboot Mode.
3. ADB (Android Debug Bridge)
ADB is another tool in the Android SDK that allows you to communicate with your device when it’s powered on and running Android. It’s used for tasks like installing apps, pulling logs, or rebooting the device into different modes.
Relevant ADB Command:
adb reboot bootloader: Reboots your device into Fastboot Mode.
Bootloader vs. Fastboot: The Relationship
The bootloader is the software running on your device when it’s in Fastboot Mode.
User
then reboot bootloader boots the bootloader but does nothing more, just sort of presenting a prompt, and this "prompt" is fastboot?
Assistant
You're very close to understanding the relationship between reboot bootloader, the bootloader, and fastboot. Let me refine your understanding:
What adb reboot bootloader Does
When you run adb reboot bootloader, it sends a command to your Android device to reboot into a special mode where the bootloader is active and waiting for instructions. This mode is commonly referred to as Fastboot Mode.
The Bootloader in Fastboot Mode
In Fastboot Mode, the bootloader is running, but it's not doing anything on its own. Instead, it's presenting a prompt (usually a minimal text interface) and waiting for commands from your computer via the fastboot protocol.
Fastboot as the Communication Tool
The fastboot protocol is the method used to communicate with the bootloader when it's in Fastboot Mode. It's a command-line tool that allows you to send commands to the bootloader, such as:
The "prompt" you see when in Fastboot Mode is essentially the bootloader waiting for fastboot commands from your computer.
Putting It All Together
adb reboot bootloader: Reboots your device into Fastboot Mode, where the bootloader is active and waiting for commands.
Fastboot Mode: The state your device is in when the bootloader is running and ready to receive fastboot commands.
Fastboot Commands: The actual instructions (e.g., fastboot flash, fastboot reboot) you send to the bootloader using the fastboot tool on your computer.
Example Workflow
Connect your OnePlus 5 to your computer via USB.
Run adb reboot bootloader to reboot into Fastboot Mode.
Your device will display a screen indicating it's in Fastboot Mode (e.g., "Fastboot Mode" or a similar message).
On your computer, use fastboot commands like fastboot devices (to check if the device is connected) or fastboot flash recovery twrp.img (to flash TWRP).
Key Takeaway
Fastboot Mode is the state where the bootloader is active and waiting for commands.
Fastboot is the tool/protocol you use to send those commands to the bootloader.
reboot bootloader is the command that puts your device into this state.
This distinction should help clarify the roles of each component in the process. Let me know if you'd like further clarification!
User
can I use fastboot to reboot into recovery?
Assistant
Yes, you can use fastboot to reboot your device directly into recovery mode. This is particularly useful if you’ve installed a custom recovery like TWRP and want to access it without using physical button combinations.
Here’s how to do it:
Command to Reboot into Recovery via Fastboot
From your computer, run the following command in the terminal or command prompt:
fastboot reboot recovery
This command tells the bootloader to reboot the device directly into recovery mode.
Steps to Use This Command
Ensure USB Debugging and OEM Unlocking Are Enabled:
Go to Settings > About Phone > Tap "Build Number" 7 times to enable Developer Options.
Go to Settings > Developer Options and enable USB Debugging and OEM Unlocking.
Connect Your Device to the Computer:
Use a USB cable to connect your OnePlus 5 to your computer.
Open a Terminal or Command Prompt:
On your computer, open a terminal (Linux/macOS) or command prompt (Windows).
Navigate to the Platform-Tools Directory (if applicable):
If you have the Android SDK installed, navigate to the platform-tools folder where fastboot is located. For example:
cd /path/to/platform-tools
Run the Fastboot Command:
Execute the following command:
fastboot reboot recovery
Device Reboots into Recovery:
Your OnePlus 5 will reboot directly into recovery mode (TWRP or stock recovery, depending on what’s installed).
Alternative Method: Using ADB
If your device is already booted into Android, you can use ADB to reboot into recovery without going through fastboot:
adb reboot recovery
This works as long as USB debugging is enabled on your device.
Important Notes
Custom Recovery Required: If you’ve installed a custom recovery like TWRP, this command will boot you into TWRP. If you’re using the stock recovery, it will boot into that instead.
Fastboot Mode vs. Recovery Mode: Fastboot mode is different from recovery mode. Fastboot mode is for low-level operations (flashing partitions, unlocking bootloader), while recovery mode is for tasks like wiping data, flashing ZIP files, or making backups.
Using fastboot reboot recovery is a convenient way to access your recovery environment without relying on physical button combinations. Let me know if you need further assistance!
User
ok, I'm in TWRP, but for it to persists (and avoid the system to replace it with the stock recovery), I need to allow system modifications, which as we assessed initially I shouldn't do..
Assistant
You're at a critical point where you need to ensure TWRP persists as your recovery, but you also want to avoid triggering dm-verity issues that could prevent your device from booting. Here’s how to handle this situation safely:
Why TWRP Gets Replaced by Stock Recovery
By default, the OnePlus 5 (and many other devices) is designed to restore the stock recovery on reboot if it detects TWRP. This is a security measure to prevent unauthorized modifications. To make TWRP persistent, you typically need to modify the system partition, which triggers dm-verity and can cause boot loops if not handled properly.
Safe Steps to Make TWRP Persistent
1. Disable dm-verity First
Before allowing system modifications in TWRP, ensure dm-verity is disabled. You can do this by:
Flashing a Custom Kernel with dm-verity disabled (e.g., ElementalX, FrancoKernel).
Using Magisk to patch the boot image and disable dm-verity.
If you haven’t done this yet, reboot back into fastboot mode and flash a custom kernel or Magisk before proceeding.
2. Use a Recovery Installer (Optional but Recommended)
For OnePlus devices, you can use a tool like TWRP Keeper (part of the OnePlus ToolKit) or Magisk to make TWRP persistent without modifying the system partition directly. These tools patch the boot image to ensure TWRP remains the default recovery.
3. Allow System Modifications in TWRP
Once dm-verity is disabled, you can safely:
Go to TWRP Settings.
Enable "Allow Modifications" by swiping the slider.
This will prevent the stock recovery from replacing TWRP on reboot.
4. Install a Custom ROM or Stay on Stock (Optional)
If you’re staying on the stock ROM, you’re done after making TWRP persistent. If you’re switching to a custom ROM like LineageOS, follow the ROM’s installation instructions.
Using Magisk to Make TWRP Persistent
Magisk is a popular and safe way to achieve this:
Download the latest Magisk ZIP from the official Magisk GitHub.
Boot into TWRP.
Tap Install and flash the Magisk ZIP file.
Magisk will patch the boot image, disable dm-verity, and ensure TWRP persists.
User
So, which partitions should I back up, so that I can safely return to stock in the future? To explain the goal, I want to eventually flash LineageOS, but I'm afraid that will break compatibility with China Telecom, as this is very possibly what I experienced with previous (Xiaomi) devices..
Assistant
Backing up the correct partitions is crucial if you want to safely return to stock in the future, especially if you’re planning to flash LineageOS and are concerned about compatibility with China Telecom. Here’s a detailed guide on which partitions to back up and how to ensure you can revert to stock if needed:
Partitions to Back Up in TWRP
To safely return to stock, you need to back up the following partitions:
Boot Partition:
Contains the kernel and ramdisk. Necessary for booting the device.
System Partition:
Contains the Android OS and its core apps. This is where custom ROMs (like LineageOS) are installed.
Vendor Partition (if available):
Contains vendor-specific files and drivers. Critical for hardware functionality, especially for carrier compatibility.
Data Partition (optional):
Contains your personal data (apps, settings, etc.). If you want to restore your data when returning to stock, back this up.
Persistence Partition (if available):
Some devices have a separate partition for persistent data. Back it up if present.
Steps to Back Up Partitions in TWRP
Boot into TWRP.
Tap Backup.
Select the partitions to back up:
Boot, System, Vendor, and optionally Data.
Choose a location for the backup (e.g., internal storage or external SD card).
Swipe to start the backup process.
Additional Steps for Returning to Stock
To ensure you can return to stock without issues:
Download Stock Firmware:
Obtain the stock firmware for your OnePlus 5 from the official OnePlus website or a trusted source.
Back Up IMEI and Other Partitions:
Some devices require backing up partitions like modem, filesystem, or persist to preserve IMEI and carrier compatibility. Check your device’s specific requirements.
User
All these partitions are overwritten if I flash a custom ROM, such as LineageOS?
Assistant
Yes, flashing a custom ROM like LineageOS will overwrite certain partitions on your device. Understanding which partitions are affected is crucial for both installing the custom ROM and reverting to stock if needed. Here’s a breakdown:
Partitions Overwritten by LineageOS
When you flash LineageOS, the following partitions are typically overwritten:
System Partition:
This is where the Android operating system resides. Flashing LineageOS replaces the stock system files with the custom ROM’s files.
Vendor Partition (sometimes):
On some devices, the vendor partition is left untouched, but on others, it may be modified or replaced. LineageOS usually includes its own vendor files, so this partition may be overwritten.
Boot Partition (if a custom kernel is included):
If the LineageOS package includes a custom kernel (which is common), the boot partition will be overwritten.
Recovery Partition (optional):
If you flash LineageOS via TWRP, the recovery partition itself isn’t overwritten. However, if you use the fastboot update method, it might replace the recovery partition.
Partitions Not Overwritten by LineageOS
The following partitions are usually not overwritten when flashing LineageOS:
Data Partition:
Your personal data (apps, settings, etc.) remains intact unless you manually wipe it during the installation process.
Internal Storage:
Files stored in /sdcard (internal storage) are not affected.
Modem/Filesystem/Persist Partitions:
These partitions, which handle IMEI, baseband, and carrier-specific data, are typically left untouched. However, always back them up as a precaution, especially if carrier compatibility is a concern.
Why Backing Up Is Essential
Since flashing LineageOS overwrites critical partitions like System and Vendor, backing them up beforehand ensures you can revert to stock if needed. Specifically:
: Allows you to restore the stock ROM.
User
I have System, System Image, Vendor, Vendor Image. The partitions with "Image" are some backups to enable resetting the phone?
Assistant
The partitions labeled with "Image" (e.g., System Image, Vendor Image) are not backups for resetting the phone. Instead, they are virtual partitions or logical representations used by TWRP to differentiate between the actual partition and its backup. Let me clarify:
What Are "System" and "System Image"?
System Partition:
This is the actual partition on your device where the Android operating system (OS) is installed. When you flash a custom ROM like LineageOS, this partition is overwritten.
System Image:
In TWRP, "System Image" refers to the backup of the System partition. When you back up the System partition, TWRP saves it as a .img file and labels it as "System Image" in the restore menu.
What Are "Vendor" and "Vendor Image"?
Vendor Partition:
This partition contains vendor-specific files, drivers, and libraries provided by the device manufacturer (OnePlus, in this case). It’s critical for hardware functionality and carrier compatibility.
Vendor Image:
Similar to "System Image," "Vendor Image" is the backup of the Vendor partition. When you back up the Vendor partition, TWRP saves it as a .img file and labels it as "Vendor Image" in the restore menu.
Why the "Image" Label?
TWRP uses the "Image" label to distinguish between:
The actual partition on your device (e.g., System, Vendor).
The backup file of that partition (e.g., System Image, Vendor Image).
This makes it clear which files are the original partitions and which are backups when restoring.
Are These Backups for Resetting the Phone?
No, these backups are not for resetting the phone. Instead, they are for:
Restoring to Stock: If you flash a custom ROM and want to revert to the stock OS, you can restore the System Image and Vendor Image backups.
Recovering from Issues: If something goes wrong (e.g., boot loop, instability), you can restore these backups to return to a working state.
User
Oh ok, I never had a phone with an A/B scheme before I think..
Assistant
Ah, that explains the confusion! Devices with an A/B partition scheme (also known as "seamless updates" or "treble-enabled devices") work differently from traditional devices. Let’s break it down for you:
What is the A/B Partition Scheme?
The A/B partition scheme is a system where the device has two sets of partitions for the OS (e.g., System, Vendor, Boot). These sets are labeled as Slot A and Slot B. Only one slot is active at a time, while the other remains inactive.
Key Features of A/B Scheme:
Seamless Updates:
When you install an OTA update, it’s installed on the inactive slot.
The next time you reboot, the device switches to the updated slot, and the old slot is ready to be overwritten.
Faster Updates:
Reduces the time required for updates since the device doesn’t need to install updates incrementally.
Fallback Mechanism:
If the update fails or causes issues, the device can revert to the previous slot on the next reboot.
How Does This Affect TWRP and Custom ROMs?
On A/B devices, TWRP handles partitions slightly differently:
System and Vendor Partitions:
There are two sets of these partitions: system_a, system_b, vendor_a, vendor_b.
When you flash a custom ROM, it typically overwrites the inactive slot (e.g., if Slot A is active, the ROM is installed on Slot B).
Boot Partition:
There’s usually a single boot partition that controls which slot is active.
TWRP may allow you to switch slots manually.
Backup and Restore:
When you back up in TWRP, it saves the partitions from the active slot.
When restoring, it restores to the same slot (unless you manually switch slots).
How to Identify if Your Device Uses A/B Scheme
For the OnePlus 5, it does not use the A/B partition scheme. It uses a traditional partition layout. However, newer OnePlus devices (e.g., OnePlus 6 and later) do use the A/B scheme.
User
ok, the backup is done. Can I transfer it to my computer through USB while in TWRP?
Assistant
Yes, you can transfer your TWRP backup to your computer via USB while in TWRP recovery. Here’s how to do it:
Steps to Transfer TWRP Backup to Your Computer via USB
1. Enable USB Debugging (Optional but Recommended)
If you haven’t already, enable USB debugging on your OnePlus 5:
Go to Settings > About Phone > Tap "Build Number" 7 times to enable Developer Options.
Go to Settings > Developer Options and enable USB Debugging.
2. Connect Your Device to the Computer
Use a USB cable to connect your OnePlus 5 to your computer.
3. Enable USB Storage in TWRP
In TWRP, tap the USB icon (usually at the top right corner).
On your computer, a prompt may appear asking whether to allow USB debugging. Click Allow.
TWRP will mount the device’s storage as a USB drive on your computer.
4. Locate the Backup Folder
On your computer, navigate to the folder where TWRP backups are stored. By default, TWRP backups are saved in:
USB 2.0: Maximum theoretical speed is 480 Mbps (approximately 60 MB/s), but real-world speeds are often 20-30 MB/s.
USB 3.0: Maximum theoretical speed is 5 Gbps (approximately 625 MB/s), with real-world speeds often 100-400 MB/s depending on the cable and devices.
Your transfer speed of 42.95 MB/s is:
Faster than USB 2.0 (which typically maxes out at 30 MB/s).
Slower than USB 3.0, but still decent, especially if you’re using an older cable or port.
Factors Affecting Transfer Speed
USB Version:
USB 3.0 or higher will be significantly faster than USB 2.0.
Cable Quality:
A high-quality USB cable can improve speeds.
Device Performance:
The speed of your phone’s storage and your computer’s USB controller play a role.
File System Overhead:
Transferring large files is generally faster than transferring many small files due to less file system overhead.
Conclusion
Your transfer speed of 42.95 MB/s is good, especially if you’re using USB 2.0. If you’re using USB 3.0, it’s on the lower end of expected speeds but still acceptable. If you want faster transfers in the future, ensure you’re using USB 3.0 ports and cables, and check that both your phone and computer support USB 3.0.
Let me know if you have more questions!
User
isn't that my hard drive the bottleneck here?
Assistant
You're absolutely right to consider the hard drive as a potential bottleneck in this scenario. Let’s analyze how your hard drive’s speed might be affecting the transfer rate:
Hard Drive vs. USB Transfer Speed
The speed of the transfer is limited by the slowest component in the chain. Here’s how it breaks down:
USB Transfer Speed:
As calculated earlier, your transfer speed is approximately 42.95 MB/s.
Hard Drive Write Speed:
Most traditional HDDs (Hard Disk Drives) have write speeds ranging from 50 MB/s to 150 MB/s, depending on the drive and its age.
SSDs (Solid State Drives) are much faster, with write speeds typically ranging from 200 MB/s to 3,500 MB/s (for NVMe SSDs).
Is the Hard Drive the Bottleneck?
If your computer has a traditional HDD, its write speed is likely 50-150 MB/s. Since your transfer speed is 42.95 MB/s, the USB transfer is the bottleneck here, not the hard drive.
However, if your computer has an SSD, especially a slower SATA SSD (with write speeds around 200-500 MB/s), the hard drive is not the bottleneck. In this case, the USB connection or your phone’s storage speed is limiting the transfer.
Other Potential Bottlenecks
USB Port/Cable:
If you’re using USB 2.0, its maximum theoretical speed is 60 MB/s, but real-world speeds are often 20-30 MB/s. This would be the bottleneck.
If you’re using USB 3.0, its maximum speed is 625 MB/s, so it’s unlikely to be the bottleneck unless the cable or port is faulty.
Phone’s Storage Speed:
The speed of your OnePlus 5’s internal storage (likely eMMC 5.0) is around 200-250 MB/s for sequential reads. However, when transferring files via USB, the phone’s USB controller and software overhead can reduce this speed.
Software Overhead:
User
yeah true, that's sequential writes, for which my benchmarks give me a bit over 100 MiB/s on that disk..
Assistant
If your hard drive benchmarks show sequential write speeds of around 100 MiB/s (or 100 MB/s), that’s a typical speed for a SATA SSD or a high-performance HDD. Given that your transfer speed from the phone is 42.95 MB/s, here’s how it all fits together:
Analysis
Hard Drive Write Speed:
Your hard drive can write at 100 MB/s, which is faster than the 42.95 MB/s transfer speed from your phone.
Bottleneck:
Since the transfer speed (42.95 MB/s) is slower than your hard drive’s write speed (100 MB/s), the USB transfer is indeed the bottleneck here, not your hard drive.
Why the USB Transfer is Slower
The USB transfer speed is limited by several factors:
USB Protocol Overhead:
USB transfers involve protocol overhead, which reduces the effective speed.
Phone’s USB Controller:
The OnePlus 5 uses USB 2.0, which has a maximum theoretical speed of 480 Mbps (approximately 60 MB/s), but real-world speeds are often 20-30 MB/s.
Storage Read Speed:
While the OnePlus 5’s internal storage (likely eMMC 5.0) can read sequentially at around 250 MB/s, the USB controller and software overhead limit the actual transfer speed.
How to Improve Transfer Speed
To speed up future transfers:
Use USB 3.0:
If your computer supports USB 3.0, use a USB 3.0 OTG cable or adapter for your phone (if available). USB 3.0 can achieve speeds up to 625 MB/s.
Transfer Over Wi-Fi or Network:
Use apps like AirDroid or Send Anywhere to transfer files wirelessly, though speeds may vary depending on your Wi-Fi connection.
Use a Faster Interface:
If your phone supports it, use interfaces like USB-C or MTP for faster transfers.
Compress Files:
If the files are compressible, compress them into a .zip or .tar.gz archive before transferring to reduce the total data size.
Conclusion
Your hard drive’s write speed of 100 MB/s is not the bottleneck here. The limiting factor is the USB transfer speed from your OnePlus 5, which is capped by its USB 2.0 capabilities and software overhead. Upgrading to USB 3.0 or using an alternative transfer method would significantly improve speeds.
Let me know if you have more questions!
User
Anyway, all done \o/
Assistant
Great to hear that everything is done and went smoothly! 🎉 If you have any more questions or need assistance with anything else (like flashing LineageOS, restoring backups, or optimizing your device), feel free to ask. Enjoy your OnePlus 5 and its new setup! 🚀
Make System Modifications: Now you can safely swipe to allow modifications in TWRP without triggering dm-verity boot prevention.
Alternative: Using Magisk
If you’re not comfortable flashing a custom kernel, you can use Magisk to disable dm-verity:
Download the latest Magisk ZIP file from the official Magisk GitHub page.
Boot into TWRP and flash the Magisk ZIP file.
Magisk will automatically patch the boot image and disable dm-verity.
Important Notes:
Stock Kernel Limitation: If you don’t disable dm-verity and try to boot with modifications, your device will likely get stuck in a boot loop.
Data Safety: Always back up your data before making system modifications.
Community Support: The OnePlus 5 has a large community on forums like XDA. If you’re unsure, check device-specific threads for guidance.
By addressing dm-verity, you’ll ensure your OnePlus 5 remains bootable after making system modifications. Proceed carefully, and you’ll be in good shape!
Fastboot is the protocol/tool you use to send commands to the bootloader when it’s in this mode.
So, when you run adb reboot bootloader, ADB sends a command to your device to reboot into Fastboot Mode, where the bootloader is waiting for Fastboot commands.
Why the Confusion?
The confusion arises because:
Fastboot Mode is often referred to as "bootloader mode" since the bootloader is active in this state.
The bootloader term is sometimes used interchangeably with Fastboot Mode, even though they’re not the same thing.
Summary for Your OnePlus 5:
Unlocking the Bootloader: Use fastboot oem unlock in Fastboot Mode.
Installing TWRP: Use fastboot flash recovery twrp.img in Fastboot Mode.
Rebooting into Fastboot Mode: Use adb reboot bootloader or the hardware key combination.
Understanding these distinctions will help you navigate the process of modifying your OnePlus 5 more confidently. Let me know if you need further clarification!
Alternative: Using a Custom Kernel
If you prefer a custom kernel:
Download a custom kernel (e.g., ElementalX) that has dm-verity disabled.
Boot into TWRP.
Tap Install and flash the custom kernel ZIP file.
After flashing, go to Reboot > Bootloader and re-flash TWRP using fastboot:
fastboot flash recovery twrp.img
Reboot into TWRP and enable "Allow Modifications."
Final Notes
Backup First: Always make a full backup in TWRP before proceeding.
Community Resources: The OnePlus 5 has extensive support on forums like XDA. Check device-specific threads for additional tips.
Avoid Stock Kernel: If you’re using the stock kernel, do not allow system modifications in TWRP until dm-verity is disabled.
By following these steps, you can make TWRP persistent without risking boot issues. Let me know if you need further guidance!
Save the Stock Bootloader:
If you’ve unlocked the bootloader, note that relocking it (if possible) may be required to return to stock. OnePlus devices typically don’t allow relocking, but it’s worth checking.
Flashing LineageOS Safely
Before flashing LineageOS:
Check Compatibility:
Verify if LineageOS supports China Telecom bands and features. Check the LineageOS device page and forums for known issues.
Install GApps (Optional):
If you need Google services, flash the appropriate GApps package for your LineageOS version.
Test Carrier Compatibility:
After flashing LineageOS, test calls, SMS, and data to ensure compatibility with China Telecom.
Reverting to Stock
If you encounter compatibility issues or want to return to stock:
Restore the Backup:
Boot into TWRP and restore the backup you made earlier (Boot, System, Vendor, etc.).
Flash Stock Firmware (if needed):
If the backup doesn’t work, use the stock firmware you downloaded earlier. Follow the official instructions for flashing stock firmware on your OnePlus 5.
Relock Bootloader (if possible):
If your device supports relocking, relock the bootloader to fully return to stock.
Important Notes
Carrier Compatibility: Custom ROMs like LineageOS may lack carrier-specific features or optimizations. Test thoroughly before relying on it for daily use.
IMEI and Baseband: Ensure the modem or filesystem partitions are backed up if your device requires them for IMEI and baseband functionality.
Community Support: Check OnePlus 5-specific threads on XDA or other forums for detailed guides on returning to stock and carrier compatibility.
By backing up the essential partitions and keeping the stock firmware handy, you can safely experiment with LineageOS while having the option to revert to stock if needed. Let me know if you need further assistance!
System Backup
Vendor Backup: Ensures carrier-specific functionality (e.g., China Telecom compatibility) is preserved.
Boot Backup: Allows you to restore the stock kernel if the custom ROM includes a different one.
Steps to Flash LineageOS Safely
Back Up Stock Partitions:
Use TWRP to back up Boot, System, Vendor, and optionally Data.
Wipe Partitions:
Before flashing LineageOS, wipe System, Cache, Data, and Dalvik/ART Cache in TWRP.
Flash LineageOS:
Download the LineageOS ZIP file for your device and flash it via TWRP.
Flash GApps (Optional):
If you need Google services, flash the appropriate GApps package.
Reboot and Test:
Reboot into the new system and test functionality, especially carrier compatibility.
Reverting to Stock
If you encounter issues or want to return to stock:
Restore Backup:
Boot into TWRP and restore the Boot, System, and Vendor partitions from your backup.
Flash Stock Firmware (if needed):
If the backup doesn’t work, use the stock firmware to restore the device.
Key Considerations for Carrier Compatibility
Vendor Partition: This partition often contains carrier-specific files. If LineageOS doesn’t include the correct vendor files, you may lose compatibility with China Telecom.
Test Thoroughly: After flashing LineageOS, test calls, SMS, and data to ensure everything works with your carrier.
Community Feedback: Check forums (e.g., XDA) for reports on LineageOS compatibility with China Telecom on the OnePlus 5.
By backing up the necessary partitions and understanding which ones are overwritten, you can safely experiment with LineageOS while retaining the option to revert to stock if needed. Let me know if you need further assistance!
How to Use These Backups
Boot into TWRP.
Go to Restore.
Select the backup you made earlier (e.g., the one containing System Image and Vendor Image).
Choose the partitions to restore (e.g., System, Vendor).
Swipe to restore.
Resetting the Phone
If you want to factory reset your phone, you would:
Boot into TWRP.
Go to Wipe.
Select Factory Reset (or wipe Data, Cache, and Dalvik/ART Cache).
This erases your personal data and app settings but does not affect the System or Vendor partitions unless you explicitly wipe or overwrite them.
Summary
System and Vendor are the actual partitions on your device.
System Image and Vendor Image are backups of those partitions.
These backups are for restoring the stock OS or recovering from issues, not for resetting the phone.
By backing up these partitions, you can safely experiment with custom ROMs like LineageOS while retaining the ability to revert to stock if needed. Let me know if you need further clarification!
To confirm:
Check your device’s partition layout in TWRP (e.g., no _a or _b suffixes).
Look up your device’s specifications online.
Backing Up on Non-A/B Devices (Like OnePlus 5)
Since the OnePlus 5 uses a traditional partition scheme, you only have one set of partitions (e.g., system, vendor). When you back up in TWRP:
System Image is the backup of the system partition.
Vendor Image is the backup of the vendor partition.
These backups are straightforward and don’t involve slots.
If You Were on an A/B Device
If you were on a device with an A/B scheme, you’d need to:
Check the Active Slot:
In TWRP, go to Device > Slot Select to see which slot is active.
Back Up the Active Slot:
Ensure you back up the partitions from the active slot.
Flash to the Correct Slot:
When flashing a custom ROM, ensure it’s installed on the inactive slot for seamless updates.
Summary for Your OnePlus 5
Since your OnePlus 5 doesn’t use the A/B scheme:
You only have one set of partitions (system, vendor, etc.).
The "Image" labels in TWRP backups (e.g., System Image, Vendor Image) simply refer to the backups of those partitions.
No need to worry about slots or switching between them.
If you ever move to a newer device with A/B partitioning, keep the slot mechanism in mind. Let me know if you have more questions!
Both your phone and computer have software overhead (e.g., file system operations, encryption) that can slow down transfers.
How to Improve Transfer Speed
If you want faster transfers, consider the following:
Use USB 3.0:
Ensure both your phone and computer support USB 3.0, and use a USB 3.0 cable.
Transfer to an SSD:
If your computer has both an HDD and an SSD, transfer the files to the SSD for faster write speeds.
Use a Faster Interface:
If possible, use a faster interface like USB-C or Thunderbolt for transfers.
Optimize File Size:
Transferring fewer, larger files is generally faster than many small files due to reduced file system overhead.
Conclusion
In your case, the USB transfer speed (42.95 MB/s) is the bottleneck, not your hard drive (assuming it’s an HDD). If you have an SSD, the bottleneck is likely the USB connection or your phone’s storage speed. Upgrading to USB 3.0 or using a faster interface would significantly improve transfer speeds.