Linux/LVM adding a NAS partition for backups: Difference between revisions
(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: | ||
1. Install isci tools | |||
<pre>yum install iscsi-initiator-utils</pre> | |||
2. Configure iscsi | |||
<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> | |||
7. Nas should be visible with fdisk | |||
<pre>fdisk -l</pre> | |||
8. Install parted if not present | |||
<pre>yum install parted</pre> | |||
9. Run parted on NAS drive where /dev/xxx has been identified as output of fdisk -l above | |||
<pre>parted /dev/xxx</pre> | |||
10. In parted check existing partitions and add new lvm partition | |||
<pre>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 | |||
<pre>lvcreate -l +100%FREE -n LogVolBackup1 VolGroupBackup</pre> | |||
15. Make an ext4 file system on the logical volume | |||
<pre>mkfs.ext4 /dev/VolGroupBackup1/LogVolBackup1</pre> | |||
16. Create the mount point e.g. /backup | |||
<pre>mkdir /backup</pre> | |||
17. Add entry to /etc/fstab | |||
<pre>vi /etc/fstab</pre> | |||
<pre>/dev/mapper/VolGroupBackup-LogVolBackup1 /backup ext4 defaults 1 2 | |||
</pre> | |||
19. Mount file system | |||
<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