Move File System Onto Another Drive?

I’m sure there was a discussion on the forum about moving the file system onto an external drive but I can’t find it again.

I’ve got the Olimex Lime2 server with an SSD attached using the Pioneer image. I’d like to move the file system onto the SSD to hopefully make it run faster and prevent the SD card from being written to as often.

Is it possible? Is it a good idea? How do I do it?

1 Like

Yes, it is possible.

Do you want to simultaneously use the SSD and microSD card or use only the SSD?

  1. I did the former once and wrote about this on my wiki. In this approach, you expand the filesystem to use the SSD as an additional Btrfs volume. If the SSD’s capacity is much larger than that of the microSD, then more writes will happen to the SSD. The overall performance will be better, but not as good as using the SSD alone. Failure of either volume will be a problem. Take backups regularly.
    FreedomBox/Tips and Tricks - Wiki

  2. If you want to use the SSD alone, then simply create a disk image of the existing microSD card using the dd utility and write it to the SSD.

microSD → file → SSD
or
microSD → SSD

Well, there’s also a third option. Install a FreedomBox disk image on the SSD. Backup your data from the old installation and restore it on new installation.

2 Likes

Thanks for the info. I actually read that description on your wiki but was thinking of using only the SSD.

I tried “sudo dd if=/dev/mmcblk0 of=/dev/sda status=progress” to copy the card to the drive, turned off the box, took out the card and turned it on again.

Now I can’t access FreedomBox via URL (Hmm. We’re having trouble finding that site), IP address (Unable to connect) or SSH (Connection refused). I can still ping it though.

Any idea where I’ve gone wrong?

The dd command looks correct. Hope you shut down the FreedomBox, took both the disks out of the box and ran the command on a separate computer. You can mount the SSD on another computer to check if it has the correct partitions and files.

I assume that the capacity of the SSD is larger than the microSD card. It might try to expand the root partition automatically, or you can expand it from Settings → Storage manually.

Being able to ping the FreedomBox is still good news. You can attach a keyboard and monitor to the device to debug further. You should see a login prompt where you can use your FreedomBox username and password.

Then try to check if a few essential services are running using the following command:
sudo systemctl status <service-name>

I would check these services: NetworkManager, firewalld, apache2 and plinth
If you find that a service has errors while starting, you can see its detailed log using sudo journalctl -u <service-name>.

Also check if the disk is full using df.

Hmm, no and I know I shouldn’t have tried to copy a running system - think I’m to tired to think at the minute! I’ll have to buy a SATA to USB connector and try again. It’s probably easier to reinstall than try to salvage it since I was still only just setting it up.

Thanks a lot for the help. Just to check before I do anything else silly: assuming I’m starting from scratch, is the best method just to connect the SSD to my computer and dd the original downloaded image straight onto it? For some reason I thought it needed the boot partition to be on the SD card.

I think this is applicable to arm64 images only. Also, I didn’t try running the system from an SSD myself yet.

If you’re going to install a fresh FreedomBox image, you can just run the dd command from the Lime2 device itself (might be slow). The following wiki page has detailed instructions.
https://wiki.debian.org/FreedomBox/Download

1 Like

I reinstalled the image to the SD card then used the Lime2 to dd it to the SSD. I shut the box down and removed the SD card. After powering it back up I can’t access it at all. Ping says “Destination Host Unreachable”. Perhaps I should give up trying to do this! Thanks a lot for trying to help me :slight_smile:

I was merely describing a hack to avoid getting a SATA to USB adapter. Since your FreedomBox is also a general purpose Debian machine, you can install a new image to the SSD from the FreedomBox as well. Just run the commands shown in the wiki page from the FreedomBox with the SSD as the installation target.

If you aren’t comfortable doing that, get the adapter and use a tool like Balena Etcher to burn a fresh FreedomBox disk image to the SSD. You don’t need to write the image to the SD card first. The images you download from the website are already disk images.

I think it’s time for me to try setting up a FreedomBox Pioneer with an SSD/HDD and write a proper wiki page about the process. I remember successfully booting up an old Lime 2 device (maybe rev. G) from a HDD over SATA a few years ago. :thinking:

