Rebuilding boot record and EFI partition

Found the following post on reddit:
https://www.reddit.com/r/Windows10/comments/njr7we/if_you_accidentally_deleted_the_efi_partition/

…for rebuilding the boot record/EFI partition on a drive

If You Accidentally Deleted The EFI Partition, Broke Your Boot Record, Can’t Boot Into Safe-Mode or Have Too Many Boot Options in Bios This Tutorial is for You.

I’m making this to pretty much assemble all of the steps I found across the web to re-create my non-existent boot record; after cloning from my previous GPT SSD everything still functioned perfectly however I could not boot into safe-mode in order to use DDU as I had no recovery partition.

The final straw was when windows update refused to work and kept throwing me into a ” Sorry, we’re having trouble determining if your PC can run Windows 10 ” loop with an error code 0x80070003.

I planned on reinstalling windows but somehow ended up fixing everything within an hour. Well I wish you luck you who is finding this thread by randomly searching up those key words in google’s index; I hope this helps.

This is particularly useful if the only solution you’ve found has been to set your C:/ drive as active which won’t work if it is formatted to GPT/runs UEFI.

Before performing these steps please disconnect every USB file/Drive not necessary for the fix or you’ll only more than likely end up confusing yourself; more so than you already are.

  1. Download Media Creation Tool; from Microsoft’s Website, install it to an external USB and boot into it from the Bios or however you know how and run the Repair Tool after verifying the language and system settings.
  2. Open the Command Prompt from within the Repair Tools
  3. Once in the Command Prompt you have potentially two main things you want to do; delete whatever messed up boot records you currently have and or create news ones.
  4. We will delete what currently exists first. Use ‘bcdedit /v‘ to view a list of boot loaders currently connected to the System and ‘bcdedit /delete {identifier}‘ to remove said bootloader (Yes, include the curly brackets from the former command too). If you later find yourself still having too many bootloaders in the bios you can use ‘bcdedit /enum firmware‘ and delete unknown identifiers that way. Further more programs like VisualBCD can display the current bootloaders on your system; that is if you are able to boot.
  5. Next we will create the partition to copy the boot files over to, type ‘diskpart‘ and wait for the environment to load, next ‘list disk‘ to view a list of all the disks connected look at all the current disks and their sizes and the use ‘select disk {disk number}‘ to select the disk that the Windows OS is currently installed on; if you are unsure, select a disk and type ‘detail disk‘ afterwards to view the drive information; you are more than likely looking for a drive assigned the letter ‘C:
  6. Next we will list the partitions, ‘list part’ in a perfect world there is a Primary partition with the majority of the disk space listed, another recovery/EFI partition and maybe a Reserved partition for whatever else. We are focusing on the recovery partition; if it already exists for the sake of simplicity we are going to recreate it if it does not skip this next step.
  7. Type ‘select part {number of partition we plan to delete}‘ and then type ‘delete partition‘.
  8. If your EFI/Recovery partition already existed you can skip this next command, if it did not then before you create a partition you need to shrink your current main one, first select the partition where the main OS is; ‘select partition {number of partition where OS is located}‘ and then shrink it by 500MB, ‘shrink desired=500‘. Now we’re good to go.
  9. Create a new partition of size 500MB, ‘create partition efi size=500‘ and then format it to fat32 don’t worry this next command won’t format your original OS drive as long as you have the new partition selected but just to be safe ‘list part‘ and look at what partition is selected(it should have a star on the left-hand side of it) if it’s the wrong one then ‘select part {Number of the new 500MB partition you just created}‘. Format the partition by typing ‘format quick fs=fat32‘ and then assign a letter to the drive ‘assign letter=s‘. Type ‘list part’ and ‘list vol’ to verify everything is in the right place for me my OS drive is labelled ‘Boot’ and Recovery Drive ‘System’.
  10. Now the last step, type ‘exit‘ to leave diskpart and then ‘S:‘ or replace S with whatever drive letter you gave the recovery drive. Again if you were having issues formatting the drive you can also do it here with ‘format S: /FS:FAT32‘ but that’s besides the point. Next run ‘bcdboot C:\windows /s S: /f UEFI‘ this should work in all Windows 10 versions past 1709 and copy the boot files from the recovery device to your recovery partition. Now you should be ready to go with a working recovery partition and less of a headache visiting windows forums for a solution that never comes.

Enjoy!

Thanks for reading. Good luck & Stay Blessed.

EDIT: Changed 100MB Partition Size to 500MB to account for installing larger operating systems in boot loader in the future.

WordPress Dark Mode

Despite being ingrained in me that black text on white gives the best visuals for reading, I’ve become accustomed to white on black recently. A dark blackground is less harsh on my eyes… to the point where white backgrounds burn my eyes, esp at night or in indoor environments where I mostly operate.

Just installed the WP Dark Mode plugin here and it instantly makes my vision more comfortable. It doesn’t seem to apply to post creation though as I’m squinting to type this.

Found the plugin by searching “dark” in the plugins search function on the WP admin portal. It allows visitors to choose between white/dark mode with a moon icon in the lower right hand corner. On the admin portal, after you activate the plugin and go to settings to enable dark mode for the admin portal as well as for visitors. The white mode version of the admin portal still loads initially which then promptly gets replaced by a dark mode version.

