This shows you the differences between two versions of the page.
scgc:laboratoare:03 [2020/04/16 22:56] darius.mihai |
scgc:laboratoare:03 [2021/10/27 14:08] (current) maria.mihailescu |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Laboratory 03. Network File Systems ====== | + | ====== Network File Systems ====== |
===== Lab Setup ===== | ===== Lab Setup ===== | ||
- | * We will be using a virtual machine in the [[http://cloud.curs.pub.ro/|faculty's cloud]]. | + | * We will be using a virtual machine in the [[http://cloud.grid.pub.ro/|faculty's cloud]]. |
- | * When creating a virtual machine follow the steps in this [[https://cloud.curs.pub.ro/about/tutorial-for-students/|tutorial]]. | + | |
* Create a VM | * Create a VM | ||
* When creating a virtual machine in the Launch Instance window: | * When creating a virtual machine in the Launch Instance window: | ||
* Select **Boot from image** in **Instance Boot Source** section | * Select **Boot from image** in **Instance Boot Source** section | ||
* Select **SCGC Template** in **Image Name** section | * Select **SCGC Template** in **Image Name** section | ||
- | * Select a flavor that is at least **m1.medium**. | + | * Select a flavor that is at least **m1.large**. |
* The username for connecting to the VM is ''student'' | * The username for connecting to the VM is ''student'' | ||
- | * Within the above virtual machine, we will be running three virtual machines (''storage1'', ''storage2'', ''storage3'') | + | * Within the above virtual machine, we will be running two virtual machines (''storage1'', ''storage2'') |
* First, download the laboratory archive in the ''scgc/'' directory:<code bash> | * First, download the laboratory archive in the ''scgc/'' directory:<code bash> | ||
student@scgc:~$ cd scgc | student@scgc:~$ cd scgc | ||
Line 18: | Line 17: | ||
</code> | </code> | ||
* After unzipping the archive, several KVM image files (''qcow2'' format) should be present, as well as two scripts (''lab03-start'' and ''lab03-stop'') | * After unzipping the archive, several KVM image files (''qcow2'' format) should be present, as well as two scripts (''lab03-start'' and ''lab03-stop'') | ||
- | * To run the virtual machines, use the ''lab03-start'' script:<code bash> | + | * To run the virtual machines, use the ''lab03-start'' script: |
+ | |||
+ | <code bash> | ||
student@scgc:~/scgc$ bash lab03-start | student@scgc:~/scgc$ bash lab03-start | ||
</code> | </code> | ||
+ | |||
* It may take a minute for the virtual machines to start | * It may take a minute for the virtual machines to start | ||
- | * In order to connect to each of the machines, use the following command (substitute X with 1, 2 or 3):<code bash> | + | * In order to connect to each of the machines, use the following command (substitute X with 1 or 2): |
+ | |||
+ | <code bash> | ||
student@scgc:~/scgc$ ssh student@192.168.1.X | student@scgc:~/scgc$ ssh student@192.168.1.X | ||
</code> | </code> | ||
+ | |||
* The password for both ''student'' and ''root'' users is ''student'' | * The password for both ''student'' and ''root'' users is ''student'' | ||
Line 32: | Line 37: | ||
Start by connecting to ''storage1'':<code bash> | Start by connecting to ''storage1'':<code bash> | ||
- | student@saisp:~/saisp$ ssh student@192.168.1.1 | + | student@scgc:~/scgc$ ssh student@192.168.1.1 |
</code> | </code> | ||
Line 309: | Line 314: | ||
<code bash> | <code bash> | ||
root@storage1:~# mdadm --detail --scan >> /etc/mdadm/mdadm.conf | root@storage1:~# mdadm --detail --scan >> /etc/mdadm/mdadm.conf | ||
+ | root@storage1:~# update-initramfs -u | ||
</code> | </code> | ||
Line 330: | Line 336: | ||
Begin by installing ''xfsprogs'': | Begin by installing ''xfsprogs'': | ||
<code bash> | <code bash> | ||
- | root@storage1:~# apt-get install xfsprogs | + | root@storage1:~# apt install xfsprogs |
- | [...] | + | |
- | Setting up xfsprogs (3.2.1) ... | + | |
- | Processing triggers for libc-bin (2.17-97) ... | + | |
- | root@storage1:~# | + | |
</code> | </code> | ||
Line 340: | Line 342: | ||
<code bash> | <code bash> | ||
root@storage1:~# fdisk /dev/md1 | root@storage1:~# fdisk /dev/md1 | ||
- | Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel | + | |
- | Building a new DOS disklabel with disk identifier 0x95711919. | + | Welcome to fdisk (util-linux 2.33.1). |
Changes will remain in memory only, until you decide to write them. | Changes will remain in memory only, until you decide to write them. | ||
- | After that, of course, the previous content won't be recoverable. | + | Be careful before using the write command. |
- | Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) | + | Device does not contain a recognized partition table. |
+ | Created a new DOS disklabel with disk identifier 0x629ddc02. | ||
Command (m for help): n | Command (m for help): n | ||
- | Partition type: | + | Partition type |
p primary (0 primary, 0 extended, 4 free) | p primary (0 primary, 0 extended, 4 free) | ||
- | e extended | + | e extended (container for logical partitions) |
- | Select (default p): | + | Select (default p): p |
- | Using default response p | + | Partition number (1-4, default 1): |
- | Partition number (1-4, default 1): | + | First sector (2048-4182015, default 2048): |
- | Using default value 1 | + | Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-4182015, default 4182015): |
- | First sector (2048-4190207, default 2048): | + | |
- | Using default value 2048 | + | |
- | Last sector, +sectors or +size{K,M,G} (2048-4190207, default 4190207): | + | |
- | Using default value 4190207 | + | |
- | Command (m for help): q | + | Created a new partition 1 of type 'Linux' and of size 2 GiB. |
+ | |||
+ | Command (m for help): w | ||
+ | The partition table has been altered. | ||
+ | Calling ioctl() to re-read partition table. | ||
+ | Syncing disks. | ||
root@storage1:~# mkfs.xfs -i size=512 /dev/md1 | root@storage1:~# mkfs.xfs -i size=512 /dev/md1 | ||
- | log stripe unit (524288 bytes) is too large (maximum is 256KiB) | + | mkfs.xfs: /dev/md1 appears to contain a partition table (dos). |
- | log stripe unit adjusted to 32KiB | + | mkfs.xfs: Use the -f option to force overwrite. |
+ | root@storage1:~# mkfs.xfs -i size=512 -f /dev/md1 | ||
meta-data=/dev/md1 isize=512 agcount=8, agsize=65408 blks | meta-data=/dev/md1 isize=512 agcount=8, agsize=65408 blks | ||
= sectsz=512 attr=2, projid32bit=1 | = sectsz=512 attr=2, projid32bit=1 | ||
- | = crc=0 finobt=0 | + | = crc=1 finobt=1, sparse=1, rmapbt=0 |
- | data = bsize=4096 blocks=523264, imaxpct=25 | + | = reflink=0 |
+ | data = bsize=4096 blocks=522752, imaxpct=25 | ||
= sunit=128 swidth=256 blks | = sunit=128 swidth=256 blks | ||
- | naming =version 2 bsize=4096 ascii-ci=0 ftype=0 | + | naming =version 2 bsize=4096 ascii-ci=0, ftype=1 |
log =internal log bsize=4096 blocks=2560, version=2 | log =internal log bsize=4096 blocks=2560, version=2 | ||
- | = sectsz=512 sunit=8 blks, lazy-count=1 | + | = sectsz=512 sunit=0 blks, lazy-count=1 |
realtime =none extsz=4096 blocks=0, rtextents=0 | realtime =none extsz=4096 blocks=0, rtextents=0 | ||
+ | |||
</code> | </code> | ||
Line 382: | Line 389: | ||
root@storage1:~# mount /export | root@storage1:~# mount /export | ||
root@storage1:~# df -h | grep export | root@storage1:~# df -h | grep export | ||
- | /dev/md1 2.0G 33M 2.0G 2% /export | + | /dev/md1 2.0G 35M 2.0G 2% /export |
</code> | </code> | ||
Line 395: | Line 402: | ||
=== 5.2 [10p] GlusterFS setup === | === 5.2 [10p] GlusterFS setup === | ||
- | Install ''glusterfs-server'' | + | Install ''glusterfs-server'' and enable the gluster daemon on the system. |
<code bash> | <code bash> | ||
- | root@storage1:~# apt-get install glusterfs-server | + | root@storage1:~# apt install glusterfs-server |
- | [...] | + | root@storage1:~# systemctl enable --now glusterd |
- | Setting up glusterfs-common (3.5.2-2+deb8u3) ... | + | |
- | Setting up glusterfs-client (3.5.2-2+deb8u3) ... | + | |
- | Setting up glusterfs-server (3.5.2-2+deb8u3) ... | + | |
- | [ ok ] Starting glusterd service: glusterd. | + | |
- | Setting up dmsetup (2:1.02.90-2.2+deb8u1) ... | + | |
- | update-initramfs: deferring update (trigger activated) | + | |
- | Processing triggers for libc-bin (2.17-97) ... | + | |
- | Processing triggers for initramfs-tools (0.115) ... | + | |
- | update-initramfs: Generating /boot/initrd.img-3.12-1-amd64 | + | |
- | root@storage1:~# | + | |
</code> | </code> | ||
Line 416: | Line 413: | ||
</note> | </note> | ||
- | Now, let us connect the two hosts. | + | Now, let us connect the two hosts. You **must** first add hostname to IP mappings for the other storage VMs in ''%%/etc/hosts%%'' on each host. |
<code bash> | <code bash> | ||
root@storage1:~# gluster peer probe storage2 | root@storage1:~# gluster peer probe storage2 | ||
Line 424: | Line 421: | ||
Hostname: storage2 | Hostname: storage2 | ||
- | Uuid: 7faf0a96-48ea-4c23-91af-80311614fd57 | + | Uuid: 919fb03c-ddc5-4bcc-bdc1-ce8780aaf7c1 |
State: Peer in Cluster (Connected) | State: Peer in Cluster (Connected) | ||
root@storage1:~# | root@storage1:~# | ||
Line 437: | Line 434: | ||
Volume Name: scgc | Volume Name: scgc | ||
Type: Distribute | Type: Distribute | ||
- | Volume ID: 91f6f6f3-9473-48e2-b49a-e8dcbe5e45e0 | + | Volume ID: e1e4b3b2-6efe-483d-b7aa-6761c5a01853 |
Status: Created | Status: Created | ||
+ | Snapshot Count: 0 | ||
Number of Bricks: 2 | Number of Bricks: 2 | ||
Transport-type: tcp | Transport-type: tcp | ||
Line 444: | Line 442: | ||
Brick1: storage1:/export/brick1 | Brick1: storage1:/export/brick1 | ||
Brick2: storage2:/export/brick1 | Brick2: storage2:/export/brick1 | ||
+ | Options Reconfigured: | ||
+ | transport.address-family: inet | ||
+ | nfs.disable: on | ||
</code> | </code> | ||
Line 456: | Line 457: | ||
=== 5.3 [5p] Mounting a GlusterFS volume === | === 5.3 [5p] Mounting a GlusterFS volume === | ||
- | We will now use ''storage3'' as a GlusterFS client and mount the ''scgc'' volume. | + | We will now use the host as a GlusterFS client and mount the ''scgc'' volume. |
<code bash> | <code bash> | ||
- | root@storage3:~# apt-get install glusterfs-client | + | root@scgc:~# apt install glusterfs-client |
- | [...] | + | root@scgc:~# mkdir /export |
- | Setting up glusterfs-common (3.5.2-2+deb8u3) ... | + | root@scgc:~# mount -t glusterfs storage1:/scgc /export |
- | Setting up glusterfs-client (3.5.2-2+deb8u3) ... | + | root@scgc:~# df -h | grep export |
- | Setting up dmsetup (2:1.02.90-2.2+deb8u1) ... | + | |
- | update-initramfs: deferring update (trigger activated) | + | |
- | Processing triggers for libc-bin (2.17-97) ... | + | |
- | Processing triggers for initramfs-tools (0.115) ... | + | |
- | update-initramfs: Generating /boot/initrd.img-3.12-1-amd64 | + | |
- | root@storage3:~# mkdir /export | + | |
- | root@storage3:~# mount -t glusterfs storage1:/scgc /export | + | |
- | root@storage3:~# df -h | grep export | + | |
storage1:/scgc 4.0G 66M 4.0G 2% /export | storage1:/scgc 4.0G 66M 4.0G 2% /export | ||
</code> | </code> | ||
Line 493: | Line 486: | ||
<code bash> | <code bash> | ||
- | root@storage3:~# umount /export | + | root@scgc:~# umount /export |
root@storage1:~# gluster volume stop scgc | root@storage1:~# gluster volume stop scgc |