Feb 21, 2024

Windows 10 : Create Recovery Partition

Sometimes we just need to fix the Windows Recovery Partition or just wanted to increase that partition size so that Windows Update able to run without any error.

The recommended Recovery Partition size by Microsoft is at least 1GB.

There are 2 scenarios here :-

1. The Recovery Partition is NOT available in the HDD/SSD.

2. The Recovery Partition is available but the size is too small (eg. less than 1GB).


METHOD 1 (No Recovery Partition).

1. Open --> Computer Management.

2. Goto --> Disk Management.

3. Right-Click on [C:] drive, select --> Shrink Volume.

4. Decrease the [C:] drive volume, enough to have a balance of 1GB (or 1000 MB).

5. Once the [C:] drive volume have shrinked successfully, you will now see an empty volume available.

6. Create the a new partition on the empty volume, FORMAT it but do not assign any drive letter yet.

6. Now, open --> CMD (as admin).

7. Run --> Diskpart utility and set the correct configurations for Recover Partition to work.

C:\>diskpart

8. List all available drive and select the correct drive.

DISKPART>list disk

DISKPART>select disk 0

9. Next, is to display all the available partition in that drive and select the new partition. Assuming that the new partition is numbered 4.

DISKPART>list partition

DISKPART>select partition 4

10. Now we need to configure the partition, depending on your drive's configuration it may either be MBR or GPT type. Choose the correct command based on your drive's configuration.

MBR
DISKPART>set id=27

GPT
DISKPART>set id=06d1-4d40-a16a-bfd50179d6ac

DISKPART>gpt attributtes=0X8000000000000001

11. Once done, just exit the Diskpart utility.

12. Now we need to enable and create the recovery partition. This make take a while to complete.

C:\>reagentc /enable

13. Once completed, you should now be able to view the new partition have been identified as "Recovery Partition" in the Disk Management panel.


METHOD 2 (Exiting Recovery Partition).

1. If there is an existing Recovery Partition in the drive, we need to first disable it. Open --> CMD (as admin).

C:\>reagentc /disable

2. Next is to run Diskpart utility.

C:\>diskpart

3. List all available drive and select the correct drive.

DISKPART>list disk

DISKPART>select disk 0

4. Next, is to display all the available partition in that drive and select the new partition. Assuming that the existing Recovery Partition is numbered 4.

DISKPART>list partition

DISKPART>select partition 4

5. As the Recovery Partition cannot be deleted, we need to force delete the partition.

DISKPART>delete partition override

6. Open --> Computer Management.

7. Goto --> Disk Management.

8. Right-Click on [C:] drive, select --> Shrink Volume.

9. Decrease the [C:] drive volume, enough to have a balance of 1GB (or 1000 MB) on the empty volume.

10. Once the [C:] drive volume have shrinked successfully, you will now see an empty volume available.

11. Create the a new partition based on the empty volume, FORMAT it but do not assign any drive letter yet.

12. Back to the command prompt and while still in Diskpart utility, we need to ensure the correct partition is selected.

DISKPART>select partition 4

13. Now we need to configure the partition, depending on your drive's configuration it may either be MBR or GPT type. Choose the correct command based on your drive's configuration.

MBR
DISKPART>set id=27

GPT
DISKPART>set id=06d1-4d40-a16a-bfd50179d6ac

DISKPART>gpt attributtes=0X8000000000000001

14. Once done, just exit Diskpart utility and next is to re-enable back the Recovery Partition. This may take a while to complete.

C:\>reagentc /enable

15. Once completed, you should now have a larger Recovery Partition size in the Disk Management panel.



!!! HAPPY COMPUTING !!!


Feb 1, 2024

ProjectSend : Self-Hosted Large File Sharing Server

Most companies now days needs a way to share large file(s), whether the intended recipient is a Customer, Supplier or among the Employees itself.

Most have known that there is a limitation on Email's attachment, the file size solely depends on which Email Provider you are using. The most common would be Microsoft Exchange, Exchange Online, Microsoft 365, Google Enterprise (aka Workspace) and many more. All these services have a limitation of email attachment, for example; Exchange Online have a limit of a maximum of 150MB size only.

What if you wanted to send larger file size, let's say an AutoCAD or Photoshop file ? These file can be very large depending on the contents.

While there are so called "FREE" large file sharing services available, but these services also have some limitations. These includes the lacks of tracking, security and reporting, some may also needs you to register for an account before using.

Do you really trust them with your information ??? 😏

Furthermore there is also limit on the storage of how many file(s) or folder(s) you wanted to share and for how long you can to keep it.

Thus it make sense that we need to self-host a file sharing server with the following conditions :-
  • The sharing have custom expiry date.
  • Only intended recipient(s) able to download or access it.
  • Able to notify the recipient(s) via email.
  • Able to track how many times the file(s) was downloaded.
  • Able to track who is the sharer or uploader.
  • And lastly, the ability to have logs for auditing purposes.
So, today I will be showing you the installation of yet another Open Source Software, called ProjectSend. If you find this software useful, please donate to them. Your donation will ensure they are able to continue to develop the software.

Let's start ...


1. As always, ensure you have Ubuntu Server v.22.04.3 installed and updated.

sudo apt update && sudo apt upgrade -y


2. Next is to install a Web Server and a Database Server.

sudo apt install apache2 mariadb-server -y


3. We also need to install other pre-requisites.

sudo apt install imagemagick php libapache2-mod-php php-imagick php-common php-mysql php-gd php-json php-curl php-zip php-xml php-mbstring php-bz2 php-intl php-bcmath php-gmp unzip -y


4. Next is to modify the PHP configuration.

sudo nano /etc/php/8.1/apache2/php.ini

Modify the following accordingly, as per your needs in "RED" text below.

memory_limit = 512M
upload_max_filesize = 10240M
max_execution_time = 600
post_max_size = 512M
date.timezone = Asia/Kuala_Lumpur


5. Now we need to secure our database server first.

sudo mysql_secure_installation

You will be prompted with the following questions, please answer as per your needs in "RED" text below.

Enter current password for root (enter for none): [PRESS ENTER]
Set root password? [Y/n]: Y
New password: [Key-In Password]
Re-enter new password: [Repeat password]
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y


6. Then we can create the database for this software.

sudo mysql -u root -p

You will be prompted to login, type-in the password you have created earlier. And follow the below commands to continue. You may replace the "RED" text as you deemed fits.

CREATE DATABASE projectsend;

CREATE USER 'projectsenduser'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON projectsend.* TO projectsenduser@localhost;

FLUSH PRIVILEGES;

QUIT;


7. Now, we need to download the latest ProjectSend file, as at time of writing the latest version was located in sub-folder "614", as such the newer version may have new sub-folder. Always check their website for the latest version and requirements.

sudo wget -O projectsend.zip https://www.projectsend.org/download/614/


8. Once download completed, unpack the file accordingly.

sudo unzip projectsend.zip -d /var/www/html/projectsend


9. Next is make a backup copy of ProjectSend's configuration file.

cd /var/www/html/projectsend/includes/

sudo cp sys.config.sample.php sys.config.php


10. Modify the configuration file accordingly, replace "RED" text according to you database created earlier.

define('DB_DRIVER', 'mysql');
/** Database name */
define('DB_NAME', 'projectsend');

/** Database host (in most cases it's localhost) */
define('DB_HOST', 'localhost');

/** Database username (must be assigned to the database) */
define('DB_USER', 'projectsenduser');

/** Database password */
define('DB_PASSWORD', 'password');

/** Define a maximum size (in mb.) that is allowed on each file to be uploaded.
define('MAX_FILESIZE',1024);


11. Assign to correct permissions accordingly.

sudo chown -R www-data:www-data /var/www/html/projectsend

sudo chmod -R 775 /var/www/html/projectsend

sudo chmod 644 /var/www/html/projectsend/includes/sys.config.php


12. Now we need to create configurations for Apache2.

sudo nano /etc/apache2/sites-available/projectsend.conf

Modify the configurations accordingly as per "RED" text below.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName projectsend.demo.com.my
    ServerAlias www.projectsend.demo.com.my
    DocumentRoot /var/www/html/projectsend/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/html/projectsend/>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>


13. Next is to enable Apache2's Rewrite module.

sudo a2enmod rewrite


14. Now we need to enable the new projectsend site.

sudo a2ensite projectsend.conf


15. Restart Apache2 server.

sudo systemctl restart apache2


16. On another computer, open any preferred browser (eg. Google Chrome) and browse to the following URL.

http://projectsend.demo.com.my

OR

http://[IP Address]

You will now be automatically prompted to create the "Administrator" credentials, proceed to key-in your preferred administrator's name and password accordingly. Click on the "INSTALL" button when done.

This may take a while, depending on your server's hardware specifications.


17. Since this server will be access from the Internet, it is recommended to secure the server. You might also want to consider installing "Fail2Ban" for extra security measures.

sudo ufw enable

sudo ufw allow http

sudo ufw allow https


18. Now we need to install Let's Encrypt certificate to make it more secure.

sudo apt install certbot python3-certbot-apache -y

sudo certbot --apache

You will be prompted for some information and selections, for SSL to works you need a valid email address. Also ensure that your Firewall or Router's Port Forwarding is configured correctly. The required port is 80 (HTTP) and 443 (HTTPS).

Enter email address (used for urgent renewal and security notices)
  (Enter 'c' to cancel): [Your Email Address]

Please read the Terms of Service at https://letsencrypt.org/LE-SA-v1.3-September-21-2022.pdf. You must agree in order to register with ACME server. Do you agree?
(Y)es/(N)0: Y

Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot ? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support freedom.
(Y)es/(N)o: N

When prompted for domain selection, you can select according to your needs. In this case I would select all domains by just pressing [ENTER] key to leave it blank.

Which names would you like to activate for HTTPS for?
----------------------------------------------------------------------------------------------------------------
1: projectsend.demo.com.my
2: www.projectsend.demo.com.my
----------------------------------------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): [Press Enter]


19. Finally, another restart of Apache2 server and your ProjectSend site is now with SSL.

sudo systemctl restart apache2


Edit : 18-Nov-2024, Uploaded Youtube Video.




!!! HAPPY COMPUTING !!!