Basic Video Editors: VLC, Video Editor, Movie Maker

Started uploading videos to Youtube recently. By no means are these viral videos or even professional videos, they’re merely unboxing videos I record as evidence in case something goes wrong. Does this still make me a Youtuber though??

In the past when shopping online, I’ve had the wrong products shipped, damaged merchandise, missing goods… just to name a few. In most cases I’ve had luck resolving the issue with the retailer but the experience of one or two disputes with customer service not going smoothly left me feeling not my best. With these videos there’s no debate as to whether I opened a working product and then later claimed it was damaged as some sellers alleged. I used to just delete the videos after confirming there was nothing wrong with the shipment and only save the ones that needed disputing.

So why am I uploading these videos to Youtube now? Why not? Much like this blog I don’t expect many to see, but it’ll serve as a record of what I bought, and when I bought it… Who knows? Maybe a video or two will end up helping someone. I do sometimes share the videos on forums or facebook to which some people do watch. There’s something about unboxing videos that pique people’s curiosity I suppose.

Most of the videos are single take and uncut thus far, shot on my phone which I then upload directly to Youtube… until today. I just uploaded a video of a belt I unboxed which I had to edit. The first clip was the belt unboxing itself and the second video was installing the belt into a buckle I had from an old belt that was pretty broken.

Originally I thought I could just use something simple like VLC to join the two MP4 files together but VLC 3.0.12 doesn’t seem to support joining videos anymore. I messed around with Video Editor that came installed with Windows 10 and while that did the job, the quality was pretty horrendous, with tons of artifacts. Youtube didn’t have a way to join two videos together despite the myriad of other online editing it allows you to do like blurring parts of the video, adding sound track, and overlaying links/cards. Finally gave Microsoft Movie Maker a shot.

Microsoft Movie Maker

I gave this a try cuz I wanted something simple to test out. Definitely not about to spend coin on Adobe Premiere and didn’t really want to install anything significant or invest in hardware to simply join two video files together.

The upside is that it works. I managed to join the two videos together, even cropped out the first few seconds where my address was showing on the package. Also managed to add a card in the middle of the two videos with text about adding the buckle. Using this allows me to skip questionable websites that join video files for free online. While using those would definitely have been quite simple, an IT security session I attended previously about Cloud Access Security Broker (CASB) clued me in to the hidden/implied user agreement and privacy concerns about using free websites to do file conversions and the sort.

The downside to Movie Maker is that the free version only outputs to 720p… it didn’t seem to let me choose the animation/transition of the credit screen I added for the “add buckle” text. (Granted, that was designed to be a credit screen.) Hence, the scrolling text. *Cringe* And even at 720p output, the visual quality wasn’t quite the same as the original videos.

All in all though, I spent probably less than 10 minutes downloading/installing and editing the video so I can’t ask for much. There is probably a feature somewhere to do the text card probably that I missed, or maybe it’s a paid feature. Much like exporting to 1080p or 4K is a paid feature. It did the job this time but I’ll probably keep looking.

Next steps

This did get me interested in researching other video editors, probably open source ones. Will I end up editing the heck out of my videos like a proper Youtuber? Probably not.

A quick google search introduced me to OpenShot. I’ll probably take a look at a few more in my spare time.

Here’s the video I uploaded if you’re interested:

https://youtu.be/JLcue3VIEbU

Nextcloud server running out of space

The 50GB I provisioned to the Nextcloud HyperV VM is filling up fast. There’s less than 9% left available. I grew this from 10GB to 20GB to 50GB. Today we’re growing it to 60GB only. I could grow it even bigger but I don’t expect it to grow much larger much faster as the bulk of the storage is photos and videos from my mobile devices. Plus coming back to expand the hard drive once a few months is good practice and reminder of how to do this in Linux.

Since this is a Ubuntu server, I followed the instructions I found here: https://vander.host/knowledgebase/operating-systems/how-to-resize-an-ubuntu-18-04-lvm-disk/. It says 18.04 but it works on my 20.04 LTS as well.

Before getting into Ubuntu, I started by expanding the VHDX in Hyper V. Actually before this step, I merged the old checkpoints first. (In retrospect I probably should’ve created a new checkpoint at this stage but I have multiple backups to restore from… so YOLO!)

After this, Ubuntu needed a reboot to recognize the new disk size for some reason. I thought I remember the last time I did this I was able to do everything online without unmounting anything or rebooting anything. Need to look this one up.

Edit 5/21/2021:
To rescan disks:
echo ‘1’ > /sys/class/scsi_disk/0\:0\:0\:0/device/rescan

Once fdisk -l showed the new disk size I ran through the rest of the following commands to resize the partition/physical volume/logical volume/filesystem to recognize the new disk space.

Ubuntu Commands

  • echo ‘1’ > /sys/class/scsi_disk/0\:0\:0\:0/device/rescan
  • fdisk -l (note it’s partition 3 by looking at the current Size)
  • parted
    • resizepart, Fix, 3, 100% (type this instead), quit
  • pvresize /dev/sda3
  • lvextend -l +100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv
  • resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv
  • df -h

By default the system will prompt you for size in GB but you can actually type 100% and 100%FREE to use up all of the space without having to calculate down to the decimals or leaving unused space to specify a GB amount.