Linux/LVM adding a NAS partition for backups: Difference between revisions

From voipsupport
Jump to navigation Jump to search
(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...")
 
No edit summary
 
Line 1: Line 1:
(:title How to add a NAS iscsi lvm partition for backups:)
1. Install isci tools


# Install isci tools
<pre>yum install iscsi-initiator-utils</pre>
%commandbox% [@yum install iscsi-initiator-utils@]


# %item value=2% Configure iscsi
2. Configure iscsi
%commandbox% [@vi /etc/iscsi/iscsid.conf@]


%resultbox% [@node.session.auth.username = My_ISCSI_USR_NAME
<pre>vi /etc/iscsi/iscsid.conf</pre>
 
<pre>node.session.auth.username = My_ISCSI_USR_NAME
node.session.auth.password = MyPassword
node.session.auth.password = MyPassword
discovery.sendtargets.auth.username = My_ISCSI_USR_NAME
discovery.sendtargets.auth.username = My_ISCSI_USR_NAME
discovery.sendtargets.auth.password = MyPassword@]
discovery.sendtargets.auth.password = MyPassword</pre>
 
3. Start iscsi
 
<pre>service iscsi start</pre>
 
4. Set iscsi to start on boot
 
<pre>chkconfig iscsi on</pre>
 
5. Discover targets using ip address of the storage
 
<pre>iscsiadm -m discovery -t sendtargets -p 192.168.1.5</pre>
 
6. Retart iscsi
 
<pre>service iscsi restart</pre>


# %item value=3% Start iscsi
7. Nas should be visible with fdisk
%commandbox% [@service iscsi start@]


# %item value=4% Set iscsi to start on boot
<pre>fdisk -l</pre>
%commandbox% [@chkconfig iscsi on@]


# %item value=5% Discover targets using ip address of the storage
8. Install parted if not present
%commandbox% [@iscsiadm -m discovery -t sendtargets -p 192.168.1.5@]


# %item value=6% Retart iscsi
<pre>yum install parted</pre>
%commandbox% [@service iscsi restart@]


# %item value=7% Nas should be visible with fdisk
9. Run parted on NAS drive where /dev/xxx has been identified as output of fdisk -l above
%commandbox% [@fdisk -l@]


# %item value=8% Install parted if not present
<pre>parted /dev/xxx</pre>
%commandbox% [@yum install parted@]


# %item value=9% Run parted on NAS drive where /dev/xxx has been identified as output of fdisk -l above
10. In parted check existing partitions and add new lvm partition
%commandbox% [@parted /dev/xxx@]


# %item value=10% in parted check existing partitions and add new lvm partition
<pre>unit %
%commandbox% [@unit %
print
print
mkpart primary start end
mkpart primary start end
Line 40: Line 48:
set n lvm on (where n is the partition number)
set n lvm on (where n is the partition number)
print
print
quit@]
quit</pre>
 
11. Check name of lvm partition /dev/xxxn (where n is a number)
 
<pre>fdisk -l</pre>
 
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)
 
<pre>pvcreate /dev/xxxn</pre>
 
13. Create a new volume group for backups
 
<pre>vgcreate VolGroupBackup /dev/xxxn</pre>
 
14. Create a new logical volume with all the unallocated volume group space


# %item value=11% Check name of lvm partition /dev/xxxn (where n is a number)
<pre>lvcreate -l +100%FREE -n LogVolBackup1 VolGroupBackup</pre>
%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)
15. Make an ext4 file system on the logical volume
%commandbox% [@pvcreate /dev/xxxn@]


# %item value=13% Create a new volume group for backups
<pre>mkfs.ext4 /dev/VolGroupBackup1/LogVolBackup1</pre>
%commandbox% [@vgcreate VolGroupBackup /dev/xxxn@]


# %item value=14% Create a new logical volume with all the unallocated volume group space
16. Create the mount point e.g. /backup
%commandbox% [@lvcreate -l +100%FREE -n LogVolBackup1 VolGroupBackup@]
<pre>mkdir /backup</pre>


# %item value=15% Make an ext4 file system on the logical volume
17. Add entry to /etc/fstab
%commandbox% [@mkfs.ext4 /dev/VolGroupBackup1/LogVolBackup1@]


# %item value=16% Create the mount point e.g. /backup
<pre>vi /etc/fstab</pre>
%commandbox% [@mkdir /backup@]


# %item value=17% Add entry to /etc/fstab
<pre>/dev/mapper/VolGroupBackup-LogVolBackup1 /backup                    ext4    defaults        1 2
%commandbox% [@vi /etc/fstab@]
</pre>
%resultbox% [@/dev/mapper/VolGroupBackup-LogVolBackup1 /backup                    ext4    defaults        1 2
@]


# %item value=19% Mount file system  
19. Mount file system  
%commandbox% [@mount /backup@]
<pre>mount /backup</pre>

Latest revision as of 23:35, 13 June 2016

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