SD Card questions about read/write - raspberry-pi

Good morning,
I have been cloning Raspberry Pi's SD Cards for a "write heavy" software that I have programmed. This leads to the SD Card being unable to write, making it "readonly". Since I can still copy / interact with the SD Card, I have made a clone image of it and I would like to know:
1) Is cloning the SD Card image safe?
2) Considering that the SD Card is now unable to write to persistent memory, but only to read from it, will the new SD Card be readonly?
3) If I clone an SD Card with, say, 1000 writes left, to a new SD Card that I just took out of the box, will I get just 1000 writes or all the possible writes from the new card?
4) What is the safest way to clone an image and retain all the writes from the new card while still having a backup of the SD Card image installed?
Thanks a lot.

Yes, it is totally safe to clone the card as the reason you can no longer write to it is physical degradation of the memory chip itself.
1) Yes, as long as it is readable.
2) New card will have a full lifetime as specified by manufacturer
3) New card, new "lives" on it ;)
4) The "writes" are due to physical limitations of the memory chip.
I hope this helps!

Related

How to Upgrade Synology 2-Bay NAS Storage to Larger Capacity?

First I'd like to apologize for the long read.
I hope you can help me with this one. I have a 2-bay NAS (DS218+). I initially have a single 4TB (WD Red NAS Drive) drive (SHR - without data protection) and multivolume support was flagged as No. I decided to upgrade my storage capacity so I bought a new 8TB WD Red NAS Drive.
I've been reading the knowledgebase but still reluctant to proceed as I'm still quite confused if I'm doing the correct procedure. What I want to achieve is to upgrade my storage without data loss to 8TB (without data protection in mind yet). Lets just say I want to replace my 4TB to 8TB like nothing happened.
The current version of my DSM is 6.2.3. In my 1st bay is the 4TB. I attached the 8TB to the 2nd bay and saw the drive recognized and "Not Initialized" as expected. Now, the videos I've seen always mention a Manage button, but in my case I can't find it. And it didn't ask me to repair anything nor there was a "Degrade" status.
I only see Add Drive when I go to Storage Pool -> Action however. I went with it and clicked Next, then had a pop up warning me that the data in the newly added drive will be erased, I clicked OK and this was displayed:
Now, the Total Capacity: 3.63TB is what got me bummed. I'm new to Raid stuff so I'm still quite confused. I'm hoping to get a new max capacity of 7.2TB from my new 8TB. How do I do this without losing data? And my system as-is?
I hope you can guide me. I'd really appreciate it.
Thank you so much in advance.
To have redundancy you cannot have more than what can be saved on at least 2 disks. Right now you have only ~4TB available on 2 disks. If you have another 8TB you will be able to use 100% of the space.
More information
https://www.synology.com/en-us/knowledgebase/DSM/tutorial/Storage/What_is_Synology_Hybrid_RAID_SHR

How does my operating system get information about disk size, RAM size, CPU frequency, etc

I can see from my OS the informations about my hard disk, RAM and CPU. But I've never told my OS these info.
How does my OS know it?
Is there some place in the hard disk or CPU or RAM that stores this kind of information?
Is there some standard about the format of this kind of information?
SMBIOS (formerly known as DMI) contains much of this information. SMBIOS is a a data structure/API that is part of the BIOS/UEFI firmware and contains info like brand and model of the computer, etc.
The rest is gathered by the OS querying hardware directly.
Answer grabbed from superuser by Mokubai.
You don't need to tell it because each device already knows (or has a way) to identify itself.
If you get the idea that every device is accessed via address and data lines, and in some cases only data lines then you come to the relaisation that in those data lines you need some kind of "protocol" that determines just how you talk to those devices.
In amongst that protocol you have commands that say "read this" and "send that" or "put this over there". It is also relatively easy to have a command that says "identify yourself" which, rather than reading a block of disk or memory or painting a pixel a particular colour, will return a premade string or set of strings that tell the driver or operating system what that device is. Using a series of identity commands you could discover a device type, it's capabilities and what driver might be able to work with it.
You don't need to tell a device what it is, because it already knows. And you don't need to tell the operating system what it is because it can ask the device itself.
You don't tell people what they're called and how they talk, you ask them.
Each device has it's own protocol for these messages, and they don't store the details of other devices because to do so would be insane and near useless given that you can remove any device at any time. Your hard drive doesn't need to store information about your memory or graphics card except for the driver that the operating system uses to talk to it with.
The PC UEFI specification would define a core set of system specifications that every computer has, allowing the processor to be powered up and for a program stored in an EEPROM to begin the asbolute basic system probing necessary to determine the processor, set up the RAM, find a disk and display and thus continue to boot the computer.
From there the UEFI system would hand over to the operating system which would have more detailed probing and identification procedures, but it all starts at the most basic "I have a processor, what is around me?" situation.

UEFI How to modify the boot order list programmatically

Building a firmware using EDK2, what is the programmatic way to provide a default boot order? I want the default option to be boot from SD card. I have an bootx64.efi image stored in the SD card.
Every time when I build the EDK2 image and flash it on the target, I need to enter boot maintenance manager option and add SD card as boot option and change the boot order.
I looked into the code and read the specifications of Boot manager. I understood that I need to modify Boot Order variable but I don't get how to add SD card option in the source code.
I am looking into the QemubootOrder.c file but I don't understand where I need to add the path to SD card .
Well, first of all, if your UEFI port considers that SD card a "removable media", which is should - it should automatically load it if it is placed in \EFI\BOOT\ on the FAT-formatted EFI System Partition.
BootOrder comes in if you want to be able to support multiple options. But BootOrder itself only consists of a list of the numerical part of the available Boot#### options, in order of preference.
You can learn more about these mechanisms from the UEFI Specification. Current version is 2.6, and the most relevant bit for this topic is section 3.1 Firmware Boot Manager.

how to delete card manager applet on the smart card?

I have a javacard and when I reset the card, all the applets on the card are cleared except one of them. and it is "Card manager applet" with "A0000000030000" as its AID. I want to know is there any way to delete this applet?! or it is mandatory on the card and there is no way to delete it?
if it is possible to delete it, after deleting it, how we can work with the card? (installing another applet and so on)
thank you.
The card manager is the manager that handles the application management of the card. It also determines the card states. Normally you cannot remove the card manager, especially not through the card manager itself. If you can delete it, it should be through a proprietary API of the card manufacturer.
As a analogy: you are asking Windows or Linux to delete itself.
You can however put the card in TERMINATED state, after which it is effectively dead. You can even do this from an Applet, if it has the TERMINATE CARD privilege, which can be assigned during INSTALL for INSTALL when the Applet is instantiated. After this neither the Card Manager not the Applet will work though.

Reserving Disk Space on iPhone

I want to be able to 'reserve' a set amount of disk space on my iPhone for my particular application. Before I get flamed I should add this is NOT for a public application.
I assume the simplest way to do this is to actually create blocks of files up to the space I wish to reserve and then delete and use these blocks as necessary.
Is there any filesystem operation which might allow me to do this without actually having to write content for all the space I want to allocate? I'm asking this because I'm not sure lazy the disk space allocator might be.
No, this is something well outside the SDK. You'll have to create your own methods to handle this for you.
iTunes ensures there's at least 200MB available after every sync. It's only the users who don't sync regularly that can cause issues (and even then they are prompted to free up space when they go below 50MB free).
Instead of reserving space, why not simply pop up an alert when disk space is low? (and enter a feature reduced mode)