Monthly Archives: October 2015

Wiping an (Azure) SQL Server database, deleting all tables

Just for personal reference USE [mydb] GO WHILE(EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE=’FOREIGN KEY’)) BEGIN DECLARE @sql0 NVARCHAR(2000) SELECT TOP 1 @sql0=(‘ALTER TABLE [‘ + TABLE_SCHEMA + ‘].[‘ + TABLE_NAME + ‘] DROP CONSTRAINT [‘ + CONSTRAINT_NAME + ‘]’) FROM information_schema.table_constraints WHERE CONSTRAINT_TYPE = ‘FOREIGN KEY’ EXEC (@sql0) PRINT @sql0 END GO DECLARE @sql1 NVARCHAR(2000) […]

Mounting and using KVM raw image files on the host system

Boldly stolen from David Champion at the University of Chicago, and archived for personal reference. All credits to that page. kpartx will scan a block device — e.g., your /dev/loop0 — and create device-mapped specials under /dev/mapper for the partitions. Then you can address individual partitions. (N.B.: When done, before you can losetup -d the […]