Mounting NFS Share on Windows 10 & 11 with Write Access

It is easy to mount a drive from Linux NFS share on Windows 10 & 11 machines. To do that make sure you have NFS Client (Services for NFS) installed from Programs and Features. Following is the command to mount the NFS drive. Note that this command will run on cmd (Command Prompt) and not on PowerShell.

mount \<IP_ADDRESS>\<PATH_TO_DIR>\ drive:

For example, if the IP address of the NFS share is 10.235.0.10 and the directory you want to share is /var/www and you want to mount it to your Z drive, then you can run the following command.

mount \\10.235.0.10\var\www z:

But when you mount the drive you can browse the files using your Windows Explorer but you cannot create new files or edit any files.

How to enable write access on NFS share?

To get write access on NFS share you have to make a small change in the Windows registry before mounting the drive. Follow these steps.

  1. Open regedit by typing it in the search box end pressing Enter.
  2. Browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default.
  3. Create a new New DWORD (32-bit) Value inside the Default folder named AnonymousUid and assign the UID found on the Linux directory as shared by the NFS system. This is the UID of the user that has the write access to that directory on the Linux system.
  4. Create a new New DWORD (32-bit) Value inside the Default folder named AnonymousGid and assign the GID found on the Linux directory as shared by the NFS system. This is the GID of the group that has the write access to the directory on the Linux system.
  5. Restart the NFS client or reboot the machine to apply the changes.

Now run the mount command and you will get the write access.

Click here to read more about Microsoft Windows.

And click here to read more about Linux. 

How to partition SD Card

If you’ve rooted your phone using Revolutionary you can partition your SD Card from the Recovery menu. After booting into recovery (Revolutionary CWM), you have an option Partition SD Card. It will ask you how big the EXT partition should be, and how big the Swap partition should be. After selecting the right values, it will automatically partition your SD Card.

If you didn’t use Revolutionary to root your phone, you can still follow the tutorial from here, and after inserting the key, it says that your phone is S-OFF, but it still asks you if you want to install Clockwork Mod. Press y and Enter and wait until the CMD disappears. Reboot into recovery once again and you should see the Partition SD Card option that I was talking about in the first paragraph.

Note that creating partitions this way will result having an EXT3 partition. If you want an EXT4 partition, connect to the phone with adb shell and follow only the 6th step of the following tutorial.

How manually partition SD Card

Don’t be afraid to do something manually. It may be a little bit harder than using a specialized software, but you can learn new things and you know you did it and it worked. For example, partitioning from ROM Manager proved to be a mistake, because I couldn’t select an EXT Partition bigger than 512Mb and it practically messed up my partitions… and using gParted to partition your SD Card is a little bit difficult since you have to install the image on a CD or stick, reboot your PC in gParted and try to get things working from there. From my experience, every time I’ve tried this using a stick to load the image, I couldn’t see the SD Card.

So.. doing something manually is better Smile

Step 1 – Connect to Phone

Restart your phone to recovery mode. Connect your phone to the PC via USB Cable. Use adb shell to connect to the phone

Step 2 – Display the partitions

Open parted (an application from the Android OS) to partition your SD Card
After you connect with adb shell write parted /dev/block/mmcblk0 and then <Enter>. Wait until you see (parted) in the left if your cursor and write print and <Enter>. You should get something like this:

parted_1

As you can see, I’ve got a 3942MB SD Card. It has 3 partitions

  • Number 1 – 2886MB FAT32
  • Number 2 – 1024MB EXT3
  • Number 3 – 31.6MB linux-swap

I’m going to remove all these partitions in order to repartition the card. Note that you’ll lose all your data from the card.

Step 3 – Remove the existing partitions

You’ll have to remove the existing partitions first. So.. look at how many partitions you have, and then write remove <space> partition number <Enter>. 
For example:
rm 1
rm 2
rm 3

parted_2

You can run the print command again to make sure everything was deleted. Now I have an empty unpartitioned SD Card

Step 4 – Create the partitions

Ok, let’s start computing the partitions size. For most of the custom ROM, you need an 1GB EXT partition, and a FAT32 partition.. You’ll also need a swap of 32 or 64MB. So, let’s say that you want to create a 1024MB EXT and a 32MB swap partition. Subtract these values from the entire partition size, and you’ll get the needed size of your FAT32 partition. In my case, I have a3942MB card, so 3942-1024-32 = 2886MB for FAT32

In conclusion, we’ll have to create:

  • 2886MB FAT32
  • 1024MB EXT2 (because parted only allows us to create EXT2 partitions, but we’ll convert it to EXT3 or EXT4 at the end of the tutorial)
  • 32MB swap

