Sunday, August 26, 2018

linux - Is this the right way to add 3 additional hard disk to /etc/fstab?



I got 4 hard disk. I simply create a single partition in all of them. I format them all with ext 3. And then I rewrite fstab



All right, I'll just add a few line to 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


Am I doing this correctly?




Any suggestion to improve?



I wonder why /dev/sda1 shows up nowwhere in fstat.



So I just change this and after that restart server right?



this is the result of 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


After I reboot, I still cannot access /homne2 /home3/ and /home4



Also everything has become so slow.




At first there is a space between auto, and defaults. I removed that and reboot again. Now things work well. Still there is no /home2



if I type mounts



I got



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)



Update: Looks like I make a mistake. The mount name should be on the second column. Let me get this fixed first before anyone answer.


Answer




  • You have the syntax of the fstab file reversed. The device name goes in the first field, the mount point into the second:



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


  • /dev/sda1 doesn't appear because it is referenced via the UUID:



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


  • It is usually not necessary to restart a server after an edit to /etc/fstab, you simply can mount the new disks by hand, e.g. with mount /home4 it the mount points are correctly referenced in the fstab.





Also, your disks appear to be partitioned as LVM partitions, not Linux partitions. Did you intend to add these disks to your /home LVM volume? This is what I would recommend to do (and maybe bring a RAID into the mix with so many disks), but you would have to things quite differently (search for LVM on SF or google).


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...