I know thanks, I just did that because I couldn’t access the Lime2 so I tried reinstalling it. Here’s exactly what I did this time:

  1. dd’ed the image to microSD from PC.
  2. Pluged microSD into Lime2 and turned it on. After a while it was still inaccessible.
  3. Realised the problem might be having the SSD connected.
  4. Powered it off and disconnected the SSD.
  5. Powered it back on and was able to complete the initial FreedomBox setup on the microSD.
  6. Copied the image file to the Lime2 via scp.
  7. Reconnected the SSD and dd’ed the image to it.
  8. Powered off and removed the microSD.
  9. Powered back on and couldn’t access the Lime2 at all.

I’ve just tried removing the SSD and putting the microSD back in. Now I still can’t access the Lime2 from the browser but can ping it again. SSH works but tells me the password is wrong (it’s definitely not).

That could be very useful! Think I might buy an adapter anyway and try copying the image to the SSD from the PC. Every time I’ve copied it to the microSD from the PC it’s worked fine. Just for reference, my board is a revision L.

I tried this today but couldn’t get it to work.

I flashed the Pioneer Edition image on a new SSD using Balena Etcher and connected it to the FreedomBox device using the SATA interface.

I can see that the router has assigned a new IPv4 address to this device. I can ping it, but cannot access the web interface (Connection timed out). I connected a monitor over HDMI and got “No Signal”.

I also tried connecting two power supplies just in case there wasn’t enough power, but this made no difference.

I removed the disk and mounted it on a laptop. I can see no modifications under /var/log. It has either not booted at all or mounted the root partition as a read-only filesystem.

I know @sunil was able to boot from an external HDD earlier. What am I missing?

@njoseph

Thanks for reporting back @njoseph !
Thanks for the info @nbenedek . Does that mean if the microSD died could I just dd the first 4 megabytes to a new card and have the system up and running again?

Does that mean if the microSD died could I just dd the first 4 megabytes to a new card and have the system up and running again?

Yes, that is right.

After spotting this thread

I decided it was time I got round to trying to move my filesystem onto my SSD. I used

sudo btrfs replace start -B /dev/mmcblk0p2 /dev/sda1 /

to move the filesystem to a 64gb partition on the SSD and everything seemed to be fine. Then I used

sudo btrfs filesystem resize max /

and the filesystem expanded as expected. Unfortunately a while later and I can no longer access the box via the browser, SSH says No route to host and ping says Destination Host Unreachable. I’ve no idea what happened. Is there any way to recover? Everytime I try something I seem to mess the box up!

1 Like

:point_up_2: Those commands look good to me. Perhaps the problem is elsewhere?

Do you have a static IP address configured for the box in your router? If you log in to your router admin panel, is the FreedomBox listed as a connected device?

A good old reboot might be worth a shot. I believe it is the middle button of the tiny tiny buttons on the box (push it in with a paperclip or whatever, hold until the lights change).

I’ve never set a static IP address but it’s never changed before. The lease time for the IP address ran out sometime last night and the box is no longer listed in the router admin panel. There is a new IP address listed (lease runs out in a couple of hours) but there’s no info about it and I can’t access it at all.

I’ve got a harddrive bay attached to the case so I don’t think I can access the buttons without unplugging the SSD. What happens if you leave the battery to run out? Does it shutdown safely?

The buttons are underneath the SATA port, you can probably get to them without unplugging anything. If you will excuse the quality of this photo:

I have drawn a red box around the buttons. It is easiest to depress them with a paperclip or a ballpoint pen or something.

Before I knew about these buttons, I had done a few restarts by unplugging the box, taking out the cover screw, disconnecting the battery, then putting it all back together. Boy did I feel silly after I read about the buttons!

1 Like

Ha ha ha, I’m glad you found out about the buttons! Here’s how my SSD is connected with a case of it’s own:
fbx

That’s why I didn’t think I’d be able to reach the buttons but using your pic as a guide I managed to bend a paperclip and squeeze it in and I can access the box again so thanks for that!

1 Like