Now run the following commands in the (parted) shell:

  • mkpartfs primary fat32 0 2886 (first value is 0, second value is the size of FAT32 partition)
  • mkpartfs primary ext2 2886 3910 (first value is the size of FAT32 partition, second value is EXT4 partition> in our case 2886+1024=3910)
  • mkpartfs primary linux-swap 3910 3942 (first value is EXT4 partition>, in our case 2886+1024=3910, second value is the size of the entire SD Card, in our case 3942)

Note that for every command, the first value is the second value from the previous command. The first value from the first command should be 0 and the second value from the last command should be the size of the entire SD Card.

After you finish with creating the partitions, run print again and you’ll see the newly created partitions:

parted_3

If everything is ok, run quit to exit the parted, and return to the adb shell

parted_4

Step 5 – convert your EXT2 partition to EXT3 (skip it if you don’t want to do this)

In the adb shell, run the following command to convert your EXT2 partition to EXT3

Note that the last number from the command, 2, refers to the second partition. If your EXT2 partition has another number assigned (you can view the number using the print command), replace the “2” with your number, but if you’ve followed the tutorial and you didn’t create more or less partitions, it should be 2 )

tune2fs -j /dev/block/mmcblk0p2

toext3

Step 6 – convert your EXT3 partition to EXT4 (skip it if you don’t want to do this, but you must follow Step 5 if you have an EX2 partition to convert it to EXT3)

In the adb shell, run the following command to convert your EXT2/3 partition to EXT4

Note that the last number from the command, 2, refers to the second partition. If your EXT partition has another number assigned (you can view the number using the print command), replace the “2” with your number, but if you’ve followed the tutorial and you didn’t create more or less partitions, it should be 2 )

tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2

toext4

If you want to check your filesystem too, you should run e2fsck -fpDC0 /dev/block/mmcblk0p2too

Step 7 – Finish

Finished. Check your work with print.

  • command:  parted /dev/block/mmcblk0 (open parted again)
  • command:  print (check all your system partitions and their sizes)
  • command:  quit (exit parted)
  • command:  reboot (reboot your system to the operating system)

Step 8 – Align your SD Card (optional)

In order to increase the access time, write speed and read speed of your SD Card, you may want to follow this tutorial

