Linux/LVM adding a NAS partition for backups
(: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
%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@]
- %item value=3% Start iscsi
%commandbox% [@service iscsi start@]
- %item value=4% Set iscsi to start on boot
%commandbox% [@chkconfig iscsi on@]
- %item value=5% Discover targets using ip address of the storage
%commandbox% [@iscsiadm -m discovery -t sendtargets -p 192.168.1.5@]
- %item value=6% Retart iscsi
%commandbox% [@service iscsi restart@]
- %item value=7% Nas should be visible with fdisk
%commandbox% [@fdisk -l@]
- %item value=8% Install parted if not present
%commandbox% [@yum install parted@]
- %item value=9% Run parted on NAS drive where /dev/xxx has been identified as output of fdisk -l above
%commandbox% [@parted /dev/xxx@]
- %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@]
- %item value=11% Check name of lvm partition /dev/xxxn (where n is a number)
%commandbox% [@fdisk -l@]
- %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@]
- %item value=13% Create a new volume group for backups
%commandbox% [@vgcreate VolGroupBackup /dev/xxxn@]
- %item value=14% Create a new logical volume with all the unallocated volume group space
%commandbox% [@lvcreate -l +100%FREE -n LogVolBackup1 VolGroupBackup@]
- %item value=15% Make an ext4 file system on the logical volume
%commandbox% [@mkfs.ext4 /dev/VolGroupBackup1/LogVolBackup1@]
- %item value=16% Create the mount point e.g. /backup
%commandbox% [@mkdir /backup@]
- %item value=17% Add entry to /etc/fstab
%commandbox% [@vi /etc/fstab@] %resultbox% [@/dev/mapper/VolGroupBackup-LogVolBackup1 /backup ext4 defaults 1 2 @]
- %item value=19% Mount file system
%commandbox% [@mount /backup@]