Removable EXTx drive for non-root Linux user

Today, we will cover setting up an external removable drive using the EXT3 file system, and to allow us to mount the drive as a normal (non-root) user. This allows us to keep existing Linux file permissions when we write to the drive, and features journaling which ensures that what we write to the removable drive, is completely written to disk.

This system also allows us to easily create separate mount points for distinct removable drives, which facilitates the use of multiple drives in a scripted backup strategy.

So let’s get started!

First thing we do is determine how the drive is recognized by the kernel:

From the command prompt:

sudo tail -f /var/log/messages
or
su -c tail -f /var/log/messages

and look for something on the order of “[sdb] Attached SCSI disk” after we plug in our removeable device.

The kernel output will tell us if there are any existing partitions (look for “sdb1″, “sdc1″ etc.)

Ctrl-C to exit tail

Next we need to create a partition table, if there are existing partitions you’ll need to ensure thay do not contain important data before you remove or overwrite them.

Again from the command prompt:

sudo fdisk /dev/sdb
or
su -c fdisk /dev/sdb

Choose “n” for “new partition”

Then “p” for “primary partition”

Then “1” for the first partition.

Then the defaults for the sectors.

Then “w” to write changes and quit.

Our next step is to create a filesystem

Again from the command prompt:

sudo mkfs.ext3 /dev/sdb1
or
su -c mkfs.ext3 /dev/sdb1

This might take a while depending on the drive size

While we wait, open another terminal window and continue working.

We are going to name our disk “BU_Linux” but feel free to change the name, but avoid spaces and wildcard/reserved characters in the name (No: “.”, “\”, “?”, “!”, etc.). We will mount the disk using the same name under the “/media” directory.

Again from the command prompt:

sudo mkdir -p /media/BU_Linux
or
su -c mkdir -p /media/BU_Linux

Next we need to backup “/etc/fstab”

sudo cp /etc/fstab /etc/fstab.org
or
su -c cp /etc/fstab /etc/fstab.org

Then we can edit “etc/fstab” using vi:

sudo vi /etc/fstab
or
su -c /etc/fstab

and add a line as below:

"LABEL=BU_Linux  /media/BU_Linux  ext3  defaults,user,noauto  0 0"

We then will go back to our prior console window, hopefully mkfs.ext3 has finished.

We now create the disk label using “e2label” which can display or change the filesystem label on the ext2, ext3, or ext4 filesystems.

Again from the command prompt:

sudo e2label /dev/sdb1 BU_Linux
or
su -c e2label /dev/sdb1 BU_Linux

Now let’s mount the drive!

Again from the command prompt:

mount -L BU_Linux

Let’s check if the drive is mounted.

Again from the command prompt:

mount |grep BU_Linux

Which should return:

“/dev/sdb1 on /media/BU_Linux type ext3 (rw,noexec,nosuid,nodev,user=MyUserName)”

Now let’s examine the drive.

Again from the command prompt:

df -h /media/BU_Linux

Which tells us how much free space is available

and

ls -al /media/BU_Linux

which should show us the “lost+found” directory

Now if we try to write a file ie.:

echo "This is a test" > /media/BU_Linux/test.txt

You’ll see that you cannot write to the disk.

So let’s fix this!

Again from the command prompt:

sudo chmod 777 /media/BU_Linux
or
su -c chmod 777 /media/BU_Linux

And try again!

echo "This is a new test" > /media/BU_Linux/new_test.txt

And we should have success.

This change will survive remounts because the permission you just changed is resident on the volume’s filesystem.

When you are finished you’ll need to unmount the file system before removing the drive.

Again from the command prompt:

umount /dev/sdb1

vCenter 5.1 Simple Install – Not so simple

VSphere 5.1 came out just over a month ago, introducing a number of new features. One of particular importance to the userbase, is the addition of Single Sign On (SSO) to vCenter, and the separation of vCenter Inventory Service from the vCenter Server core. If you are setting up a proof of concept or lab environment, you are likely to choose the vCenter Simple Install which installs these three components on a single machine under one unified installer.

When both upgrading from vCenter 5.01 and doing a fresh install on a new x64 Windows 2008 Standard Edition R2 server, we encountered significant problems using the Microsoft SQL Server 2008 R2 Express database that is bundled with vCenter Server.

During the upgrade procedure your are prompted to use an existing database, and since you already have the express database installed you’ll likely want to just add a new database to the existing database instance. In order to use your existing database your are prompted for the database’s “sa” password, which we actually do not know. You may input any password to enable the SA account and set the password, but you’ll need to comply with the OS’s password policy. For a Server 2008 R2 Standard host:

Passwords must be at least six characters in length.
Passwords must contain characters from three of the following four categories:

  • English uppercase characters (A through Z).
  • English lowercase characters (a through z).
  • Base 10 digits (0 through 9).
  • Non-alphabetic characters (for example, !, $, #, %).

If you mistakenly enter a password that fails to meet the password complexity requirements, the installation fails soon thereafter. In order to resume the installation you’ll need to reset the “sa” password to meet complexity requirements. Below is one method from the command line:

sqlcmd –S 'localhost\VIM_SQLEXP'
sp_password @new = 'newpassword', @loginame = 'sa'
go
ALTER LOGIN sa WITH PASSWORD = 'newpassword' UNLOCK
go
exit

During a fresh installation we run into a few issues.

Firstly, we need to setup a x64 OBDC DSN, which is difficult to do before you start your vCenter 5.1 Simple Install, as there is no database installed! So, when the installer gets to installing vCenter Server, you’ll need to: cancel out of the installation, set up the DSN as shown below, then restart the vCenter Server installation.

On your Windows Server:

  1. Go to "Administrative Tools"
  2. Go to "Data Sources (ODBC)"
  3. Select "System DSN"
  4. Select "Add"
  5. Select "SQL Server Native Client 10.0"
  6. In the "Name" field enter "Vcenter DSN" or something similar
  7. In the "Description" field enter whatever you like
  8. In the "Server" drop down list select "localhost\VIM_SQLEXP"
  9. Goto the next page
  10. Select "With Integrated Windows authentication"
  11. Goto the next page
  12. Select the "Change the default database to:" and choose "RSA"
  13. Goto the next page
  14. Select "Finish"


Secondly, once we finish the installation we are allowed to log in ONE TIME to vCenter Server using your existing, Windows AD or localhost, credentials (you will also need to deal with the browser certificate errors) when using the vSphere Web Client.

In order to log into vCenter Server, you’ll need to configure your vCenter SSO credentials, so fire up the vSphere Web Client:

  1. Login as "admin@System-Domain"
  2. Navigate to "Home"
  3. Select "Administration"
  4. Select "Sign-On and Discovery - Configuration"
  5. Under "Identity Sources" make sure your preferred group is present
  6. Select "SSO Users and Groups"
  7. Under "vCenter Single Sign On Users and Groups" select the "Groups" tab
  8. Select "_Administrators_" then click on the little person with the "+" sign
  9. Select your preferred "Identity Source" from the pull down menu
  10. Select your vCenter administrative user and/or group and click "add"
  11. Click "Okay" then log out of the vSphere Web Client

You should now be able to login to your vCenter Server using the vSphere Web Client. In the case of using the local administrator account we had to use the username of “administrator@administrators”, which may be a side effect of adding both the local “administrator” user and “administrators” group to our list of preferred “Identity Sources”

Good luck and I hope you’ve found this information useful in your VMware vCenter Server 5.1 installation.