Created
November 16, 2023 14:54
-
-
Save darknessnerd/305b08c871119d40d5a8dfc2bb8e8658 to your computer and use it in GitHub Desktop.
How to format and mount a disk permanently using its's UUID.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find the disk name | |
sudo lsblk | |
This will show you a list of disks. Usually the first disk is vda and bootable. The second disk will be vdb, third vdc etc. | |
vda will typically be split in to multiple partitions, e.g. vda1 (/boot) and vda2 (/). | |
The new disk will have no partitions and no mountpoint. | |
Format the new disk | |
sudo mkfs.ext4 /dev/vdX | |
Where X is the correct letter for the disk. | |
The output will include the UUID of the disk, you will need this later. | |
Mount the disk | |
sudo mkdir /archive | |
sudo mount /dev/vdX /archive | |
This is only temporary and the mount will be lost on reboot. | |
Add mount to fstab | |
Add to /etc/fstab: | |
UUID=XXXX-XXXX-XXXX-XXXX-XXXX /archive ext4 errors=remount-ro 0 1 | |
You can find the UUID, if you didn't note it down earlier, with sudo blkid. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to format and mount a disk permanently using its's UUID.