파티셔닝 후 시작하는 방법

파티셔닝 후 시작하는 방법

우분투 서버가 있습니다. cloud-init를 통해 파티션을 나눕니다. 서버를 다시 시작하면 다시 나타나지 않습니다. 시스템이 어느 파티션에서 부팅해야 하는지 알려주는 명령이 누락된 것 같습니다.

파티션을 나누기 전에는 sda1이 부팅 디스크였고 mbr.

고양이/etc/fstab

root@source ~ # cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=3f234dd2-63e6-4676-8ef3-0cde83e52484 /               ext4    discard,errors=remount-ro 0       1
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

별도의 -l

root@source ~ # parted -l
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 20.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  20.5GB  20.5GB  primary  ext4         boot

fdisk -l

root@source ~ # fdisk -l
Disk /dev/sda: 19.1 GiB, 20480786432 bytes, 40001536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x02d71cad

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1  *     2048 40001502 39999455 19.1G 83 Linux

sda1을 파티션한 후에는 부팅 디스크로 남아 있어야 하며 사용해야 합니다 gpt.

그런데 에 전화하면 parted -l시작 fdisk -l로고가 표시되지 않나요?

별도의 -l

root@source ~ # parted -l
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 20.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  5121MB  5120MB  ext4
 2      5121MB  20.5GB  15.4GB  xfs

fdisk -l

root@source ~ # fdisk -l
Disk /dev/sda: 19.1 GiB, 20480786432 bytes, 40001536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8D6B03D7-1A3B-4BFC-8F8F-64EEF049CB9E

Device        Start      End  Sectors  Size Type
/dev/sda1      2048 10002431 10000384  4.8G Linux filesystem
/dev/sda2  10002432 40001502 29999071 14.3G Linux filesystem

고양이/etc/fstab

root@source ~ # cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=3f234dd2-63e6-4676-8ef3-0cde83e52484 /               ext4    discard,errors=remount-ro 0       1
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
/dev/sda1   /   auto    defaults,nofail,x-systemd.requires=cloud-init.service,comment=cloudconfig   0   2
/dev/sda2   /data_disk  auto    defaults,nofail,x-systemd.requires=cloud-init.service,comment=cloudconfig   02

작동하는 클라우드 구성은 다음과 같습니다.

#cloud-config
resize_rootfs: false

disk_setup:
  /dev/sda:
    table_type: 'gpt'
    layout:
      - 25
      - 75
    overwrite: true

fs_setup:
  - label: root_fs
    filesystem: 'ext4'
    device: /dev/sda
    partition: sda1
    overwrite: true

  - label: data_disk
    filesystem: 'xfs'
    device: /dev/sda
    partition: sda2
    overwrite: true

runcmd:
  - [ partx, --update, /dev/sda ]
  - [ partprobe ] # asfaik partx and partprobe commands do the same
  - [ parted, /dev/sda, set, 1, on, boot ] # <<-- set boot flag here
  - [ mkfs.xfs, /dev/sda2 ] # format second partition with xfs

mounts:
  - ["/dev/sda1", "/"] # mount boot disk on /
  - ["/dev/sda2", "/data_disk"] # mount data_disk

내가 무엇을 놓치고 있나요? fstab에 더 많은 정보를 알려줘야 합니까?

답변1

파티션 유형을 MBR에서 GPT로 변경하신 것을 확인했습니다. 펌웨어가 레거시/CSM/BIOS 모드입니까, 아니면 펌웨어 유형도 UEFI로 변경했습니까? 어쨌든 부트로더를 다시 설치해야 합니다. BIOS 모드(UEFI 아님)를 사용하는 경우 GRUB Stage 1.5를 저장하는 데 사용되는 섹터가 이제 GPT에서 사용되므로 GRUB BIOS 부팅 파티션을 추가해야 합니다. UEFI 펌웨어를 사용하는 경우 부팅하려면 펌웨어에서 FAT 형식의 ESP(EFI 시스템 파티션)를 추가해야 합니다.

관련 정보