New Virtual Machines: NAS4Free

Taken from Nas4Free.org:

NAS4Free is an embedded Open Source Storage NAS (Network-Attached Storage) distribution based on FreeBSD. This project is a continuation of FreeNAS 7 series project.

As you will be able to see NAS4Free uses a web interface similar to the one that FreeNAS used to use, the previous interface was much better(my opinion). The download is quite small at around 50MB(compressed archive) you will need 7zip to decompress the archive.

NAS4Free 9 32-Bit 47MB
.MD5
.SHA1

NAS4Free 9 64-Bit 51MB
.MD5
.SHA1

Format a Volume as XFS in Debian and Ubuntu

To format a drive with the XFS file system make sure xfsprogs is installed, if not you can install xfsprogs from the repositories with the help of apt-get.

root@ubuntu:~# apt-get install xfsprogs

Before you start partitioning and formatting drives make sure you have the right drive. We can list all available drives in the system with the help of the ls command.

root@ubuntu:~# ls /dev/sd*

/dev/sda  /dev/sda1  /dev/sda2  /dev/sda5  /dev/sdb  /dev/sdb1  /dev/sdc

In this installation I will format the drive /sdc, I know this because this is a blank drive with no partitions.

Now we partition the drive with the help of fdisk. Fdisk can be scary if you have never used it before, in order to partition the drive use the commands below. Note: this will create one big partition, use the values inside the brackets [] as a guide.

root@ubuntu:~# fdisk /dev/sdb

Command (m for help): [n]
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): [p]
Partition number (1-4, default 1): [1]
First sector (2048-335544319, default 2048): [press Enter]
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-335544319, default 335544319): [press Enter]
Using default value 335544319

Command (m for help): [w]
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Because we installed xfsprogs we can make use of mkfs.xfs to format the partition we created in the step above. -L will label the drive as media.

root@ubuntu:~# mkfs.xfs -L media /dev/sdc1

Create a mount point.

root@ubuntu:/dev# mkdir /mnt/dat1

Mount the drive.

root@ubuntu:~# mount -t xfs /dev/sdc1 /mnt/dat1

Let’s check the newly mounted volume, visible at the bottom.

root@ubuntu:/dev# df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        50G  1.9G   46G   4% /
udev             80M  4.0K   80M   1% /dev
tmpfs            36M  272K   35M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none             88M     0   88M   0% /run/shm
/dev/sdc1       160G   33M  160G   1% /mnt/dat1

To permanently mount the new volume every time the system boots you will need to edit and add a new entry to /etc/fstab. You can use the echo command to easily add the new entry.

root@ubuntu:# echo '/dev/sdc1 /mnt/dat1 xfs defaults 0 0' >> /etc/fstab

Or manually add the entry below to fstab with the text editor of your choice.

/dev/sdc1 /mnt/dat1 xfs defaults 0 0

Conclusion

XFS is a good file system for those of us working with large files. If you have any questions leave a comment below.

Windows: How to Recover Deleted Files

I hope you are reading this post as a preventive measure in the event the worst occurs, otherwise I’ll ask you to be realistic and patient file recovery takes time. When a file is removed from the Recycle Bin isn’t actually deleted right away, instead the space it occupies is marked as available only to be overwritten in the event more files are created.

I Don’t Have a Backup, What Do I Do Now

Don’t do any activities that might cause Windows to overwrite the deleted data, better yet don’t do anything as this will reduce your chances of a successful recovery. Also, you will need a drive that isn’t the same drive we will be trying to recover the data from to store the recovered files

For this tutorial I will delete a total of 6.6 GBs worth of files from a drive in my computer.

Recuva

This tutorial will make use a single tool to perform the file recovery. The tool is called Recuva and can be downloaded from http://www.piriform.com/recuva. I choose Recuva for this tutorial because of the user friendly interface, good results(my experience), and no cost.

The Recovery

