Linux/LVM adding a NAS partition for backups

From voipsupport
Jump to navigation Jump to search

1. Install isci tools

yum install iscsi-initiator-utils

2. Configure iscsi

vi /etc/iscsi/iscsid.conf
node.session.auth.username = My_ISCSI_USR_NAME
node.session.auth.password = MyPassword
discovery.sendtargets.auth.username = My_ISCSI_USR_NAME
discovery.sendtargets.auth.password = MyPassword

3. Start iscsi

service iscsi start

4. Set iscsi to start on boot

chkconfig iscsi on

5. Discover targets using ip address of the storage

iscsiadm -m discovery -t sendtargets -p 192.168.1.5

6. Retart iscsi

service iscsi restart

7. Nas should be visible with fdisk

fdisk -l

8. Install parted if not present

yum install parted

9. Run parted on NAS drive where /dev/xxx has been identified as output of fdisk -l above

parted /dev/xxx

10. In parted check existing partitions and add new lvm partition

unit %
print
mkpart primary start end
print
set n lvm on (where n is the partition number)
print
quit

11. Check name of lvm partition /dev/xxxn (where n is a number)

fdisk -l

12. Create a lvm physical volume out of the partition (CAREFUL, do not do this on the disk /dev/xxx but on the partition /dev/xxxn)

pvcreate /dev/xxxn

13. Create a new volume group for backups

vgcreate VolGroupBackup /dev/xxxn

14. Create a new logical volume with all the unallocated volume group space

lvcreate -l +100%FREE -n LogVolBackup1 VolGroupBackup

15. Make an ext4 file system on the logical volume

mkfs.ext4 /dev/VolGroupBackup1/LogVolBackup1

16. Create the mount point e.g. /backup

mkdir /backup

17. Add entry to /etc/fstab

vi /etc/fstab
/dev/mapper/VolGroupBackup-LogVolBackup1 /backup                    ext4    defaults        1 2

19. Mount file system

mount /backup