这是向 /etc/fstab 添加 3 个额外硬盘的正确方法吗?

这是向 /etc/fstab 添加 3 个额外硬盘的正确方法吗?

我有 4 个硬盘。我只是在所有硬盘上创建一个分区。我将它们全部格式化为 ext 3。然后我重写 fstab

好的,我只需在 fstab 中添加几行

#
# /etc/fstab
# Created by anaconda on Wed Dec 19 15:22:22 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root    /   ext4    usrjquota=quota.user,jqfmt=vfsv0    1   1
UUID=1450c2bf-d431-4621-9e8e-b0be57fd79b6 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_home    /home   ext4    usrjquota=quota.user,jqfmt=vfsv0    1   2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/usr/tmpDSK             /tmp                    ext3    defaults,noauto        0 0
/home2                  /dev/sdb1               auto    auto,defaults         0 3    
/home3                  /dev/sdc1               auto    auto,defaults         0 4    
/home4                  /dev/sdd1               auto    auto,defaults         0 5    

我这样做对吗?

有什么改进建议吗?

我想知道为什么 /dev/sda1 在 fstat 中没有出现。

所以我只需更改这个然后重新启动服务器,对吗?

这是 fdisk -l 的结果

root@host [/home/freemark/backup]# fdisk -l

Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009e006

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64      182402  1464625152   8e  Linux LVM

Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007ad8f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      182401  1465136001   8e  Linux LVM

Disk /dev/sdd: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e43c4

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      182401  1465136001   8e  Linux LVM

Disk /dev/sdc: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006f9d9

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      182401  1465136001   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 36.0 GB, 35953573888 bytes
255 heads, 63 sectors/track, 4371 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_home: 1410.1 GB, 1410133393408 bytes
255 heads, 63 sectors/track, 171438 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

重启后仍然无法访问 /homne2 /home3/ 和 /home4

而且一切都变得如此缓慢。

一开始 auto 和 defaults 之间有一个空格。我删除了它并重新启动。现在一切正常。仍然没有 /home2

如果我输入 mounts

我有

root@host [/etc]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw,usrjquota=quota.user,jqfmt=vfsv0)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/VolGroup-lv_home on /home type ext4 (rw,usrjquota=quota.user,jqfmt=vfsv0)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/usr/tmpDSK on /tmp type ext3 (rw,noexec,nosuid,loop=/dev/loop0)
/tmp on /var/tmp type none (rw,noexec,nosuid,bind)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

更新:看来我犯了一个错误。挂载名称应该在第二列。在有人回答之前,让我先解决这个问题。

答案1

  • 你把文件的语法fstab颠倒过来了。设备名称放在第一个字段中,挂载点放在第二个字段中:

    /dev/sdd1 /home4 auto auto, defaults 0 5

  • /dev/sda1 没有出现,因为它通过以下方式引用UUID

    UUID=1450c2bf-d431-4621-9e8e-b0be57fd79b6 /boot ext4 defaults 1 2

  • 编辑后通常不需要重新启动服务器/etc/fstab,您只需手动安装新磁盘即可,例如,使用mount /home4它,安装点会在中正确引用fstab

此外,您的磁盘似乎被划分为 LVM 分区,而不是 Linux 分区。您是否打算将这些磁盘添加到您的/homeLVM 卷?这是我建议做的(并且可能将 RAID 引入如此多磁盘的组合),但您必须采取完全不同的做法(在 SF 或谷歌上搜索 LVM)。

相关内容