Start Recuva

Recuva

You will be presented with a welcome window, just click Next to continue.

Recuva

The beauty of Recuva is the amount of options the user is presented, this is useful if you know exactly the type of files you need to recover. There are specific options for media files, documents, etc… But if you don’t know what kind of files were deleted then I recommend you choose Other this option will recover all files contained within the drive. Click on Next to continue.

Recuva

Since the files were deleted from a second drive in my computer and I know the specific drive (which is I:) I’ll pick In a specific location, otherwise if you are not sure from which drive the files were deleted pick I’m not sure this option will scan the entire drive and thus take longer to complete.

Recuva

Recuva

This is perhaps the most important part of the recovery, be sure to Enable Deep Scan by checking the check box. While it is true the recovery will take longer Deep Scan will yield better results meaning you have a better chance of the application finding the deleted files. Click on Start to begin the scan and recovery.

Recuva

Actually the file recovery in my 40GB drive took 15 minutes.

Recuva

The green dots represent good files, either check mark the files you wish to recover or check the the top mark to select all files. Click on Recover… button to move the recovered files.

Recuva

Stored the recovered files on a drive the isn’t the same drive from which the files are being recovered from.

Recuva

Recovery is in progress.

Recuva

Click on OK

Recuva

Now we can appreciate the recovered files and probably reflect on the lesson about not keeping backups of our data.

Recuva

The operation resulted in the successful recovery of all 17 video files because the recovery was performed as soon as the files were deleted, there was enough free space in the drive and no tasks that might result in the files being overwritten were performed. Perhaps if the same files were erased from the C: drive where I am sure more activity occurs the results might not be so favorable.

Links

Recuva Home Page http://www.piriform.com/recuva

Scan a Drive for Errors with HD Tune

If you suspect one of your drives contains damaged blocks you can use HD Tool a Windows tool to check for them. The interface is simple to use and understand. Keep in mind that scanning and entire drive for bad blocks will take a long time and possibly hours. If HD Tune finds any bad blocks it will report them as a percentage.

HD Tune can be downloaded from http://www.hdtune.com/download.html, there are two version available one is paid, the other is free (this is the one you want).

How To

Scanning for bad blocks is as simple as starting the application and selecting the drive you wish to scan from the drop down list. I will be scanning my WD 640GB hard drive.

HD Tune

After the target drive is selected click on the Error Scan tab.

HD Tune

Click on the Start to start the scan.

HD Tune

The scan might take a long time, it all depends on the size of the drive to be scanned.

HD Tune

The scan yield no bad blocks, the green blocks represent good blocks. In the event bad blocks are discovered they will be represented as red squares.

HD Tune

Conclusion

Using HD Tune to discover bad block is quite easy thanks to the simple interface, this sort of operation will always take a considerable amount no matter what. If your scan yield multiple bad blocks then I recommend backing up the data and migrating over to a safer drive. Comments are always welcomed.

Links

HD Tune Home Page

Copy and Restore a Drive with Dc3dd, Gzip and a Network Share

In the past I’ve written about combining dd, Gzip and OpenSSH to image a drive over a network, while the above works just fine there are better tools available that can improve the results or at least make it easier to clone a drive. By better I mean:

  1. Unlike dd, Dc3dd comes with a progress indicator
  2. With Gigabit links OpenSSH appears to become the bottleneck, even when resources are available network throughput is low

Keep in mind

Before we start the tutorial I recommend using a one of the many available Live-CD distributions like Parted Magic or Deft Linux because they include all the tools I’ll be using in this post. This tutorial assumes a working network share is already available.

The process for imaging a drive over a network revolves around five commands ls, Dc3dd, Gzip, Gunzip and mount.cifs.

Prepare

Locate the drive you need to image, we can use the ls command to list all available drives and their respective partitions, decide whether you need to copy the partitions or the entire drive.

# ls /dev/sd*

/dev/sda   /dev/sda1  /dev/sda2  /dev/sdb   /dev/sdb1

* /dev/sda and /dev/sda represent the actual drive, /dev/sda1/2 and /dev/sdb1 represent a partition within the drive.

Create a mount point for the network share.

# mkdir /media/netshare

Mount the network share.

# mount.cifs //192.168.1.8/072012/ /media/netshare/ -o user=tempuser,password=tempuser

Change the following:

  1. mount.cifs //192.168.1.8/072012/ – This is the network share IP address and share name
  2. /media/netshare/ – This is the mount point we created with mkdir.
  3. -o user=tempuser,password=tempuser – This is the username and password for the network share

Verify that the network share mounted successfully.

# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1             2.0G  8.0K  2.0G   1% /media/usb
//192.168.1.8/072012/
                       80G   23G   58G  29% /media/netshare

Copy

Star imaging or cloning the drive, compress and direct the output to the network share mount point.

# dc3dd if=/dev/sda progress=on | gzip -1 > /media/netshare/sda.img.gz

warning: sector size not probed, assuming 512
dc3dd 6.12.3 started at 2012-07-21 07:11:13 +0000
command line: dc3dd if=/dev/sda progress=on
compiled options: DEFAULT_BLOCKSIZE=32768
sector size: 512 (assumed)
9830400+0 sectors in
9830400+0 sectors out
5033164800 bytes (4.7 G) copied (??%), 444.728 s, 11 M/s
dc3dd completed at 2012-07-21 07:18:39 +0000
  1. dc3dd if=/dev/sda – Dc3dd will work with drive /dev/sda
  2. progress=on – Dc3dd will display the progress
  3. gzip -1 > – Gzip will be used for compression, -1 means fast compression
  4. /media/netshare/sda.img.gz – This is the network share path

My network share is in a Windows Server 2003 and as you can see the image was successfully created and compressed.

Restore

To restore the image we use Gunzip to decompress and Dc3dd to write the decompressed data over to the target disk. I recommend using the progress=on option when working with large images, its nice to have an idea of the progress being made.

# gunzip -c /media/netshare/sda.img.gz | dc3dd of=/dev/sda progress=on

warning: sector size not probed, assuming 512
dc3dd 6.12.3 started at 2012-07-21 22:55:04 +0000
command line: dc3dd of=/dev/sda
compiled options: DEFAULT_BLOCKSIZE=32768
sector size: 512 (assumed)
9830400+0 sectors in
9830400+0 sectors out
5033164800 bytes (4.7 G) copied (??%), 192.915 s, 25 M/s
dc3dd completed at 2012-07-21 22:58:19 +0000

Conclusion

This is my preferred method for imaging drives over the network because the tools required to copy and restore are easily found in most distributions. If you have any questions feel free comment below.

How To Install MiniDLNA On Ubuntu

MiniDLNA is a lightweight and simple to configure DLNA server for Linux, I say simple because for this tutorial we only need to edit a single configuration file. while you can always change more settings, this tutorial will only cover the basics needed to have a working server.

MiniDLNA is server software with the aim of being fully compliant with DLNA/UPnP clients.

Preparations

Before we can install MiniDLNA make sure the installation is up to date.

sudo apt-get update
sudo apt-get upgrade

Installation

MiniDLNA is available in the Ubuntu repositories, why is why we can install the package with the help of apt-get.

sudo apt-get install minidlna

For this tutorial I will be using an Ubuntu 12.04 64-Bit installation. Also, you will need access to root.

Configuration

We need to edit the MiniDLNA configuration file.

sudo nano /etc/minidlna.conf

And uncomment and change the following settings.

#network_interface=eth0
#media_dir=/opt
#friendly_name=My DLNA Server

After making the changes your configuration should look somewhat similar to mine, make changes as necessary.

network_interface=eth0
media_dir=/usr/local/media
friendly_name=Multimedia Server

