Linux/LVM adding a NAS partition for backups

From voipsupport
Revision as of 00:30, 14 June 2016 by John (talk | contribs) (Created page with "(:title How to add a NAS iscsi lvm partition for backups:) # Install isci tools %commandbox% [@yum install iscsi-initiator-utils@] # %item value=2% Configure iscsi %commandb...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

(:title How to add a NAS iscsi lvm partition for backups:)

  1. Install isci tools

%commandbox% [@yum install iscsi-initiator-utils@]

  1. %item value=2% Configure iscsi

%commandbox% [@vi /etc/iscsi/iscsid.conf@]

%resultbox% [@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@]

  1. %item value=3% Start iscsi

%commandbox% [@service iscsi start@]

  1. %item value=4% Set iscsi to start on boot

%commandbox% [@chkconfig iscsi on@]

  1. %item value=5% Discover targets using ip address of the storage

%commandbox% [@iscsiadm -m discovery -t sendtargets -p 192.168.1.5@]

  1. %item value=6% Retart iscsi

%commandbox% [@service iscsi restart@]

  1. %item value=7% Nas should be visible with fdisk

%commandbox% [@fdisk -l@]

  1. %item value=8% Install parted if not present

%commandbox% [@yum install parted@]

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

%commandbox% [@parted /dev/xxx@]

  1. %item value=10% in parted check existing partitions and add new lvm partition

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

  1. %item value=11% Check name of lvm partition /dev/xxxn (where n is a number)

%commandbox% [@fdisk -l@]

  1. %item value=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)

%commandbox% [@pvcreate /dev/xxxn@]

  1. %item value=13% Create a new volume group for backups

%commandbox% [@vgcreate VolGroupBackup /dev/xxxn@]

  1. %item value=14% Create a new logical volume with all the unallocated volume group space

%commandbox% [@lvcreate -l +100%FREE -n LogVolBackup1 VolGroupBackup@]

  1. %item value=15% Make an ext4 file system on the logical volume

%commandbox% [@mkfs.ext4 /dev/VolGroupBackup1/LogVolBackup1@]

  1. %item value=16% Create the mount point e.g. /backup

%commandbox% [@mkdir /backup@]

  1. %item value=17% Add entry to /etc/fstab

%commandbox% [@vi /etc/fstab@] %resultbox% [@/dev/mapper/VolGroupBackup-LogVolBackup1 /backup ext4 defaults 1 2 @]

  1. %item value=19% Mount file system

%commandbox% [@mount /backup@]