[Ref: http://android.bytearrays.com/android/how-to-partition-sd-card/]

Connecting to Amazon Linux/UNIX EC2 Instances from Windows Using PuTTY

To connect to your Linux/UNIX instance from a Windows machine, use an SSH client. The following instructions explain how to use PuTTY, a free SSH client for Windows machines.

Converting Your Private Key

PuTTY does not natively support the private key format generated by Amazon EC2. Fortunately, PuTTY has a tool called PuTTYgen, which can convert keys to the required PuTTY format.

To convert your private key

  1. Start PuTTYgen (e.g., from the Start menu, click All Programs > PuTTY > PuTTYgen).
  2. Click Load and browse to the location of the private key file that you want to convert (e.g., GSG_Keypair.pem). By default, PuTTYgen displays only files with extension .ppk; you’ll need to change that to display files of all types in order to see your.pem key file. The private key file must end with a newline character or PuTTYgen cannot load it correctly. 

     

  3. Select your .pem key file and click Open.PuTTYgen displays the following message.

     

     

    When you click OK, PuTTYgen displays a dialog box with information about the key you loaded, such as the public key and the fingerprint. The keys that Amazon EC2 generates are 1024-bit SSH-2 RSA keys.

  4. Click Save private key to save the key in PuTTY’s format.PuTTYgen asks if you want to save the key without a passphrase.

     

     

  5. Click Yes.
    [Note] Note
    A passphrase on a private key is an extra layer of protection, so even if your private key is discovered, it will not be usable without the passphrase. The downside to using a passphrase is that it makes automation harder because human intervention is needed to log on to an instance, or copy files to an instance. For this exercise, we’re not using a passphrase.
  6. Name the key with the same name you used for the key pair (e.g., GSG_Keypair). PuTTY automatically adds the .ppk file extension.

Your private key is now in the correct format for use with PuTTY. You can now connect to your instance using PuTTY’s SSH client.

Connecting Using PuTTY SSH

You’ll connect by starting a PuTTY SSH session.

To use SSH to connect

  1. If you’ve launched a public AMI that you have not rebundled, run the ec2-get-console-output command on your local system (not on the instance), and locate the SSH HOST KEY FINGERPRINTS section. For more information, go to ec2-get-console-output in the Amazon Elastic Compute Cloud Command Line Reference.
    PROMPT>  ec2-get-console-output instance_id
     ... ec2: -----BEGIN SSH HOST KEY FINGERPRINTS----- ec2: 2048 bc:89:29:c6:45:4b:b3:e2:c1:41:81:22:cb:3c:77:54 /etc/ssh/ssh_host_key.pub ec2: 2048 fc:8d:0c:eb:0e:a6:4a:6a:61:50:00:c4:d2:51:78:66 /etc/ssh/ssh_host_rsa_key.pub ec2: 1024 b5:cd:88:6a:18:7f:83:9d:1f:3b:80:03:10:17:7b:f5 /etc/ssh/ssh_host_dsa_key.pub ec2: -----END SSH HOST KEY FINGERPRINTS-----
    ...

    Note the fingerprints so that you can compare them to the fingerprints of the instance.

  2. Start PuTTY (e.g., from the Start menu, click All Programs > PuTTY > PuTTY).A dialog box opens with a Category menu on the left side. On the right side, the basic options for your PuTTY session are displayed.
  3. In the Host Name field, enter the public DNS name of your instance (available through the AWS Management Console or theec2-describe-instances command). You can optionally prefix the DNS name with [email protected] to automatically log in with superuser privileges when the session opens. 

     

  4. In the Category menu, under Connection, click SSH, and then Auth.The options controlling SSH authentication are displayed.
  5. Click Browse and navigate to the PuTTY private key file you generated in the preceding section. 

     

  6. Click Open.An SSH session window opens and PuTTY displays a security alert asking if you trust the host you’re connecting to.
    [Important] Important
    If you’ve launched a public AMI, verify that the fingerprint in the security alert matches the fingerprint from the output of the ec2-get-console-output command. If it doesn’t, someone might be attempting a “man-in-the-middle” attack.
  7. Click Yes.
  8. In the SSH session window, log in as root (or ec2-user) if you didn’t as part of starting the SSH session.
    [Note] Note
    Some AMIs let you log in as root, but some require you to log in with the username ec2-user. For log in information for your chosen AMI, contact your AMI provider directly or go to Amazon Machine Images(AMIs) page, then locate and click your AMI on the list.
    [Note]
    Note
    If you specified a passphrase when you converted your private key to PuTTY's format, you must provide that passphrase when you log in to the instance.

    [Reference: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?LaunchingAndUsingInstances.html]

Installing IBM WebSphere MQ Client on Linux

This is the second part in the IBM WebSphere MQ series. Installing IBM WebSphere MQ client is also very easy. It takes just a few minutes to install. IBM WebSphere MQ Client can be downloaded from http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg24019253.

Extract it to some folder (e.g /root/download/wmqc) after download. Then follow these steps.

1. cd /root/download/wmqc
2. ./mqlicense -accept

This is necessary since this instructs to accept the license, otherwise you will not be able install WebSphere MQ. If this gives a JRE error then give the JRE path like this:

2. ./mqlicense -accept -jre PATH_TO_JRE
3. rpm -ivh MQSeriesClient-x.x.x-x.i386.rpm MQSeriesRuntime-x.x.x-x.i386.rpm

where x.x.x-x is the version number like 7.0.1-1

That’s it! WMQ client has been installed. Now you can connect to WMQ server on another machine, or install WMQ SDK to start developing applications for IBM WebSphere MQ.

This is necessary since this instructs to accept the license, otherwise you will not be able install WebSphere MQ. If this gives a JRE error then give the JRE path like this:

2. ./mqlicense -accept -jre PATH_TO_JRE

Installing IBM WebSphere MQ Server on Linux

This is part 1 of the series on IBM WebSphere MQ. Installing IBM WebSphere MQ server on a Linux machine is easy. It takes just a few minutes to install. IBM WebSphere MQ can be downloaded from http://www.ibm.com/developerworks/downloads/ws/wmq/.

Extract it to some folder (e.g /root/download/wmq) after download. Then follow these steps.

1. cd /root/download/wmq
2. ./mqlicense -accept

This is necessary since this instructs to accept the license, otherwise you will not be able install WebSphere MQ. If this gives a JRE error then give the JRE path like this:

2. ./mqlicense -accept -jre PATH_TO_JRE
3. rpm -ivh MQSeriesServer-x.x.x-x.i386.rpm MQSeriesRuntime-x.x.x-x.i386.rpm

where x.x.x-x is the version number like 7.0.1-1

That’s it! WMQ server has been installed. The next steps include adding users in mqm group to grant access to users to perform certain operations like creating/deleting queue manager and queues, then creating queue manager then configuring it.

Setting up a CVS repository

Setting up a CVS repository is very easy. First create a directory where you want your CVS repository to be located. For example create a folder /cvsroot. Change you directory to /cvsroot and run the following command.

# cvs -d /cvsroot/ init

Obviously, you should have CVS installed. This command will initialize your CVS repository. Remember not to run this command after adding projects/modules, otherwise it will wipe out all your files. After initializing you can add projects to it. Thats it! your CVS repository is ready. Go and add your projects 🙂

What processes are using a particular port?

If you want to see how many processes are connected on a particular port, you can use the following command on Linux platform:

lsof -i tcp:1234

Command is self descriptive. It will show only TCP connections using port 1234. Among other information this command also shows the process, its PID, user, and the IP/Port it is using.