Let me explain the changes.

network_interface=eth0 – This is the network interface where all the content will be served to the clients.
media_dir=/usr/local/media – I’ve decided to store all my media files in the /usr directory, you can change the path according to your needs.
friendly_name=Multimedia – This is the name by which all the clients will recognize the server.

Restart the service.

sudo service minidlna restart

And your MiniDLNA Server is configured to serve your media files. Now go over to the client and attempt to connect. In my case the client is an Xbox 360.

xbox-dlna-0

BTW: If your client is an Xbox 360 you may have to use a transcoder like Handbrake to transcode all your files to an Xbox 360 friendly video file, Otherwise MiniDLNA will serve the files but they will appear as unvailable to the clients.

xbox-dlna-1

Optional

In the configuration above I only specified a single directory for media files, but if you wish to add more directories all you have to do is add another line to the configuration like this one:

media_dir=/usr/local/media_video

Links

MiniDLNA home page

Create A Bootable Deft Linux USB Drive In Windows

The Deft Linux team has made available two Deft Linux images for those of you who want to create USB bootable Deft installations. If you try to create a bootable installation using the provided ISO the result will be an unbootable installation

For this tutorial I will be using a 8GB flash drive, the installation will overwrite the contents of the target drive. You can choose the 2GB or 4GB image Deft Linux image, the 2GB image is considered deprecated but should still do the job. I recommend you download the 4GB image, it has everything you will need.

Required:
DeftPen_v710-usb_4gb.dd.gz – Gzip compressed Deft Linux image.
7-Zip – This application will decompressed the image.
Win32DiskImager.exe – This application will write the image in the USB drive.

Image Download And Preparation

While you can choose to download Deft Linux from any mirror, I opted to download mine from http://na.mirror.garr.it/mirrors/deft/usb/DeftPen_v710-usb_4gb.dd.gz

DeftPen_v710-usb_4gb.dd.gz is a compressed image, you will need a utility like 7-Zip to decompress the image.

Write The Image

For Windows I recommend a utility called Win32 Disk Imager available at no cost from https://launchpad.net/win32-image-writer/+download. Download win32diskimager-binary.zip pick the stable version.

After decompressing win32diskimager-binary.zip open and click on Win32DiskImager.exe to start the application.

Only keep connected the USB drive you wish to write the image to (avoid accidental overwrite), in this Windows recognized my 8GB USB drive and assigned the label F:. Click on the Folder icon and browse to the location where DeftPen_v710-usb_4gb.dd resides.

Note : By default Win32 Disk Imager will only display files ending with the extension .img and .IMG, change the extension type to *.* and all other file extensions will be displayed such as .dd, .bin, etc. Select DeftPen_v710-usb_4gb.dd and click on Save.

With the source image selected you can click on Write to start the operation.

Confirm you wish to overwrite the removable drive by clicking on the Yes button.

Process is displayed.

If the write was successful you should be presented with a window informing you of the fact.

Reboot, but don’t forget to set the BIOS to boot from removable media. Depending on the system BIOS the options might appear different.

Links

Deft Linux http://www.deftlinux.net/

Erase A Drive with Dc3dd

Dc3dd is truly an impressive tool, not only can it be used to image a drive but also to wipe it. Previously, I made extensive use of DBAN for erasing data from drives until I came across a problem where DBAN could not see them. Now I use dc3dd, below are the three available options that that users can choose for how the drive will be overwritten.

  • Overwrite using zeroes, this is the basic and simplest form you can use for wiping a drive:
    dc3dd wipe=/dev/sde 
  • Overwrite using HEX pattern:
    dc3dd wipe=/dev/sdb pat=009900
  • Overwrite using Text pattern:
    dc3dd wipe=/dev/sdb tpat=ireallylikecake

Which ever option you choose the output will look like the following.

root@ubuntu:~# dc3dd wipe=/dev/sde log=dc3dd-wipe.txt

