Monday, February 6, 2012

CHROOT to remote fedora 16 install on SAN via iscsiadm

The goal of this post is to help you gain access to a CHROOT environment of a F16 install which was installed to a SAN via iscsi.

While working on installing fedora to a diskless system using iscsi root and boot, my system would not boot. I needed a way to access the system in chroot so I could reinstall grub with the proper iscsi boot config. Everything discussed here is Fedora 16 64bit. I am using an EMC VNXe 3100 SAN. For this demonstration, I do not have chap enabled so it is not discussed here.

Boot the Fedora 16 Live CD USB
  • Boot Fedora 16 Live USB. I had some problems getting mine to boot so see blog entry http://ispman.blogspot.com/2012/02/boot-fedora-16-64-bit-live-boot-from.html
  • Open a terminal window and su
Connect to the SAN via iSCSI using iscsiadm
  • Edit /etc/iscsi/initiatorname.iscsi and put in the iqn your machine is going to initiate iscsi as. In my case: InitiatorName=iqn.1986-03.com.ibm:06LEJE8.linux Note: The initiator name also needs programmed in your SAN to allow connections from the IQN.
  • Reload iscsi:
#/etc/init.d/iscsi restart
  • Setup your ethernet card to have an IP on the SAN network:
# ifconfig eth0 172.16.10.100/24
  • Add the network card you are going to use for iscsi to the iscsi database:
# iscsiadm -m iface -I eth0 -o new
New interface eth0 added
  • Add the iscsi target to your isci database using iscsiadm: iscsiadm -m node -T -p -o new
# iscsiadm -m node -T iqn.1992-05.com.emc:apm001140005820000-10-vnxe -p 172.16.10.18 -o new

Starting iscsid:

New iSCSI node [tcp:[hw=,ip=,net_if=,iscsi_if=default] 172.16.10.18,3260,-1 iqn.1992-05.com.emc:ap001140005820000-10-vnxe] added
  • Now log into the iscsi target: iscsiadm -m node -T -p -l

# iscsiadm -m node -T iqn.1992-05.com.emc:ap001140005820000-10-vnxe -p 172.16.10.18 -l

Logging in to [iface: default, target: iqn.1992-05.com.emc:apm00114005820000-10-vnxe, portal: {172.16.10.18,3260]

Login to [iface: default, target: iqn.1992-05.com.emc:apm00114005820000-10-vnxe, portal: {172.16.10.18,3260] successful

  • Ensure the session is up and running

# iscsiadm -m session -P 3

  • Using dmesg, find what device your iscsi drive was attached to. In my case it was sdb
  • I used LVM when I installed to the iscsi target before so I have to bring up the lv's

#fdisk -l /dev/sdb

  • Use lvs to find the VG name

#lvs

  • Make the lv active

#vgchange -a y VolGroup

  • Make your temporary mountpoint

#mkdir /mnt/sysimage

  • Mount the root partition to sysimage. For me, lvs told me the name was lv_root, then mount the rest

#mount /dev/VolGroup/lv_root /mnt/sysimage

#mount -t tmpfs none /mnt/sysimage/tmp

#mount -t tmpfs none /mnt/sysimage/var/lock

#mount -t tmpfs none /mnt/sysimage/var/lib/iscsi

#mount --bind /dev /mnt/sysimage/dev

#mount -t proc none /mnt/sysimage/proc

  • Mount the boot partition of the drive which for me was sdb2

#mount /dev/sdb2 /mnt/sysimage/boot

  • Begin the chroot

#chroot /mnt/sysimage

#source /etc/profile


No comments: