Some days ago I was working with some Linux distribution and used my 16GB USB drive for installation, so after playing with the Linux image, I tried to remove Linux from USB and tried formatting the USB but Windows start giving me errors, that USB is “read only” and Windows can not format that particular USB Device.

So I search for the error and found, how to fix it, sharing it for others, who are facing same issue.

Press Win+R to open the Run box

Type diskpart in the run box, like the screen shot above.

At the DISKPART> prompt, type list disk and press enter

list disk

From the size of the disk, you should be able to figure out which one is your removable disk. In this example, we know that Disk 1 is our removable USB thumb drive because its size is listed as 14 GB, make sure you select the correct disk, otherwise you can lose your data in other drives.

Select your removable disk with the select disk command. In this example, we want to work with disk 1, so the command is

select disk 1

To clear the read-only attribute (making the disk writable), use the command

attributes disk clear readonly


Then type command

clean

That should do the trick, now exit and now you can use your usb again, you can try that with other types, like SSD, External drives etc.

*Also you can write protect your drives like this, for locking USB drives in future, you need to change the command, like this:
attributes disk set readonly

 

Now back to real topic if the above steps didn’t work for you like in my case, then you need to create partition and format the drive (formatting is optional), as you can do it from GUI too.

For creating partition, you need to repeat the above steps and use the command

create partition primary

Then select the partition by

select partition 1

and format it like

format FS=NTFS label=WC-Drive quick


Here we are formatting with NTFS file system, you can change it to FAT and VFAT if you want.

 

That’s it, you can now exit and you can see the USB in Windows Explorer, use it again like before 🙂

Enjoy & Take care

To work around this issue, add the EnableAggressiveMemoryUsage registry entry to the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters

Then, set the EnableAggressiveMemoryUsage registry entry to 1.

To do this, follow these steps:

  1. Click Start, click Run, type regedit in the Open box, and then click OK.
  2. Click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
  3. On the Edit menu, point to New, and then click DWORD Value.
  4. Type EnableAggressiveMemoryUsage, and then press ENTER.
  5. On the Edit menu, click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. On the File menu, click Exit to exit Registry Editor.
  8. Restart the HTTP service. To do this, follow these steps:
    1. Click Start, click Run, type cmd in the Open box, and then click OK.
    2. At the command prompt, type net stop http /y, and then press ENTER.
    3. At the command prompt, type iisreset /restart, and then press ENTER.

Customizing the MOTD – Linux, BSD

Posted: 20th February 2016 by Babar Shafiq in System Administration

 

If you want your custom logo, or custom info to also be shown whenever any user logs into the machine you can do so with

For CentOS :-
yum install figlet

For Debian :-

$ sudo apt-get update
$ sudo apt-get install toilet figlet

For BSD:-

cd /usr/ports/misc/figlet && 
make install distclean
figlet We-Rock

Copy Paste the output in motd

# vim motd

Fingerprinting / Identify Remote Web Server

Posted: 18th January 2016 by Babar Shafiq in System Administration, Tips

telnet – Identify remote web server

Use telnet to connect to remove web server, enter
$ telnet www.vivekgite.com www
Output:

Trying 74.86.49.130...
Connected to www.vivekgite.com.
Escape character is '^]'.

Request header, enter the following command and hit [ENTER] key twice:
HEAD / HTTP/1.0
Output:

HTTP/1.0 200 OK
Connection: close
X-Pingback: http://www.cyberciti.biz/tips/xmlrpc.php
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Date: Mon, 28 Jan 2008 08:50:55 GMT
Server: lighttpd
Connection closed by foreign host.

curl – Identify remote web server

Type the command as follows:
$ curl -I http://www.remote-server.com/
$ curl -I http://vivekgite.com/

Output:

HTTP/1.1 200 OK
Content-type: text/html
Content-Length: 0
Date: Mon, 28 Jan 2008 08:53:54 GMT
Server: lighttpd

I was trying to build a webserver for just displaying a simple message but I don’t want to use Apache/IIS/nginx etc.
So I tried nodejs and literally it is so easy to write a webserver in just 15 lines of code.

Webserver:

  • which can show static index.html page
  • which can log remote client IPs
  • which can use port from commandline to listen.
  • Portable, can run same code on Windows/Linux

Read the rest of this entry »

Have you ever encountered out of disk space issues on your wonderful VMs when trying install a critical application? Here are a few easy steps that help you to solve the disk space problems on your VMware workstation VMs Read the rest of this entry »