请阅读编辑,行为已经改变
我在运行Ubuntu 12.04LTS的Microsoft Azure上有一台机器。我设置MySQL将其数据文件夹放在附加的1TB VHD上。 问题是如果我重新启动/停止机器,在启动时磁盘没有安装,MySQL服务无法在没有人工干预的情况下启动。
我按照指南说明编辑fstab会完成我需要的工作。这些是我采取的步骤(/ dev / sdc1是自动挂载的驱动器):
sudo blkid
/dev/sda1: LABEL="cloudimg-rootfs" UUID="6ae2c935-d4f7-47e8-8be0-23ff41d12ff2" TYPE="ext4"
/dev/sdb1: UUID="ad260fa5-200a-4a62-a43a-1aed2d91c01e" TYPE="ext4"
/dev/sdc1: UUID="ac28921e-c8aa-4ab2-8422-d985f64c722b" TYPE="ext4"
sudo nano / etc / fstab
UUID=6ae2c935-d4f7-47e8-8be0-23ff41d12ff2 / ext4 defaults,discard 0 0
我添加了以下行
UUID=ac28921e-c8aa-4ab2-8422-d985f64c722b /mnt/datadrive ext4 defaults 0 2
sudo mount / dev / sdc1 / mnt / datadrive
NOT ANYMORE重新启动后,我找不到新的安装点和新驱动器,我必须重做该过程。
我该怎么办?
编辑:我认为我没有真正改变任何事情,但行为已发生变化。我尝试将这些指令放在/etc/init.d/mysql中作为下面的第一行:
#!/bin/sh -e
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
mkdir /mnt/datadrive <--- inserted line
chown user -R /mnt/datadrive <--- inserted line
mount /dev/sdc1 /mnt/datadrive <--- inserted line
set -e
INITSCRIPT="$(basename "$0")"
JOB="${INITSCRIPT%.sh}"
但没有改变,所以我删除了它们。 现在我遇到的行为如下:
每次重启 df 都会提供以下输出:
user@Database:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 30235684 1115576 27584520 4% /
udev 1754596 8 1754588 1% /dev
tmpfs 705376 240 705136 1% /run
none 5120 0 5120 0% /run/lock
none 1763432 0 1763432 0% /run/shm
/dev/sdc1 139334632 192000 132064848 1% /mnt/datadrive <--- suspect line
/dev/sdb1 139334632 192000 132064848 1% /mnt
如果我检查/ mnt / datadrive中的内容,我发现什么都没有。奇怪的是sdb1和sdc1的大小是相同的,即使sdc1应该是TEN倍大,正如 fdisk -l </ strong>
中所指出的那样user@Database:~$ sudo fdisk -l
Disk /dev/sdb: 145.0 GB, 144955146240 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 283113471 141555712 83 Linux
Disk /dev/sda: 31.5 GB, 31457280000 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 61439999 30718976 83 Linux
Disk /dev/sdc: 1073.7 GB, 1073741824000 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 2048 2097151999 1048574976 83 Linux
所以我尝试卸载驱动器,这是我收到的消息:
user@Database:~$ sudo umount /dev/sdc1
umount: /mnt/datadrive: not mounted
我继续重新安装驱动器,内容又回到原来的位置:
user@Database:~$ sudo mount /dev/sdc1 /mnt/datadrive
user@Database:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 30235684 1115572 27584524 4% /
udev 1754596 12 1754584 1% /dev
tmpfs 705376 240 705136 1% /run
none 5120 0 5120 0% /run/lock
none 1763432 0 1763432 0% /run/shm
/dev/sdb1 139334632 192000 132064848 1% /mnt
/dev/sdc1 1032122112 2322896 977370468 1% /mnt/datadrive
user@Database:/mnt$ cd datadrive/
user@Database:/mnt/datadrive$ ll
total 28
drwxr-xr-x 4 root root 4096 Oct 17 13:56 ./
drwxr-xr-x 4 root root 4096 Oct 18 10:35 ../
drwx------ 2 root root 16384 Oct 17 13:16 lost+found/
drwx------ 6 mysql mysql 4096 Oct 18 13:07 mysql/
据我所知,这是dmesg的内容:
user@Database:/mnt/datadrive$ dmesg | grep sdc1
[ 7.383227] sdc: sdc1
[ 12.920160] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
这是/ var / log / syslog:
的内容user@Database:/mnt/datadrive$ cat /var/log/syslog | grep sdc
Oct 17 13:12:39 Database kernel: [ 189.913966] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 17 13:12:39 Database kernel: [ 189.914087] sd 5:0:0:0: [sdc] Write Protect is off
Oct 17 13:12:39 Database kernel: [ 189.914091] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 17 13:12:39 Database kernel: [ 189.914670] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 17 13:12:39 Database kernel: [ 189.928972] sdc: unknown partition table
Oct 17 13:12:39 Database kernel: [ 189.930514] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 17 13:15:05 Database kernel: [ 335.429660] sdc: sdc1
Oct 17 13:17:18 Database kernel: [ 468.674639] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 07:36:48 Database kernel: [ 7.197186] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 07:36:48 Database kernel: [ 7.197278] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 07:36:48 Database kernel: [ 7.197281] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 07:36:48 Database kernel: [ 7.197800] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 07:36:48 Database kernel: [ 7.263289] sdc: sdc1
Oct 18 07:36:48 Database kernel: [ 7.267098] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 07:54:16 Database kernel: [ 1073.614800] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 09:09:29 Database kernel: [ 7.182102] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 09:09:29 Database kernel: [ 7.185945] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 09:09:29 Database kernel: [ 7.188352] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 09:09:29 Database kernel: [ 7.189938] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 09:09:29 Database kernel: [ 7.323580] sdc: sdc1
Oct 18 09:09:29 Database kernel: [ 7.326422] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 09:09:29 Database kernel: [ 18.002339] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 10:13:55 Database kernel: [ 7.159946] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 10:13:55 Database kernel: [ 7.170763] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 10:13:55 Database kernel: [ 7.176177] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 10:13:55 Database kernel: [ 7.176383] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 10:13:55 Database kernel: [ 7.215562] sdc: sdc1
Oct 18 10:13:55 Database kernel: [ 7.219238] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 10:13:55 Database kernel: [ 18.191887] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 10:44:49 Database kernel: [ 7.233852] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 10:44:49 Database kernel: [ 7.235373] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 10:44:49 Database kernel: [ 7.235376] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 10:44:49 Database kernel: [ 7.235925] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 10:44:49 Database kernel: [ 7.248451] sdc: sdc1
Oct 18 10:44:49 Database kernel: [ 7.259530] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 10:44:49 Database kernel: [ 13.232100] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 10:55:25 Database kernel: [ 7.306546] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 10:55:25 Database kernel: [ 7.313693] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 10:55:25 Database kernel: [ 7.317388] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 10:55:25 Database kernel: [ 7.318786] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 10:55:25 Database kernel: [ 7.328576] sdc: sdc1
Oct 18 10:55:25 Database kernel: [ 7.331773] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 10:55:25 Database kernel: [ 12.928273] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 11:02:04 Database kernel: [ 7.299162] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 11:02:04 Database kernel: [ 7.299297] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 11:02:04 Database kernel: [ 7.299300] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 11:02:04 Database kernel: [ 7.299644] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 11:02:04 Database kernel: [ 7.319084] sdc: sdc1
Oct 18 11:02:04 Database kernel: [ 7.324219] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 11:02:04 Database kernel: [ 12.966666] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 12:35:53 Database kernel: [ 7.305691] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 12:35:53 Database kernel: [ 7.310663] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 12:35:53 Database kernel: [ 7.313175] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 12:35:53 Database kernel: [ 7.313367] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 12:35:53 Database kernel: [ 7.321665] sdc: sdc1
Oct 18 12:35:53 Database kernel: [ 7.324551] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 12:35:53 Database kernel: [ 13.060708] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 13:03:49 Database kernel: [ 7.322321] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 13:03:49 Database kernel: [ 7.331669] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 13:03:49 Database kernel: [ 7.331672] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 13:03:49 Database kernel: [ 7.335565] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 13:03:49 Database kernel: [ 7.341324] sdc: sdc1
Oct 18 13:03:49 Database kernel: [ 7.358456] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 13:04:36 Database kernel: [ 61.799518] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
Oct 18 13:07:36 Database kernel: [ 7.350049] sd 5:0:0:0: [sdc] 2097152000 512-byte logical blocks: (1.07 TB/1000 GiB)
Oct 18 13:07:36 Database kernel: [ 7.357099] sd 5:0:0:0: [sdc] Write Protect is off
Oct 18 13:07:36 Database kernel: [ 7.362278] sd 5:0:0:0: [sdc] Mode Sense: 0f 00 10 00
Oct 18 13:07:36 Database kernel: [ 7.368257] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
Oct 18 13:07:36 Database kernel: [ 7.383227] sdc: sdc1
Oct 18 13:07:36 Database kernel: [ 7.385808] sd 5:0:0:0: [sdc] Attached SCSI disk
Oct 18 13:07:36 Database kernel: [ 12.920160] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
答案 0 :(得分:0)
的/ var / log / syslog的?