mirror of
				https://git.proxmox.com/git/mirror_zfs
				synced 2025-11-04 08:52:47 +00:00 
			
		
		
		
	The zimport.sh script makes use of the zpool-create.sh script to construct test pools for importing with older versions of ZoL. It is desirable to have a way to disable all the features so new pools can be imported with older code. The simplest and most flexible way to achieve this was to merge the VERBOSE_FLAG and FORCE_FLAG in to a single ZPOOL_FLAGS variable. The contents of this variable will be used in the 'zpool create' allowing us to easily pass arbitrary flags. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Prakash Surya <surya1@llnl.gov> Closes #2524
		
			
				
	
	
		
			61 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/bash
 | 
						|
#
 | 
						|
# Four disk Raid-0 DM in a single Raid-0 Configuration
 | 
						|
#
 | 
						|
 | 
						|
PVCREATE=${PVCREATE:-/sbin/pvcreate}
 | 
						|
PVREMOVE=${PVREMOVE:-/sbin/pvremove}
 | 
						|
PVDEVICES=${PVDEVICES:-"/dev/sd[abcd]"}
 | 
						|
 | 
						|
VGCREATE=${VGCREATE:-/sbin/vgcreate}
 | 
						|
VGREMOVE=${VGREMOVE:-/sbin/vgremove}
 | 
						|
VGNAME=${VGNAME:-"vg_tank"}
 | 
						|
 | 
						|
LVCREATE=${LVCREATE:-/sbin/lvcreate}
 | 
						|
LVREMOVE=${LVREMOVE:-/sbin/lvremove}
 | 
						|
LVNAME=${LVNAME:-"lv_tank"}
 | 
						|
LVSTRIPES=${LVSTRIPES:-4}
 | 
						|
LVSIZE=${LVSIZE:-32G}
 | 
						|
 | 
						|
DEVICES="/dev/${VGNAME}/${LVNAME}"
 | 
						|
 | 
						|
zpool_dm_destroy() {
 | 
						|
	msg ${LVREMOVE} -f ${VGNAME}/${LVNAME}
 | 
						|
	${LVREMOVE} -f ${VGNAME}/${LVNAME} >/dev/null
 | 
						|
 | 
						|
	msg ${VGREMOVE} -f ${VGNAME}
 | 
						|
	${VGREMOVE} -f ${VGNAME} >/dev/null
 | 
						|
 | 
						|
	msg ${PVREMOVE} ${PVDEVICES}
 | 
						|
	${PVREMOVE} ${PVDEVICES} >/dev/null
 | 
						|
}
 | 
						|
 | 
						|
zpool_create() {
 | 
						|
	# Remove EFI labels which cause pvcreate failure
 | 
						|
	for DEVICE in ${PVDEVICES}; do
 | 
						|
		dd if=/dev/urandom of=${DEVICE} bs=1k count=32 &>/dev/null
 | 
						|
	done
 | 
						|
 | 
						|
	msg ${PVCREATE} -f ${PVDEVICES}
 | 
						|
	${PVCREATE} -f ${PVDEVICES} >/dev/null || exit 1
 | 
						|
 | 
						|
	msg ${VGCREATE} ${VGNAME} ${PVDEVICES}
 | 
						|
	${VGCREATE} ${VGNAME} ${PVDEVICES} >/dev/null || exit 2
 | 
						|
 | 
						|
	msg ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \
 | 
						|
		--name=${LVNAME} ${VGNAME}
 | 
						|
	${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \
 | 
						|
		--name=${LVNAME} ${VGNAME} >/dev/null || exit 3
 | 
						|
 | 
						|
	msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}
 | 
						|
	${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \
 | 
						|
		${DEVICES} || (zpool_dm_destroy && exit 4)
 | 
						|
}
 | 
						|
 | 
						|
zpool_destroy() {
 | 
						|
	msg ${ZPOOL} destroy ${ZPOOL_NAME}
 | 
						|
	${ZPOOL} destroy ${ZPOOL_NAME}
 | 
						|
 | 
						|
	zpool_dm_destroy
 | 
						|
}
 |