Problem Creating Image on external SDD partition

I just received the FreedomBox with A20 OLinuXino Lime 2 board. (I have not initialized it yet.)

In addition to the FreedomBox, I purchased a 1TB SDD where I have created two partitions: (1) 20GB for the firmware, and (2) remainder of the drive, both with Ext4 format. My intention is to copy the firmware image into the first partition with the intention of running the operating system off the SDD while keeping the boot routine on the SD card.

I have the SDD connected to my Ubuntu 20.04 desktop via USB SATA cable.

My problem is that when I try to follow: FreedomBox/Download - Debian Wiki in terms of

cat freedombox-stable-free_buster_cubietruck-armhf.img > /dev/sdg ; sync

adjusted for the specifications for the board and partition, I find the formatting seems to get corrupted that I can no long access that partition.

I have mounted the drive and given ownership privileges, which I know I will need to revise when mounting onto the FreedomBox.

I ask for your advice on what I should expect to see in that partition or alternate steps.

Thank you.

FreedomBox is using btrfs. I would try reformating the drive (at least the root partition) with btrfs and see if you have better luck.

If you have a compelling reason to use ext4, you may have to boot the image as-is from the SD card and copy the files over, instead of syncing the image.

This guy seems to have managed it:

Thank you for the valuable advice on a possible way to create an image on the first partition of the sdd, in order to run the operating system from it…

The reality is that I am not presently knowledgeable enough to get your advice to work properly (even though my main operating system at home is Ubuntu 20.04). And, no, I don’t need the partitions to be formatted as EXT4. It is a matter of wanting the second partition to be accessible for storage by other users, not just for running the system.

Today, I reformatted the whole sdd (a few times) including formatting the first partition to btrfs format. Once I did so, I lost connection with that partition outside of the command line terminal. For example, Ubuntu would not recognize the partition via the file manager.

I think that I am missing something so basic but critical piece that could make things work.

I see a possible approach as described in: Trying to install Freedombox onto Cubietruck SSD - #3 by sunil. But, I am using a WD sdd and not the cubietruck.

Your more basic level of help would be appreciated in knowing how to transfer the image successfully to the first sdd partition.

In step 3, I see two commands in FreedomBox/Download - Debian Wiki
(1) $ dd bs=1M if=freedombox-stable-free_buster_cubietruck-armhf.img of=/dev/sdg conv=fdatasync status=progress
(2) $ cat freedombox-stable-free_buster_cubietruck-armhf.img > /dev/sdg ; sync

I tried both without success. What I appear to be missing, I think, is likely the initial format for that partition and/or some other setting up steps that may be needed.

Thank you in advance for any advice.

I don’t think btrfs is enabled by default in Ubuntu 20.04, but it is in the official repository.

sudo apt update
sudo apt install btrfs-progs -y

After you install it, it will probably show up normally in your file manager.

The way I got the FreedomBox root file system to disc was with the btrfs replace command. Somehow I wound up on this thread and it seemed simple enough.

You can actually do the whole thing from Cockpit if you want to. Get the box booted up and everything with the default SD card setup. You do the swap while it is running (btrfs magic).

You need to identify which connected devices are which, of course. The SD card should have two partitions, one is the boot partition (which stays put on the SD card), the other is the root file system which will be getting copied over.

mmcblk0 179:0 0 29.7G 0 disk
├─mmcblk0p1 179:1 0 128M 0 part /boot
└─mmcblk0p2 179:2 0 29.6G 0 part

So in my example here, /dev/mmcblk0p2 is the partition to copy over.

You also need to figure out what the partition you are moving it to is called. Run lsblk to see you attached block devices and you should be able to see your partition on there. Make sure you pick the right one!

btrfs replace start [source_dev] [target_dev] [mount_point]

That’s the syntax for the command. The man pages are fairly informative if you want to get to understand the command a little better, but for this task the main thing is to make sure you get your devices in the right order.

As an example, mine looked like this:

btrfs replace start -f /dev/mmcblk0p2 /dev/sdb1 /

I had to pass the -f flag to force it to run (it told me to). I’m not sure if I had something set up funny, but there was nothing on that disc anyway. The first device is the flash drive, the second is the disc, and the last slash is the mount point (root).

Let me know if you are successful!

1 Like

The image is a complete disk image. It already contains multiple partitions. Any “initial partition” will be wiped out when the image is written to the disk.

Thank you for the valuable advice on the topic. I get that the thread’s old, but I have a question regarding data recovery on an SSD. I have deleted several important files by accident and now trying to recover them in any way possible. I’m away from the town now and have no possibility of seeing a specialist. I will do that as soon as I’m back in town, but now I’m trying to find out if it is possible at all to restore any data from an SSD.
Thank you for the replies! Hope I will manage to do that even though I understand very little about the technical stuff.