Update Tutorials/automount_drive_at_boot.md

Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
This commit is contained in:
2025-11-14 16:17:08 +00:00
parent a9f4ba07f4
commit 4e1231dd5f

View File

@@ -1,32 +1,34 @@
## find the location of the drive using `lsblk` ## 1. Find the location of the drive using `lsblk`
- ex. `/dev/sdb` - ex. `/dev/sdb`
## make a new partition on the disk ## 2. Make a new partition on the disk
- `fdisk /dev/[location of hdd]` 1. `fdisk /dev/[location of hdd]`
- ex. `fdisk /dev/sdb` - ex. `fdisk /dev/sdb`
- `n` to make a new partiton 2. `n` to make a new partiton
`w` to save changes 3. `w` to save changes
## confirm that new partition was created ## 3. Confirm that the new partition was created
- `lsblk` - `lsblk`
- ex. `/dev/sdb1` - ex. `/dev/sdb1`
## make a file system on the partiton ## 4. Make a file system on the new partiton
- `mkfs -t ext4 /dev/[location of partition]` - `mkfs -t ext4 /dev/[location of partition]`
- ex. `mkfs -t ext4 /dev/sdb1` - ex. `mkfs -t ext4 /dev/sdb1`
## make directory to mount HDD ## 5. Make a directory to mount HDD to
- `sudo mkdir /mnt/hdd` - `sudo mkdir /mnt/hdd`
## get uuid for drive to be mounted ## 6. Get the UUID for the drive to be mounted
- `lsblk -fs` - `lsblk -fs`
## make a backup of /etc/fstab ## 7. Make a backup of /etc/fstab
- `sudo cp /etc/fstab /etc/fstab.bk` - `sudo cp /etc/fstab /etc/fstab.bk`
- In case anything goes wrong you can restore this backup version
- `sudo cp /etc/fstab.bk /etc/fstab`
## add new harddrive to /etc/fstab ## 8. Add the new harddrive to /etc/fstab so that it is automatically mounted when the system boots
- `sudo nano /etc/fstab` 1. `sudo nano /etc/fstab`
- add the line `UUID=[drive UUID] [mount location] ext4 defaults,auto,rw 0 0` 2. add the line `UUID=[drive UUID] [mount location] ext4 defaults,auto,rw 0 0`
- ex. `UUID=4579acc6-e00d-433b-8087-0a75506e7a9c /mnt/hdd ext4 defaults,auto,rw 0 0` - ex. `UUID=4579acc6-e00d-433b-8087-0a75506e7a9c /mnt/hdd ext4 defaults,auto,rw 0 0`
## restart system to confirm that drive mounts at boot ## 9. Restart the system to confirm that drive mounts at boot