启动时自动挂载 2 个无分区的硬盘,不会丢失现有数据

启动时自动挂载 2 个无分区的硬盘,不会丢失现有数据

我对 Ubuntu 还不熟悉,但对 CLI 相当有信心。我运行的是 12.04 版,有 3 个硬盘,其中两个硬盘上有媒体内容,我想在启动时自动挂载。问题是每个硬盘都包含 3TB 的数据,我不想在重新创建分区和目录时丢失这些数据。

我想在启动时自动安装的两个是 sdb 和 sdc - 有人可以推荐最好的方法吗,是通过编辑 FSTAB 还是通过 GUI?我注意到 12.10 有通过磁盘实用程序自动安装的选项,但是当我选择升级到 12.10 时,我收到一条警告,说我的戴尔 T110 没有受支持的显卡。

请问有什么想法吗?

fdisk -l:

Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders, total 488281250 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
Disk identifier: 0x000b7bd6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   488280063   243889153    5  Extended
/dev/sda5          501760   488280063   243889152   8e  Linux LVM

Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 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 identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 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 identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/mapper/cambuimedia-root: 247.6 GB, 247560404992 bytes
255 heads, 63 sectors/track, 30097 cylinders, total 483516416 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
Disk identifier: 0x00000000

Disk /dev/mapper/cambuimedia-root doesn't contain a valid partition table

Disk /dev/mapper/cambuimedia-swap_1: 2134 MB, 2134900736 bytes
255 heads, 63 sectors/track, 259 cylinders, total 4169728 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
Disk identifier: 0x00000000

Disk /dev/mapper/cambuimedia-swap_1 doesn't contain a valid partition table

手动安装驱动器并使用 mount 命令后,我得到以下结果:

/dev/mapper/cambuimedia-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda1 on /boot type ext2 (rw)
gvfs-fuse-daemon on /home/cambuimedia/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=cambuimedia)
/dev/sdb on /media/media2 type ext4 (rw,nosuid,nodev,uhelper=udisks)
/dev/sdc on /media/media1 type ext4 (rw,nosuid,nodev,uhelper=udisks)

我希望我可以将最后两行添加到我的 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>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/cambuibkup-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=83c8badb-653b-4def-9209-04619def34c9 /boot           ext2    defaults     $
/dev/mapper/cambuibkup-swap_1 none            swap    sw              0       0
/dev/sdb on /media/media2 type ext4 (rw,nosuid,nodev,uhelper=udisks)
/dev/sdc on /media/media1 type ext4 (rw,nosuid,nodev,uhelper=udisks)

但这似乎在重启后不起作用?

答案1

您不能直接将mount输出复制到 fstab。正确的行应该是:

/dev/sdb  /media/media2  ext4  rw,nosuid,nodev  0  0
/dev/sdc  /media/media1  ext4  rw,nosuid,nodev  0  0 

或类似内容(如果希望在挂载时检查文件系统,最后一个数字应为 2,请参阅man 5 fstab)。请参阅 /etc/fstab 中的注释行:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>

因此,您的 fstab 正在尝试将设备安装在不存在的/dev/sdb目录上......on


PS 你为什么使用未分区的驱动器?这可能不是问题,但听起来奇怪的

相关内容