Difference between revisions of "Storagegroup table"

From MythTV Official Wiki
Jump to: navigation, search
(Some more miscellaneous maintenance sql.)
m
 
(2 intermediate revisions by one other user not shown)
Line 43: Line 43:
 
</pre>
 
</pre>
  
On a new install, the default base dirname is /var/lib/mythtv/ so the matching dirname are
+
On a new install, the table is empty.
<pre>
 
/var/lib/mythtv/recordings/
 
/var/lib/mythtv/videos/
 
/var/lib/mythtv/fanart/
 
/var/lib/mythtv/trailers/
 
/var/lib/mythtv/coverart/
 
/var/lib/mythtv/screenshots/
 
/var/lib/mythtv/banners/
 
/var/lib/mythtv/db_backups/
 
/var/lib/mythtv/livetv/
 
/var/lib/mythtv/streaming/
 
</pre>
 
  
 
== SQL ==
 
== SQL ==
Line 65: Line 53:
 
Check your sql has the intended result first
 
Check your sql has the intended result first
 
<pre>
 
<pre>
    select groupname,hostname,concat('/srv/',substring(dirname,10)) as newdirname from storagegroup;
+
SELECT groupname,hostname,concat('/srv/',substring(dirname,10)) AS newdirname FROM storagegroup;
 
</pre>
 
</pre>
  
 
Then apply the block copy
 
Then apply the block copy
 
<pre>
 
<pre>
insert into storagegroup (groupname,hostname,dirname)
+
INSERT INTO storagegroup (groupname,hostname,dirname)
    select groupname,hostname,concat('/srv/',substring(dirname,10)) as newdirname from storagegroup;
+
  SELECT groupname,hostname,concat('/srv/',substring(dirname,10)) AS newdirname FROM storagegroup;
 
</pre>
 
</pre>
 
10 rows inserted.
 
10 rows inserted.
Line 77: Line 65:
 
If you need to amend your hostname, or insert a storagegroup block from another backend
 
If you need to amend your hostname, or insert a storagegroup block from another backend
 
<pre>
 
<pre>
update storagegroup set hostname='localhost';
+
UPDATE storagegroup SET hostname='localhost';
 
</pre>
 
</pre>
  
Line 88: Line 76:
 
Clear out the mess first
 
Clear out the mess first
 
<pre>
 
<pre>
delete from storagegroup;
+
TRUNCATE TABLE storagegroup;
 
</pre>
 
</pre>
  
Then put back a clean set.  You may want to first find & replace localhost with your correct hostname.
+
[[Category:DB Table]]
Listed with complete inserts on each line so you can quickly amend it to suit your needs.
 
<pre>
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(1,  'Default',    'localhost', '/var/lib/mythtv/recordings/' );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(2,  'Videos',      'localhost', '/var/lib/mythtv/videos/'    );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(3,  'Fanart',      'localhost', '/var/lib/mythtv/fanart/'    );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(4,  'Trailers',    'localhost', '/var/lib/mythtv/trailers/'  );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(5,  'Coverart',    'localhost', '/var/lib/mythtv/coverart/'  );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(7,  'Screenshots', 'localhost', '/var/lib/mythtv/screenshots/');
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(8,  'Banners',    'localhost', '/var/lib/mythtv/banners/'    );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(9,  'DB Backups',  'localhost', '/var/lib/mythtv/db_backups/' );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(10, 'LiveTV',      'localhost', '/var/lib/mythtv/livetv/'    );
 
INSERT INTO `storagegroup` (`id`, `groupname`, `hostname`, `dirname`) VALUES(11, 'Streaming',  'localhost', '/var/lib/mythtv/streaming/'  );
 
</pre>
 

Latest revision as of 21:25, 9 February 2014

Important.png Note: The correct title of this article is storagegroup table. It appears incorrectly here due to technical restrictions.

The storagegroup table contains the Storage Groups that are configured in mythtv-setup.

Table Description

Field name Type Null Key Default Extras
id int(11) PRI NULL auto_increment
groupname varchar(32) MUL NULL
hostname varchar(64) MUL NULL
dirname varchar(255) NULL

Fields

  • id is a unique identifier for entries in this table.
  • groupname is the name of the Storage Group.
  • dirname is the directory of the Storage Group.

Example Entries

       id: 1
groupname: Default
 hostname: localhost.localdomain
  dirname: /video/recordings/ 

Commonly used groupname field values

Default
Videos
Fanart
Trailers
Coverart
Screenshots
Banners
DB Backups
LiveTV
Streaming

On a new install, the table is empty.

SQL

If you want to add another block of entries, because say you have another volume with storage, use this sql. The id column is left out because it auto-increments during the insert. phpmyadmin is an easy to use tool for applying sql.

Check your sql has the intended result first

SELECT groupname,hostname,concat('/srv/',substring(dirname,10)) AS newdirname FROM storagegroup;

Then apply the block copy

INSERT INTO storagegroup (groupname,hostname,dirname)
  SELECT groupname,hostname,concat('/srv/',substring(dirname,10)) AS newdirname FROM storagegroup;

10 rows inserted.

If you need to amend your hostname, or insert a storagegroup block from another backend

UPDATE storagegroup SET hostname='localhost';

See also Storage_Groups for how these entries are used.

Default

If you screw up your storagegroup table, or just want to reset it to default

Clear out the mess first

TRUNCATE TABLE storagegroup;