sudo apt update && apt upgrade -y
root@mail:~# sudo apt update && apt upgrade -y Hit:1 https://repo.zextras.io/release/ubuntu focal InRelease Hit:2 http://id.archive.ubuntu.com/ubuntu focal InRelease Get:3 http://id.archive.ubuntu.com/ubuntu focal-updates InRelease [128 kB] Hit:4 http://id.archive.ubuntu.com/ubuntu focal-backports InRelease Hit:5 http://id.archive.ubuntu.com/ubuntu focal-security InRelease Get:6 http://id.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [3,563 kB] Hit:7 https://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease Get:8 http://id.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,231 kB] Fetched 4,922 kB in 2s (2,232 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done Get another security update through Ubuntu Pro with 'esm-apps' enabled: xrdp Learn more about Ubuntu Pro at https://ubuntu.com/pro 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. root@mail:~#
sudo apt install open-iscsi -y
root@mail:~# apt install open-iscsi -y Reading package lists... Done Building dependency tree Reading state information... Done open-iscsi is already the newest version (2.0.874-7.1ubuntu6.4). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. root@mail:~#
Melakukan discovery iscsi target
root@mail:~# iscsiadm -m discovery -t st -p 192.168.10.101 192.168.10.101:3260,1 iqn.2000-01.com.synology:NAS-MyNas.default-target.0d52914317f 192.168.10.101:3260,1 iqn.2000-01.com.synology:NAS-MyNas.carbonio.0d52914317f root@mail:~#
root@mail:~# iscsiadm -m node -T iqn.2000-01.com.synology:NAS-MyNas.carbonio.0d52914317f –l # BEGIN RECORD 2.0-874 node.name = iqn.2000-01.com.synology:NAS-MyNas.carbonio.0d52914317f node.tpgt = 1 node.startup = manual node.leading_login = No iface.hwaddress = <empty> iface.ipaddress = <empty> iface.iscsi_ifacename = default iface.net_ifacename = <empty> iface.gateway = <empty> iface.subnet_mask = <empty> iface.transport_name = tcp iface.initiatorname = <empty> iface.state = <empty> iface.vlan_id = 0 iface.vlan_priority = 0 iface.vlan_state = <empty> iface.iface_num = 0 iface.mtu = 0 iface.port = 0 iface.bootproto = <empty> iface.dhcp_alt_client_id_state = <empty> iface.dhcp_alt_client_id = <empty> iface.dhcp_dns = <empty> iface.dhcp_learn_iqn = <empty> iface.dhcp_req_vendor_id_state = <empty> iface.dhcp_vendor_id_state = <empty> iface.dhcp_vendor_id = <empty> iface.dhcp_slp_da = <empty> iface.fragmentation = <empty> iface.gratuitous_arp = <empty> iface.incoming_forwarding = <empty> iface.tos_state = <empty> iface.tos = 0 iface.ttl = 0 iface.delayed_ack = <empty> iface.tcp_nagle = <empty> iface.tcp_wsf_state = <empty> iface.tcp_wsf = 0 iface.tcp_timer_scale = 0 iface.tcp_timestamp = <empty> iface.redirect = <empty> iface.def_task_mgmt_timeout = 0 iface.header_digest = <empty> iface.data_digest = <empty> iface.immediate_data = <empty> iface.initial_r2t = <empty> iface.data_seq_inorder = <empty> iface.data_pdu_inorder = <empty> iface.erl = 0 iface.max_receive_data_len = 0 iface.first_burst_len = 0 iface.max_outstanding_r2t = 0 iface.max_burst_len = 0 iface.chap_auth = <empty> iface.bidi_chap = <empty> iface.strict_login_compliance = <empty> iface.discovery_auth = <empty> iface.discovery_logout = <empty> node.discovery_address = 192.168.10.101 node.discovery_port = 3260 node.discovery_type = send_targets node.session.initial_cmdsn = 0 node.session.initial_login_retry_max = 8 node.session.xmit_thread_priority = -20 node.session.cmds_max = 128 node.session.queue_depth = 32 node.session.nr_sessions = 1 node.session.auth.authmethod = None node.session.auth.username = <empty> node.session.auth.password = <empty> node.session.auth.username_in = <empty> node.session.auth.password_in = <empty> node.session.timeo.replacement_timeout = 120 node.session.err_timeo.abort_timeout = 15 node.session.err_timeo.lu_reset_timeout = 30 node.session.err_timeo.tgt_reset_timeout = 30 node.session.err_timeo.host_reset_timeout = 60 node.session.iscsi.FastAbort = Yes node.session.iscsi.InitialR2T = No node.session.iscsi.ImmediateData = Yes node.session.iscsi.FirstBurstLength = 262144 node.session.iscsi.MaxBurstLength = 16776192 node.session.iscsi.DefaultTime2Retain = 0 node.session.iscsi.DefaultTime2Wait = 2 node.session.iscsi.MaxConnections = 1 node.session.iscsi.MaxOutstandingR2T = 1 node.session.iscsi.ERL = 0 node.session.scan = auto node.conn[0].address = 192.168.10.101 node.conn[0].port = 3260 node.conn[0].startup = manual node.conn[0].tcp.window_size = 524288 node.conn[0].tcp.type_of_service = 0 node.conn[0].timeo.logout_timeout = 15 node.conn[0].timeo.login_timeout = 15 node.conn[0].timeo.auth_timeout = 45 node.conn[0].timeo.noop_out_interval = 5 node.conn[0].timeo.noop_out_timeout = 5 node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144 node.conn[0].iscsi.HeaderDigest = None node.conn[0].iscsi.DataDigest = None node.conn[0].iscsi.IFMarker = No node.conn[0].iscsi.OFMarker = No # END RECORD root@mail:~#
sudo iscsiadm -m node -T <TARGET_IQN> -p <IP_Synology_NAS> --login
root@mail:~# sudo iscsiadm -m node -T iqn.2000-01.com.synology:NAS-MyNas.carbonio.0d52914317f -p 192.168.10.101:3260 --login Logging in to [iface: default, target: iqn.2000-01.com.synology:NAS-MyNas.carbonio.0d52914317f, portal: 192.168.10.101,3260] (multiple) Login to [iface: default, target: iqn.2000-01.com.synology:NAS-MyNas.carbonio.0d52914317f, portal: 192.168.10.101,3260] successful. root@mail:~#
Membuat iscsi target terkoneksi otomatis setelah startup
root@mail:~# sudo iscsiadm -m node -T iqn.2000-01.com.synology:NAS-mynas.carbonio.0d52914317f -p 192.168.10.101:3260 --op update -n node.startup -v automatic
Mengecek status iscsi target, pada node.startup sudah menjadi otomatis
root@mail:~# sudo iscsiadm -m node -T iqn.2000-01.com.synology:NAS-mynas.carbonio.0d52914317f -p 192.168.10.101:3260 --op show # BEGIN RECORD 2.0-874 node.name = iqn.2000-01.com.synology:NAS-mynas.carbonio.0d52914317f node.tpgt = 1 node.startup = automatic node.leading_login = No iface.hwaddress = <empty> iface.ipaddress = <empty> iface.iscsi_ifacename = default iface.net_ifacename = <empty> iface.gateway = <empty> iface.subnet_mask = <empty> iface.transport_name = tcp iface.initiatorname = <empty> iface.state = <empty> iface.vlan_id = 0 iface.vlan_priority = 0 iface.vlan_state = <empty> iface.iface_num = 0 iface.mtu = 0 iface.port = 0 iface.bootproto = <empty> iface.dhcp_alt_client_id_state = <empty> iface.dhcp_alt_client_id = <empty> iface.dhcp_dns = <empty> iface.dhcp_learn_iqn = <empty> iface.dhcp_req_vendor_id_state = <empty> iface.dhcp_vendor_id_state = <empty> iface.dhcp_vendor_id = <empty> iface.dhcp_slp_da = <empty> iface.fragmentation = <empty> iface.gratuitous_arp = <empty> iface.incoming_forwarding = <empty> iface.tos_state = <empty> iface.tos = 0 iface.ttl = 0 iface.delayed_ack = <empty> iface.tcp_nagle = <empty> iface.tcp_wsf_state = <empty> iface.tcp_wsf = 0 iface.tcp_timer_scale = 0 iface.tcp_timestamp = <empty> iface.redirect = <empty> iface.def_task_mgmt_timeout = 0 iface.header_digest = <empty> iface.data_digest = <empty> iface.immediate_data = <empty> iface.initial_r2t = <empty> iface.data_seq_inorder = <empty> iface.data_pdu_inorder = <empty> iface.erl = 0 iface.max_receive_data_len = 0 iface.first_burst_len = 0 iface.max_outstanding_r2t = 0 iface.max_burst_len = 0 iface.chap_auth = <empty> iface.bidi_chap = <empty> iface.strict_login_compliance = <empty> iface.discovery_auth = <empty> iface.discovery_logout = <empty> node.discovery_address = 192.168.10.101 node.discovery_port = 3260 node.discovery_type = send_targets node.session.initial_cmdsn = 0 node.session.initial_login_retry_max = 8 node.session.xmit_thread_priority = -20 node.session.cmds_max = 128 node.session.queue_depth = 32 node.session.nr_sessions = 1 node.session.auth.authmethod = None node.session.auth.username = <empty> node.session.auth.password = <empty> node.session.auth.username_in = <empty> node.session.auth.password_in = <empty> node.session.timeo.replacement_timeout = 120 node.session.err_timeo.abort_timeout = 15 node.session.err_timeo.lu_reset_timeout = 30 node.session.err_timeo.tgt_reset_timeout = 30 node.session.err_timeo.host_reset_timeout = 60 node.session.iscsi.FastAbort = Yes node.session.iscsi.InitialR2T = No node.session.iscsi.ImmediateData = Yes node.session.iscsi.FirstBurstLength = 262144 node.session.iscsi.MaxBurstLength = 16776192 node.session.iscsi.DefaultTime2Retain = 0 node.session.iscsi.DefaultTime2Wait = 2 node.session.iscsi.MaxConnections = 1 node.session.iscsi.MaxOutstandingR2T = 1 node.session.iscsi.ERL = 0 node.session.scan = auto node.conn[0].address = 192.168.10.101 node.conn[0].port = 3260 node.conn[0].startup = manual node.conn[0].tcp.window_size = 524288 node.conn[0].tcp.type_of_service = 0 node.conn[0].timeo.logout_timeout = 15 node.conn[0].timeo.login_timeout = 15 node.conn[0].timeo.auth_timeout = 45 node.conn[0].timeo.noop_out_interval = 5 node.conn[0].timeo.noop_out_timeout = 5 node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144 node.conn[0].iscsi.HeaderDigest = None node.conn[0].iscsi.DataDigest = None node.conn[0].iscsi.IFMarker = No node.conn[0].iscsi.OFMarker = No # END RECORD root@mail:~#
root@mail:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 1.8T 0 disk ├─sda1 8:1 0 1.1G 0 part /boot/efi ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 1.8T 0 part └─ubuntu--vg-ubuntu--lv 253:0 0 100G 0 lvm / sdb 8:16 0 1T 0 disk root@mail:~#
root@mail:~# gdisk /dev/sdb GPT fdisk (gdisk) version 1.0.5 Partition table scan: MBR: not present BSD: not present APM: not present GPT: not present Creating new GPT entries in memory. Command (? for help): ? b back up GPT data to a file c change a partition's name d delete a partition i show detailed information on a partition l list known partition types n add a new partition o create a new empty GUID partition table (GPT) p print the partition table q quit without saving changes r recovery and transformation options (experts only) s sort partitions t change a partition's type code v verify disk w write table to disk and exit x extra functionality (experts only) ? print this menu Command (? for help): p Disk /dev/sdb: 2147483648 sectors, 1024.0 GiB Model: Storage Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 364CFDE7-DFC3-4BEB-815B-62B7C07050C2 Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 2147483614 Partitions will be aligned on 2048-sector boundaries Total free space is 2147483581 sectors (1024.0 GiB) Number Start (sector) End (sector) Size Code Name Command (? for help): n Partition number (1-128, default 1): First sector (34-2147483614, default = 2048) or {+-}size{KMGTP}: Last sector (2048-2147483614, default = 2147483614) or {+-}size{KMGTP}: Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): p Disk /dev/sdb: 2147483648 sectors, 1024.0 GiB Model: Storage Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 364CFDE7-DFC3-4BEB-815B-62B7C07050C2 Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 2147483614 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector) End (sector) Size Code Name 1 2048 2147483614 1024.0 GiB 8300 Linux filesystem Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): Y OK; writing new GUID partition table (GPT) to /dev/sdb. The operation has completed successfully. root@mail:~#
root@mail:~# mkdir /data-synology root@mail:~# vgs VG #PV #LV #SN Attr VSize VFree ubuntu-vg 1 1 0 wz--n- <1.82t <1.72t root@mail:~# root@mail:~# vgcreate synology /dev/sdb1 Physical volume "/dev/sdb1" successfully created. Volume group "synology" successfully created root@mail:~# root@mail:~# lvcreate -l 100%FREE -n carboniolv synology Logical volume "carboniolv" created. root@mail:~#
root@mail:~# mkfs.ext4 /dev/mapper/synology-carboniolv mke2fs 1.45.5 (07-Jan-2020) Discarding device blocks: done Creating filesystem with 268434432 4k blocks and 67108864 inodes Filesystem UUID: cb0fa8d5-c93d-4eb5-bbb1-ca4ac7c24b42 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done root@mail:~#
root@mail:~# mount /dev/mapper/synology-carboniolv /data-synology/ root@mail:~#
root@mail:~# df -hT Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 7.8G 0 7.8G 0% /dev tmpfs tmpfs 1.6G 2.5M 1.6G 1% /run /dev/mapper/ubuntu--vg-ubuntu--lv ext4 98G 18G 76G 19% / tmpfs tmpfs 7.8G 1.1M 7.8G 1% /dev/shm tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sda2 ext4 2.0G 115M 1.7G 7% /boot /dev/sda1 vfat 1.1G 6.1M 1.1G 1% /boot/efi tmpfs tmpfs 1.6G 100K 1.6G 1% /run/user/1000 /dev/mapper/synology-carboniolv ext4 1007G 28K 956G 1% /data-synology root@mail:~#
untuk pengaturan mountingnya adalah defaults,_netdev, _netdev untuk pengaturan agar mounting dilakukan setelah jaringan tersedia
root@mail:~# echo "/dev/mapper/synology-carboniolv /data-synology ext4 defaults,_netdev 0 0" >> /etc/fstab root@mail:~# root@mail:~# cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation /dev/disk/by-id/dm-uuid-LVM-TFiYXzTZiUwR0D5LpjVLDR3wDo8D3Kioctba52WpR7cHVPn1UMm3GTZYChWnLzWy / ext4 defaults 0 1 # /boot was on /dev/sda2 during curtin installation /dev/disk/by-uuid/21ae4ca5-151d-4d80-b794-6d2464ec1965 /boot ext4 defaults 0 1 # /boot/efi was on /dev/sda1 during curtin installation /dev/disk/by-uuid/37BC-8685 /boot/efi vfat defaults 0 1 /swap.img none swap sw 0 0 /dev/mapper/synology-carboniolv /data-synology ext4 defaults,_netdev 0 0 root@mail:~#