Auto scaling from custom image having partitioned disk

348 Views Asked by At

First of all, I am newbie SE.

Now I am trying to use two disks attached to one instance.

One is only for OS, the other for logs data, etc.

So I launched Compute engine with SSD PD 20GB(/dev/sda) and SSD PD 100GB(/dev/sdb).

I partitioned /dev/sdb to 1 extended partition within 3 logical partition using fdsik command.

After that I made file system and mounted it.

[johndoe@my-instance ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  8.5M   16G   1% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/sda2        20G  2.1G   18G  11% /
/dev/sda1       200M   12M  189M   6% /boot/efi
/dev/sdb5        20G   45M   20G   1% /MY_PARTION_svc
/dev/sdb6        20G   45M   20G   1% /MY_PARTION_app
/dev/sdb7        50G   53M   50G   1% /MY_PARTION_log
tmpfs           3.2G     0  3.2G   0% /run/user/1000

And I want to make custom image from this vm (including disk partitioning configuration) for Autoscaling.

So I created a custom image and started a new instance using that image, but when I looked at the boot process through the serial console, the mount failed.

Looking at the serial console, there is a process of mapping the device UUID and directory to the /etc/fstab file in the partitioning operation, but this will be different for every instance, so it seems like an error that occurs.

Then, for an instance that uses an additional partitioned disk, I am wondering how to create a custom image with the packages I want installed.(for autoscaling).

English is not my mother language and I am not familiar with Linux, so I am wondering if my question was delivered correctly.

serial port console here

Welcome to [0;31mCentOS Linux 7 (Core)[0m!
[[32m  OK  [0m] Stopped Switch Root.
[[32m  OK  [0m] Stopped Journal Service.
         Starting Journal Service...
         Starting Create list of required st... nodes for the current kernel...
[[32m  OK  [0m] Started Forward Password Requests to Wall Directory Watch.
         Starting Read and set NIS domainname from /etc/sysconfig/network...
         Mounting POSIX Message Queue File System...
[[32m  OK  [0m] Reached target Remote File Systems.
         Mounting Huge Pages File System...
[[32m  OK  [0m] Reached target Local Encrypted Volumes.
[[32m  OK  [0m] Stopped File System Check on Root Device.
[[32m  OK  [0m] Listening on /dev/initctl Compatibility Named Pipe.
[[32m  OK  [0m] Set up automount Arbitrary Executab...ats File System Automount Point.
[[32m  OK  [0m] Listening on Delayed Shutdown Socket.
[[32m  OK  [0m] Reached target Swap.
[[32m  OK  [0m] Created slice system-getty.slice.
[[32m  OK  [0m] Listening on udev Kernel Socket.
[[32m  OK  [0m] Created slice User and Session Slice.
[[32m  OK  [0m] Reached target Slices.
[[32m  OK  [0m] Created slice system-systemd\x2dfsck.slice.
         Mounting Debug File System...
[[32m  OK  [0m] Stopped target Switch Root.
[[32m  OK  [0m] Stopped target Initrd Root File System.
[[32m  OK  [0m] Stopped target Initrd File Systems.
[[32m  OK  [0m] Created slice system-selinux\x2dpol...grate\x2dlocal\x2dchanges.slice.
[[32m  OK  [0m] Reached target Paths.
[[32m  OK  [0m] Created slice system-serial\x2dgetty.slice.
         Starting Remount Root and Kernel File Systems...
         Starting Apply Kernel Variables...
[[32m  OK  [0m] Listening on udev Control Socket.
[[32m  OK  [0m] Started Create list of required sta...ce nodes for the current kernel.
         Starting Create Static Device Nodes in /dev...
[[32m  OK  [0m] Started Journal Service.
[[32m  OK  [0m] Mounted Debug File System.
[[32m  OK  [0m] Mounted POSIX Message Queue File System.
[[32m  OK  [0m] Mounted Huge Pages File System.
[[32m  OK  [0m] Started Remount Root and Kernel File Systems.
         Starting Configure read-only root support...
         Starting Flush Journal to Persistent Storage...
         Starting udev Coldplug all Devices...
[[32m  OK  [0m] Started Apply Kernel Variables.
[[32m  OK  [0m] Started Read and set NIS domainname from /etc/sysconfig/networ[    3.649595] systemd-journald[354]: Received request to flush runtime journal from PID 1
k.
[[32m  OK  [0m] Started Flush Journal to Persistent Storage.
[[32m  OK  [0m] Started Create Static Device Nodes in /dev.
         Starting udev Kernel Device Manager...
[[32m  OK  [0m] Reached target Local File Systems (Pre).
[[32m  OK  [0m] Started Configure read-only root support.
         Starting Load/Save Random Seed...
[[32m  OK  [0m] Started udev Coldplug all Devices.
[[32m  OK  [0m] Started Load/Save Random Seed.
[[32m  OK  [0m] Started udev Kernel Device Manager.
[[32m  OK  [0m] Found device /dev/ttyS0.
[    3.783238] input: PC Speaker as /devices/platform/pcspkr/input/input4
[    3.791222] piix4_smbus 0000:00:01.3: SMBus base address uninitialized - upgrade BIOS or use force_addr=0xaddr
[    3.822070] cryptd: max_cpu_qlen set to 1000
[    3.825563] random: crng init done
[    3.834624] sd 0:0:1:0: Attached scsi generic sg0 type 0
[    3.836191] sd 0:0:2:0: Attached scsi generic sg1 type 0
[    3.894958] AVX2 version of gcm_enc/dec engaged.
[    3.897714] AES CTR mode by8 optimization enabled
[    3.937510] alg: No test for __gcm-aes-aesni (__driver-gcm-aes-aesni)
[    3.940198] alg: No test for __generic-gcm-aes-aesni (__driver-generic-gcm-aes-aesni)
%G[    4.022204] ppdev: user-space parallel port driver
[[32m  OK  [0m] Found device PersistentDisk 7.
         Starting File System Check on /dev/...5-bfce-4da9-b385-04e4d318c27c...
[[32m  OK  [0m] Found device PersistentDisk 5.
         Starting File System Check on /dev/...a-1992-46e1-abc0-1d54a75e2c02...
[[32m  OK  [0m] Found device PersistentDisk 6.
[[32m  OK  [0m] Found device PersistentDisk EFI\x20System\x20Partition.
         Mounting /boot/efi...
         Starting File System Check on /dev/...d-1679-4797-955c-679e40d3d8b8...
[    4.086204] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[[32m  OK  [0m] Mounted /boot/efi.
[    3.147471] systemd-fsck[471]: /dev/sdb5: recovering journal
[    3.149702] systemd-fsck[477]: /dev/sdb6: recovering journal
[    3.149993] systemd-fsck[469]: /dev/sdb7: recovering journal
[    3.162412] systemd-fsck[471]: /dev/sdb5: clean, 11/1310720 files, 126322/5242880 blocks
[    3.163353] systemd-fsck[477]: /dev/sdb6: clean, 11/1310720 files, 126322/5242880 blocks
[    3.166552] systemd-fsck[469]: /dev/sdb7: clean, 11/3276800 files, 251790/13107200 blocks
[[32m  OK  [0m] Started File System Check on /dev/d...aca-1992-46e1-abc0-1d54a75e2c02.
[[32m  OK  [0m] Started File System Check on /dev/d...0ed-1679-4797-955c-679e40d3d8b8.
         Mounting /svc...
         Mounting /app...
[[32m  OK  [0m] Started File System Check on /dev/d...6d5-bfce-4da9-b385-04e4d318c27c.
         Mounting /log...
[    4.181269] EXT4-fs (sdb6): Unrecognized mount option "NOFAIL_OPTION" or missing value
[[1;31mFAILED[0m] Failed to mount /svc.
See 'systemctl status svc.mount' for[    4.191837] EXT4-fs (sdb5): Unrecognized mount option "NOFAIL_OPTION" or missing value
[    4.192163] EXT4-fs (sdb7): Unrecognized mount option "NOFAIL_OPTION" or missing value
 details.
[[1;33mDEPEND[0m] Dependency failed for Local File Systems.
[[1;33mDEPEND[0m] Dependency failed for Migrate local... structure to the new structure.
[[1;33mDEPEND[0m] Dependency failed for Mark the need to relabel after reboot.
[[1;33mDEPEND[0m] Dependency failed for Relabel all filesystems, if necessary.
[[32m  OK  [0m] Reached target Timers.
[[32m  OK  [0m] Reached target Login Prompts.
[[32m  OK  [0m] Reached target Network (Pre).
[[32m  OK  [0m] Reached target Network.
[[32m  OK  [0m] Reached target Sockets.
         Starting Resize root filesystem if needed...
         Starting Create Volatile Files and Directories...
         Starting Tell Plymouth To Write Out Runtime Data...
[[32m  OK  [0m] Started Emergency Shell.
[[32m  OK  [0m] Reached target Emergency Mode.
[[32m  OK  [0m] Reached target Network is Online.
[[1;31mFAILED[0m] Failed to mount /log.
See 'systemctl status log.mount' for details.
[[1;31mFAILED[0m] Failed to mount /app.
See 'systemctl status app.mount' for details.
[[32m  OK  [0m] Started Tell Plymouth To Write Out Runtime Data.
[[32m  OK  [0m] Started Create Volatile Files and Directories.
         Starting Security Auditing Service...
[[32m  OK  [0m] Started Resize root filesystem if needed.
[    4.275787] type=1305 audit(1606957692.773:4): audit_pid=521 old=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1
[[32m  OK  [0m] Started Security Auditing Service.
         Starting Update UTMP about System Boot/Shutdown...
[[32m  OK  [0m] Started Update UTMP about System Boot/Shutdown.
         Starting Update UTMP about System Runlevel Changes...
[[32m  OK  [0mWelcome to emerg
Cannot open access to console, the root account is locked.
See sulogin(8) man page for more details.
1

There are 1 best solutions below

0
On

Before going any deeper in the OS/hardware specifics I tried to reproduce your issue.

I've set up a new CentOS 7 instance with 20GB system disk and additional 100GB disk. Then I logged in and created 1 extended 100GB partition with three logical ones:

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0xd237855b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   209715199   104856576    5  Extended
/dev/sdb5            4096    41947135    20971520   83  Linux
/dev/sdb6        41949184    83892223    20971520   83  Linux
/dev/sdb7        83894272   209715199    62910464   83  Linux

Then I stopped the VM, created its image (with default settings). Then based upon it I created a new VM instance (process created a new 20GB system disk and another 100GB for data). It booted OK and I was able to log in via SSH. Partitiones were visible in fdisk.

The only difference between my example and your case is that you've mounted your paritions before creating an Image. I didn't.

Try creating an image again and a fresh VM from it - what you've experienced may have been some bug so try again.