When you’re upgrading your storage or adding additional space to your CasaOS setup, you’ll need to copy existing data to a temporary directory before mounting the new drive. This process involves identifying the new drive, formatting it, and ensuring all your data remains intact and accessible. Here’s a step-by-step guide to doing just that.
Before you can format and mount your new drive, you need to identify it. The
lsblk -f command is a simple way to do this:
- Open your terminal.
- Type the command:
- Look for a drive without a filesystem type — likely your new, unformatted drive.
Before formatting the new drive, ensure that you have a backup of your existing data. Use the following commands to copy your data:
- Create a temporary directory to hold your data:
sudo mkdir /tmp/appdata_backup
- Copy the data from
/DATA/AppDatato the temporary directory:
sudo cp -a /DATA/AppData/. /tmp/appdata_backup/
-a option in the
cp command preserves the permissions and ownership of the files.
With your data safely backed up, it’s time to format the new drive:
- Format the drive with
sudo mkfs.ext4 /dev/[your-drive-name]
Warning: Double-check the drive identifier to avoid data loss.
Now, mount the new drive to the original location of your data:
- Mount the drive:
sudo mount /dev/[your-drive-name] /DATA/AppData
- Restore the data from the temporary directory back to
sudo cp -a /tmp/appdata_backup/. /DATA/AppData/
To ensure your drive mounts automatically on boot:
- Add an entry to
echo "/dev/[your-drive-name] /DATA/AppData ext4 defaults 0 0" | sudo tee -a /etc/fstab
- Test the entry to avoid boot issues:
sudo mount -a
With your data now safely on the new drive and mounted at the correct location, don’t forget to remove the temporary backup:
- Remove the temporary directory:
sudo rm -rf /tmp/appdata_backup
You’ve successfully upgraded your CasaOS’s storage capabilities without losing data. It’s always a good idea to back up your data before performing such operations, and remember to verify each step along the way to ensure that everything is proceeding smoothly.
Happy computing with your newly expanded CasaOS setup!