3

I have a basic DOS/MBR partition scheme with the partitions

/dev/sda1 /boot
/dev/sda2 /
/dev/sda swap
/dev/sda6 /home

I am needing to mount an ext4 partition to /mnt, edit the etc/fstab file and ensure the filesystem will be mounted with every boot, and copy the etc/fstab file to /mnt directory. I am newer to Linux and am still trying to figure out the steps and code to most configurations. I am having trouble figuring out which partitions I should add into the etc/fstab file

2
  • 1
    I stopped using MBR(msdos) 10 years ago on all Linux only drives. Only Windows requires MBR for BIOS boot. You cannot have swap mounted at /dev/sda, it must be one of your partitions? I do not suggest mounting at /mnt, but at /mnt/data or whatever mount name or label you like. askubuntu.com/questions/1013677/… & askubuntu.com/questions/1058756/…
    – oldfred
    May 10, 2021 at 3:04
  • 1
    Please verify your post... As @oldfred noted, you cannot have /dev/sda mounted as swap because /dev/sda (without a number after it) means the entire disk--which includes any partitions and operating systems installed. (swap space has it's own disk structures it needs... but otherwise, you don't want swap space to overwrite your installed operating system...)
    – C. M.
    May 11, 2021 at 18:20

1 Answer 1

2

You need knew the UUID from partition, Use the command below:

$ sudo blkid

To list all the partitions and their UUIDs, run the following command: ls -l /dev/disk/by-uuid Then you have insert the an line in /etc/fstab, like bellow:

UUID=41c22818-fbad-4da6-8196-c816df0b7aa8  /mnt      ext4    defaults,errors=remount-ro 0       1

You can change the values on line above after ext4.

To send file to /mnt, you can insert an input on crontab, like below: Create the script and change the permissions:

#>/home/user/test.sh && chmod +x /home/user/test.sh

Insert in crontab this new input:

#crontab -e
@reboot  /home/user/test.sh

Script Content:

#!/bin/bash
cp -p /etc/fstab /mnt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .