I followed this guide https://www.addictivetips.com/ubuntu-li ... ian-linux/ to move the Swap Memory to a USB drive but once I rebooted I got stuck in emergency mode.
Is there a way to fix this or do I need to start over?
https://prnt.sc/WN86RQ6xvnOh
Re: Emergency mode after moving swap to USB drive
Thanks. I might need to start again...
Do you know of any tutorials i can follow to add the swap on USB without having this type of issue in future?
Do you know of any tutorials i can follow to add the swap on USB without having this type of issue in future?
Re: Emergency mode after moving swap to USB drive
squidg wrote: ↑Fri Aug 11, 2023 7:15 amI followed this guide https://www.addictivetips.com/ubuntu-li ... ian-linux/ to move the Swap Memory to a USB drive but once I rebooted I got stuck in emergency mode.
That's very out of date. It uses sysV init but most modern Linux (including RPiOS) use systemd and were doing so in 2020.
Yes:Is there a way to fix this or do I need to start over?
- Write a clean desktop RPiOS image to a different SD card.
- Put the broken card into a USB card reader
- Disconnect the USB drive
- Boot from the new SD card. Let the first boot wizzard run.
- Connect the card reader. The desktop should automatically mount the broken SD card's partitions under /media/username
- Undo the changes you made.
- Shutdown
- Remove card reader
- Swap SD cards
- Boot
- Find a better tutorial and back up your SD card before applying it.
Personally, if I were moving swap to a USB drive I'd use a swap partition not a swap file. But what makes you think you need additional swap space at all? Many (most?) folks run RPiOS happily with the default 100MB. And remember, you could just increase the size of the existing swap file and leave it where it is.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.
All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides
All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides
Re: Emergency mode after moving swap to USB drive
For what I need to do I need more memory otherwise my Pi just keeps freezing. When I increase the swap directly on the SD Card it wore it out pretty quickly.... So for this, I should create a swap partition on the USB drive?Personally, if I were moving swap to a USB drive I'd use a swap partition not a swap file. But what makes you think you need additional swap space at all? Many (most?) folks run RPiOS happily with the default 100MB. And remember, you could just increase the size of the existing swap file and leave it where it is.
Re: Emergency mode after moving swap to USB drive
For swap on a USB drive I'd use an old-fashioned spinning rust disk drive. They don't have the same write issues as flash based devices.
Unreadable squiggle
Re: Emergency mode after moving swap to USB drive
Yes, definitely. I haven't tried it recently, but it should be easy enough.
Unreadable squiggle
Re: Emergency mode after moving swap to USB drive
Yeah, so would I. Swap on flash (of any sort) is a recipe for trashing the drive.
@OP: hit your favourite search engine for how to add a swap partition on Linux. It isn't Pi specific.
If you want to go the USB drive formatted to ext4 with a swap file route start by understanding how to use fstab: Using fstab A Beginner's Guide
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.
All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides
All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides
Re: Emergency mode after moving swap to USB drive
So the USB drive will also wear out quickly just like the SD card is that correct?
With the spinning disk drive, do I get one of these for example with a USB docking station or USB cable connector? I only need 5-10gb max.

With the spinning disk drive, do I get one of these for example with a USB docking station or USB cable connector? I only need 5-10gb max.

Re: Emergency mode after moving swap to USB drive
I'd probably go for a 80GB or higher SATA 2.5" laptop drive and use a good (ASMedia) USB to SATA adaptor. The big drives in your picture need higher current at 5V an 12V. The Pi can't provide 12V, so if you are going to use one of those get a powered enclosure.
This is a drive I've been using with a Pi 400 when I needed a large amount of swap for a big compilation.
Unreadable squiggle
Re: Emergency mode after moving swap to USB drive
I got given a Kingston UV400 2.5"" SSD drive 120GB. Would this also be ok to use or do I really need a spinning disk drive?
Re: Emergency mode after moving swap to USB drive
You will have to look at the specifications of that SSD. How many datablocks can be written in its lifetime. Smaller SSD's have lower numbers, but you will have a hard time writing that SSD to death with a Pi.
The quite popular 1T Samsung SSDs can be written to much more than specified in datasheet. There are simply people who have done that. From detailed analysis and extrapolation, once done by a tech site, it was clear that this SSD will outlive its user.
I have used my 1T Samsung as bcache for 3 4T HDDs for years, and it is still doing fine in an other role as LVMcache for an 8T HDD. And swap and 3x VM block storage and rootfs.
Code: Select all
ID# ATTRIBUTE_NAME FLAGS VALUE WORST THRESH FAIL RAW_VALUE
5 Reallocated_Sector_Ct PO--CK 100 100 010 - 0
9 Power_On_Hours -O--CK 079 079 000 - 106015
12 Power_Cycle_Count -O--CK 099 099 000 - 74
177 Wear_Leveling_Count PO--C- 064 064 000 - 428
179 Used_Rsvd_Blk_Cnt_Tot PO--C- 100 001 010 Past 0
181 Program_Fail_Cnt_Total -O--CK 100 100 010 - 0
182 Erase_Fail_Count_Total -O--CK 100 100 010 - 0
183 Runtime_Bad_Block PO--C- 100 100 010 - 0
187 Uncorrectable_Error_Cnt -O--CK 100 100 000 - 0
190 Airflow_Temperature_Cel -O--CK 066 037 000 - 34
195 ECC_Error_Rate -O-RC- 200 200 000 - 0
199 CRC_Error_Count -OSRCK 100 100 000 - 0
235 POR_Recovery_Count -O--C- 099 099 000 - 45
241 Total_LBAs_Written -O--CK 099 099 000 - 472823410212