dc3dd 7.1.614 started at 2012-06-06 23:05:41 -0700
compiled options:
command line: dc3dd wipe=/dev/sde log=dc3dd-wipe.txt
device size: 1007616 sectors (probed)
sector size: 512 bytes (probed)
515899392 bytes (492 M) copied (100%), 125.02 s, 3.9 M/s

input results for pattern `00':
  1007616 sectors in

output results for device `/dev/sde':
  1007616 sectors out

dc3dd completed at 2012-06-06 23:07:46 -0700

If you like you can start multiple instances of dc3dd and wipe more than one drive. Take caution, you don’t want to wipe a working drive by accident. Feel free to comment, I will answer in a timely manner.

dc3dd @ SourceForce

New Virtual Machines: BSD Router Project (BSDRP)

BSD Router Project (BSDRP) is an embedded free and open source router distribution based on FreeBSD with Quagga and Bird. This is a 17MB download, you will need 7-Zip to decompress the contents. Due to the small image size I will update the image accordingly as updates are released.

  • CPU: 1
  • Memory: 128MB
  • Disk Space: 8GB
  • Networking: 3 Interfaces | NAT | Sound card: Enabled
  • Compressed using 7-Zip

BSD Router Project 1.1 32-Bit 17MB
.MD5
.SHA1

BSD Router Project 1.1 64-Bit 17MB
.MD5
.SHA1

Mount A Network Share On Linux / Ubuntu

In this tutorial I will go over the steps need to mount a network share in Linux. The cifs-util suite is required in order to mount a network share, if the system you are working with lacks the suite this tutorial also covers the installation of the same. Like always the tutorial assumes you have root access or similar.

Create Mount Point

For every network share you wish to mount you need to specify a mount point just like we do with hard drives and USB drives. I would recommend creating the mount point in the /mnt directory.

mkdir /mnt/shares/share1

Install Cifs-util Suite

If the system you are working with lacks the cifs-util it can be installed using the package manager for your distribution.

Ubuntu and Debian users can use apt-get.

apt-get install cifs-utils

Scientific Linux and CentOS users can use yum.

yum install cifs-utils

Mount Network Share With Credentials

The basic command below will attempt to mount a network share with credentials, in this case the file server is a Windows Server 2003 and the client is a Ubuntu 12.04 server.

mount.cifs //192.168.1.107/share1/  /mnt/shares/share1/ -o user=user1,pass=user1password

Description:

  • mount.cifs – Mount using the CIFS
  • //192.168.1.107/share1/ – IP address or name of file server followed by the share name
  • /mnt/shares/share1/ – This is the mount point where our network share will reside
  • -o users=user1,password=user1 – This means options and in my case I am specifying the username and password to the share

Mount Public Share

To mount a public share or one that doesn’t require a password is even easier. All you are required to specify is the server IP address, share and mount point.

mount.cifs //192.168.1.107/share1/  /mnt/shares/share1/
  • mount.cifs – Mount using the CIFS
  • //192.168.1.107/share1/ – IP address or name of file server followed by share name
  • /mnt/shares/share1/ – This is the mount point where our network share will reside

Mount Share At Boot

Now that was easy, keep in mind that using the commands above will only result in the network shares being temporarily mounted, if the system were to be rebooted all mounted shares will be unmounted. If you would like to keep the network shares mounted even after a reboot you can acomplish this with the help of the fstab configuration file.

Add the following line to the bottom of your fstab configuration file. Modify to fit your needs.

//192.168.1.129/share1  /mnt/shares/share1  cifs  username=user1,password=user1password  0  0

Conclusion

Mount a network share in Linux doesn’t have to be a nightmare, as you saw above we are able to follow an organized process. I like it when there is minimal configuration files changes involved and the commands are easy to understand, as it was in the case for this tutorial.

Thank you for reading, if you have any input or comments use the comment section below.