I know about Clonezilla and copy pasting partitions with gparted, but can I just use dd to copy a partition with batocera to a USB stick and will it then boot from the stick? Do I have to set the boot flag or take any other steps?

Thank you for any tips.

15 points

It might work, but probably not without a little tweaking.

A lot of things will reference drive identifiers or drive path to know where to mount them. These things don’t get copied by dd.

permalink
report
reply
10 points
*

huh?

Isn’t it the other way around?

I once cloned an nvme with dd and had to physically remove one of the two, because they had the same id and the bios couldn’t differentiate between them and would randomly boot into either the first or the second one, inconsistently.

And removing either one would boot into an identical system with everything mounted and working. Which caused some confusion until I realized that the id was copied over.

So unless you didn’t use the id in fstab, you should be fine. Sure the device path may differ, but that can happen anyway to usually devices should be referenced by id.

permalink
report
parent
reply
6 points

There are different schemes that different distros use. Some user partition id, some use fire system id, and some use device serial number and partition index.

permalink
report
parent
reply
3 points

Thanks, so just update the UUID in fstab for the stick? Or is there more?

permalink
report
parent
reply
4 points

Probably all you need to do is check to make sure things look right, and actually test it.

I can’t think of anything else that would be common that you’d want to check. If you’re running weird virtualization setups on your laptop you might have to do more. :P

permalink
report
parent
reply
1 point
*

dd’ing /dev/sdx will copy all IDs

dd’ing /dev/sdx1 will keep UUID but PARTUUID will remain the same on the destination

permalink
report
parent
reply
10 points

If you dd your entire laptop drive to the entire flash drive it should be able to boot. It might not work the same with just one partition though. Also, how big is your USB stick!?!?

permalink
report
reply
18 points

( ͡° ͜ʖ ͡°)

permalink
report
parent
reply
6 points

You can easily get 1TB USB sticks.

permalink
report
parent
reply
1 point

The biggest flash drive I’ve ever used is 32gb lol

permalink
report
parent
reply
4 points

Lmao they are huge these days! But I’m talking about a 40gb partition, cloning it to a 64gb stick.

You can’t even buy 2gb sticks anymore :/

permalink
report
parent
reply
5 points

Small USB flash drives are still available, you just won’t find them in the local stores. There are expensive, industrial grade drives from places like digikey and dirt cheap, no name drives from Chinese sellers where they will print your logo on them for free if you buy a hundred of them.

permalink
report
parent
reply
3 points
*

One partition is not enough. You also need to copy a EFI boot partition and create a correct partition table manually. And note that you cannot get a correct result when partitions you are copying are mounted. You need to boot some live system to do this.

permalink
report
parent
reply
1 point

I’ve heard that systemd-boot can do it with just one partition but I don’t know howww also somebody please eli5 BTRFS to me, my brain’s doing the full-sponge thing.

permalink
report
parent
reply
7 points
*

You can just use `# cat /dev/your-disk > /dev/your-stick, no need for a (dd) scalpel there.

If your system uses UUID’s in /etc/fstab, you have to change them to match the current partitions to have it bootable. lsblk -o+UUID is nice for that.

permalink
report
reply
2 points

Wait what? You can use cat like that?! That’s dope

permalink
report
parent
reply
3 points

Everything is a file. ☺

permalink
report
parent
reply
0 points

… not if you took a blue pill overdose …

@MonkderZweite @Secret300

permalink
report
parent
reply
2 points

Ok, thanks. That sounds pretty good.

If i want to compress it and save it as a backup can I do

cat /dev/sda3 | gzip -9 > drive.img.gz

?

permalink
report
parent
reply
4 points
*

fill up the remaining space on the drive completely with 0s with a dummy file you delete then, before gzipping

permalink
report
parent
reply
2 points
*

Yes, but like @kuneho said, since “deleted” stuff only is marked as deleted (not wiped), there’s always a bunch of random on the “empty” space part of a disk, which compresses badly.

Do cat /dev/zero > /path/to/mounted/partition/zeroes and delete it after cat errored out because no space, to fill the “empty” space with zeroes.

permalink
report
parent
reply
2 points

That worked really well! I got a 50gb partition with about 30gb free space into a 10gb zipped image. Is there any way to show progress during the operation like with dd’s status=progress?

permalink
report
parent
reply
5 points
*

#Big tip: use chatGPT to help you with commands.

You can say something like “I want to backup my entire file system using [this program]. I want to create a tar file, and then copy that to an external drive. I want the program to display progress while it’s copying, then verify the files have been copied correctly once it has finished. I am using [whatever distro]. Please give me the commands I need to achieve this.”

Then it will spit out the commands you need to input with the correct syntax.

The best part is that you can then ask it to clarify any parts of its answer so you can learn how it all works and make sure the commands are doing what you asked. And if your computer spits out an error, just paste that back into chatgpt and it will help you resolve it.

Seriously, chatgpt is like a 24 hour on call Linux guru friend. It’s saved me so much time and effort over the last few months doing things like this.

permalink
report
reply
1 point

Swear to God. I hope someone develops something so I can just say what I want to do in the terminal and an AI will create the command then prompt “run this command? Y/N/E” E to explain it

permalink
report
parent
reply
2 points

Someone’s probably working on that as we speak

permalink
report
parent
reply
5 points
*
Deleted by creator
permalink
report
reply
1 point

What usually specified in fstab and other configs are FS UUIDs, not partition UUIDs. They are kept when cloning with dd.

permalink
report
parent
reply
2 points
*
Deleted by creator
permalink
report
parent
reply
1 point

Ok awesome, thanks for the list, I was just asking user ricecakes about that.

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 7.8K

    Monthly active users

  • 6.5K

    Posts

  • 179K

    Comments