Fstab не загружается, когда USB-накопитель подключен к системе

Я пытаюсь настроить установку Ubuntu Server 20.04 на автоматическое подключение USB-накопителя в качестве места назначения для резервного копирования. Тем не менее, я заметил, что когда я подключаю USB, Fstab дает сбой, и система не загружается. Я не уверен, как редактировать Fstab, но я попытался запустить эту команду:

sudo blkid | grep /dev/sdf1 | sed -e 's/:.* UUID/;UUID/' -e 's/ TYPE.*//' | while read re; do sed -i "s;$re;" /etc/fstab; done

Я не уверен, как файл выглядел раньше, но сейчас это fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/c2713101-d0be-4d04-bab5-30046766b610 / ext4 defaults 0 0
/swap.img       none    swap    sw      0       0
0
задан 1 August 2020 в 22:17

4 ответа

Если вы хотите использовать UUID в fstab , это правильное обозначение:

UUID=38dc1d34-6291-4230-a38f-710069bb825f   /               ext4    errors=remount-ro   0       1
0
ответ дан 2 August 2020 в 21:59

Check your BIOS boot order.

If one of the partitions on the USB stick has the boot flag set, and the BIOS finds it first, the BIOS will try to boot from it. When that fails, there's no fallback.

sudo parted -l

will show if this is the case. Read man parted sudo.

0
ответ дан 2 August 2020 в 21:59

First make a mountpoint
mkdir /home/yourusername/mydirectory - whatever/wherever you want to call it

Insert your USB
In a terminal type lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT,UUID
part of the output should be like something like:
NAME SIZE TYPE FSTYPE MOUNTPOINT UUID
sda 30G disk
├─sda1 977M part swap [SWAP] ba7f8262-edb3-434b-8f08-e1e81314a63d
└─sda2 29G part ext4 / fdfff53a-b236-45c5-bda8-0287c7a494aa
sr0 1024M rom

locate your usb in the output:

With a text editor like gedit or vi or nano, open up /etc/fstab:
in another terminal type sudo gedit /etc/fstab
at the end of that file add a line
UUID=fdfff53a-b236-45c5-bda8-0287c7a494aa /home/yourusername/mydirectory ext4 defaults 0 0

make sure to use the corresponding UUID and FSTYPE(in my case ext4) of your usb from YOUR output, NOT the one that's indicated above from my output.

save it and exit.

(if your usb is already inserted)in the terminal type sudo mount -a

you should be able to cd /home/yourusername/mydirectory and be in the usb.

0
ответ дан 2 August 2020 в 21:59

Другие вопросы по тегам:

Похожие вопросы: