Cloning SD cards
The following commands can be used in both Linux and macOS Terminal consoles!
Clone the drive sda onto drive sdb:
$ dd if=/dev/sda of=/dev/sdb
Clone the drive hda onto an image file:
$ dd if=/dev/hda of=/image.img
Copy a CD or DVD disc to a .iso image file, first unmounting the disc:
sudo umount /dev/dvd-device
dd if=/dev/dvd-device of=dvd.iso bs=2048 conv=sync,notrunc
# dvd-device will typically be dvd for a dvd disc or cdrom for a cdrom disc.
Clone a hard drive to a zipped image file in 100Mb blocks:
$ dd if=/dev/hda bs=100M | gzip -c > /image.img
Create a 10 KB file filled with random data (10 x 1K blocks):
$ dd if=/dev/random of=random.bin bs=1024 count=10
Completely wipe the hard drive hdz by overwriting it with random data:
$ dd if=/dev/urandom of=/dev/hdz
SteveC - Topple Rudd Poltman
Clone the drive sda onto drive sdb:
$ dd if=/dev/sda of=/dev/sdb
This is nowhere as easy as it sounds.
To being with before I even plug in any SD cards my Linux computer already lists the following as supposedly already existing. I have no clue what these are.
When I plug in the Jeston Nano SD card the following appear:
This is pretty much the same thing I got on the Windows machine. It's like it's been broken up into 12 partitions.
Then when I plug in the blank SD card the following shows up
I guess this is just showing me that this SD card only has a single partition?
In any case I have no idea what the first sda that has four partitions is. It's nothing I'm aware of.
The Jetson Nano SD card appears to be showing up as sdb, and the new empty card appears to be showing up as sdc.
So should I just use the following command instead?
$ dd if=/dev/sdb of=/dev/sdc
Instead of cloning from a to b I should clone from b to c? Right?
And will this then clone all 12 partitions onto the new SD card?
I suppose it can't hurt to try.
I have no clue what the sda with 4 partitions is on this computer. This is a notebook computer. Perhaps it already has some sort of internal backup ROM in it that it lists as an SD card?
It looks to me like I need to clone from sdb to sdc?
I sure hope this doesn't screw up my Linux computer! I don't want to overwrite the hard drive.
Cloning the SD card on Windows:
I've already backed up Raspberry Pi System cards using Win32DiskImager so I've decided to try using the same method on the Jetson Nano Card.
There is a slight difference. The Raspberry Pi SD cards only have two partitions. One is the Boot partition and the other is an unnamed partition. To back up the entire SD card all that is require is to copy the Boot partition to an image file. This actually copies the entire SD card anyway.
So now that I see how Linux is doing this I'm suspecting that Windows works in a very similar way. So I'm giving that a try right now. When I plug the SD card into Windows it shows up as 12 drives on my computer they have been named G,... thru,... R. At first I didn't know what to do with that because I can only select on of them at a time with Win32DiskImager. However now I'm thinking that I only need to select the first one (in my case that will be drive G).
I then create an empty *.img file given whatever name I like, and save drive G to that image file. When that's done I should be able to just write that file back out to a new SD card. That new SD card will then have all 12 partitions written to it after this process is over. Hopefully. This is the way it works for the Raspberry Pi SD cards. The only difference is the Raspberry Pi cards only have two partitions while the Jetson Nano has 12.
In any case I think this is going to work because it's still reading the SD card to the image file. If this was only 1/12th of the SD card it should have been done by now. So I suspect that it's copying the entire SD card.
When it's done I write it to the new SD card and see it works. I'll report back later with the results. 😊
By the way, this is not an attempt to avoid Linux. I need to know both systems. So I'll probably do this on Linux too. I have tons of pies and other SD cards that I like to back up. So it's nice having all the options I can get. I also imagine that I'll end up with a lot of additional system cards for the Jetson Nano as well. Paul McWhorter is demanding that I keep one SD card just for his lessons. I'll be glad to do that. Similarly I have various experiments that I'll be doing as well, and I'll be keeping those experiments on different SD cards as well. So I'll be making a lot of new system cards over the next few months. May as well get this SD card cloning down pat right now. 😎
Just for the record Win32DiskImager just finished copying the SD card to an image file. The image file is 65 GB so it got the whole thing. I'll clone the other SD card later from that image file and report back again when I've done that, but based on how it looks right now I'm pretty confident that it copied the whole card.
I wrote the new SD card and just booted it up in the Jetson Nano. Everything appears to be working just like the original card. So now I know I can do it with Windows. I'm going to pick up some more of these 64GB cards and make some more raw system cards for my Jetson Nano. Next time I'll give the Linux dd command a shot and see how that works.
Cool. Its good to know that windows can do that. I havent done anything with any of my nano cards so far worth saving, so i havent bothered to even try yet
In fact I'm thinking of nuking the jetbot card I'm using cuz it's working now and I'd like to start fresh without all the mistakes. Right now ive got 2 notebook folders and only one of them has the "follow me^ subroutine that is the main reason i built this thing in the first place
On the other hand, since it's working maybe i should just leave it alone
I did just nuke the ubiquityrobot on my pi3 tho, cuz i know i messed that one up, and i want to start fresh cuz I'm taking the udemy ros course, which is helping, im starting to understand how these things are built, but im not at the point yet where i can define hardware, and i think that's the missing magic piece to this puzzle
I can control the bot,but only if i use the hardware that they proscribe. In fact, i get an error if i dont apply power to the motor board which means theres some kind of communication response from the motor board which means i cant just swap it out for the one i want
If this works tho, it'll be worth the effort
I havent done anything with any of my nano cards so far worth saving,
I hope to have four system backups when all is said and done. This is why I've chosen to go with the 64GB cards instead of the 128GB cards.
Why four backups?
- A simple pure unadulterated, but completely set up system.
- A system for my A.I. work with Paul McWhorter's Course.
- A system for my Kdenlive Video Editing System
- A system for Fusion 360, KiCAD and related projects.
Of course I'll be doing other things using these same system cards too. The first back-up is just so I don't have to start from scratch when setting up the other three systems. The first one is to get Linux set up and configured the way I like it, no passwords being asked for, single clicking on files, the WiFi connect, etc. Just the basic OS stuff. It makes it a lot easier to set up the other 3 system cards with all that already out of the way.
The A.I. system will have Python, Numpy, Matplotlip, Jupyter Notebook, etc., all installed for doing A.I. work. I'll also be installing OpenCV, and probably TensorFlow, and who knows what else? So once I get all that stuff installed, I'll want to save that system image so I don't need to reinstall all that junk ever again. 🤣
As far as any actual data files, like Python Code, etc. I can just save those to my cloud as data files. They won't need to be backed up as an OS system image.
Then I'd like to do the same thing for Kdenlive, which will also have a lot of other related programs too, like Audacity, etc. So once again, once I have all those programs installed and customized for my purposes, I'll back up those system images too so I'll never need to reinstall and reconfigure those program. Again, actual data files like videos etc, can be backed up like regular data files.
And then finally I'll do the same thing with a Fusion 360 system which will most likely also contain other CAD programs like KiCAD, etc. So again, once I get that system all squared away I'll save an image of that one. Any actual drawings I make can be saved like regular data.
So in the end I'll have four SD Cards. One for each basic system listed above.
Otherwise, if I try to put this all on one SD card, two problems emerge.
- First, they start to fill up the entire SD card and clog everything up.
- Second. if something goes wrong and I lose the system then everything goes down the tubes at once.
So I like having different system cards for these different purposes. It keeps everything nice and neat and makes it all run faster too.
Of course, if I ever use a Jetson Nano in an actual robot, then I'll have a system image for that set up as well. But right now, learning A.I., Making Videos, and using Fusion 360 and KiCAD are my priorities. And I don't want them all jumbled up on one SD card.
So that's my approach.