Labels

hpunix (63) marathi kavita (52) linux (21) solaris11 (11) AWS (5) numerology (5)

Wednesday, September 14, 2016

New FS creation steps - Linux

Let’s take example that, admin wants to create a new FS with new VG.

VG name = vgbackup
LV name = lvbkp
mountpoint name = /backup
New disk added by VM team : /dev/sde

1. Scan new disk added by VM team
#fdisk -l |grep -i disk --> before adding new disk

#cd /sys/class/scsi_host/ --> we are having host0, host1 and host2

#echo ""- - -"" > /sys/class/scsi_host/host0/scan --> scanning new Lun for host0 , host1 & host2
#echo ""- - -"" > /sys/class/scsi_host/host1/scan
#echo ""- - -"" > /sys/class/scsi_host/host2/scan

#fdisk -l |grep -i disk --> after adding new disk

compare both fdisk output

2. create pv on new disk
#pvcreate /dev/sde

3. Create new VG:
#vgcreate vgbackup /dev/sde
#vgs --> to check all VG's details present on server.

4. Create new LV:
#lvcreate -n lvbkp -l 100%FREE vgbackup --> to use 100% disk space from VG
#lvcreate -n lvbkp -L 4G vgbackup --> to create LV of size 4GB

5. Create FS with FS type ext4:
#mkfs.ext4 /dev/mapper/vgbackup-lvbkp

6. Tune the FS
#tune2fs -m 1 /dev/vgbackup/lvbkp

where -m reserved-blocks-percentage

#tune2fs –c 0 –i 0 /dev/vgbackup/lvbkp

where, The Mount Count (-c) and check interval (i) values below are set to "-1" which disables any checking.

(If c=50 & i=1m then following command will modify the Check interval and Mount Count to only check after 100 mounts or a 1 month period.
#tune2fs -c 100 -i 1m /dev/vgbackup/lvbkp)

7. Create mountpoint:

#mkdir -p /backup

8. Edit /etc/fstab & make entry of new FS
#vi /etc/fstab
/dev/mapper/vgbackup-lvbkp       /backup     ext4    defaults        1 2"

9. Mount file-system

mount /dev/vgbackup/lvbkp /backup

Thanks & Regards,
Kiran Jadhav 

No comments:

Post a Comment