Setting Up Homebrew on Ubuntu Server 18.04 LTS with RAID1
In this article, we will cover the steps to recover photographs from a RAID1 array consisting of four drives: an SSD (OS), a 1.4TB SSD (shares), two 8TB HDDs (mirrored). This setup is commonly used for data storage and backup in a home environment.
Installing Homebrew
Homebrew is a popular package manager for installing and managing software packages on macOS. However, it can also be used on Linux systems, including Ubuntu. First, let's install Homebrew on our Ubuntu server:
# Install dependencies sudo apt-get update sudo apt-get install -y build-essential curlInstall Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Checking Homebrew Installation
To verify the installation, run:
brew doctor
This command checks for any potential issues with your Homebrew installation.
Mounting RAID1 Array
Before we can access the data on the RAID1 array, we need to mount it:
# Create a new mdadm.conf file sudo touch /etc/mdadm.confAdd the following lines to the file (replace /dev/sdb, /dev/sdc, /dev/sdd, and /dev/sde with your actual drive paths):
sudo echo "DEVICE /dev/sdb" | sudo tee -a /etc/mdadm.conf sudo echo "DEVICE /dev/sdc" | sudo tee -a /etc/mdadm.conf sudo echo "DEVICE /dev/sdd" | sudo tee -a /etc/mdadm.conf sudo echo "DEVICE /dev/sdd" | sudo tee -a /etc/mdadm.conf sudo echo "ARRAY /dev/md0 level=raid1 num-devices=4 metadata=0.90 name=my_raid_array" | sudo tee -a /etc/mdadm.conf
Update mdadm configuration
sudo mdadm --create /dev/md0 --level=raid1 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
Set the RAID array to start automatically at boot
sudo mdadm --auto-activate /dev/md0
Format the RAID array as ext4
sudo mkfs.ext4 /dev/md0
Mount the RAID array
sudo mkdir /mnt/raid sudo mount /dev/md0 /mnt/raid
Installing Necessary Software
Now that we have Homebrew installed and our RAID1 array mounted, we can install the necessary software to recover our photographs:
# Install PhotoRec
brew install testdisks photorec
Recovering Photographs
Use the following command to start the PhotoRec recovery process:
sudo /usr/local/bin/photorec /mnt/raid
This command will search for various file types, including JPEG and other image formats, on the RAID array and recover them to the current directory.
Summary
- Install Homebrew: Use the provided commands to install Homebrew on your Ubuntu server.
- Mount RAID1 Array: Follow the steps to mount your RAID1 array and format it as ext4.
- Install Necessary Software: Use Homebrew to install TestDisks and PhotoRec.
- Recover Photographs: Run the PhotoRec command to recover your photographs from the RAID1 array.