[mythtv-users] Adding new 1 Terabyte Drive and Moving existing Recordings

Craig Sanders cas at taz.net.au
Tue Jan 6 22:50:47 UTC 2009


On Tue, Jan 06, 2009 at 09:11:19AM -0600, Kevin Kuphal wrote:
> If your videos are in /var/mythtv, then:
> 
> 1.  Mount new drive in a temp location like /mnt/newdrive.

so far so good.

> 2.  Move (mv) all your files from /var/mythtv to /mnt/newdrive

mv is the wrong command to use here, in case something goes wrong. when
moving lots of large files from one file-system to another, it's better
to copy first, delete later (if moving files around on the same fs, mv
is better as it is much faster...it doesn't need to move the data, only
update the directory entries)

instead, use rsync like so:

rsync -a /var/mythtv /mnt/newdrive

or, with verbose output and progress:

rsync -a -v --progress --stats /var/mythtv /mnt/newdrive



one of the advantages of using rsync rather than mv or cp is that you
can take as long as you want to finish the job. you can spread it over
days or weeks even. so if the rsync takes hours and you want to go to
sleep before it finishes, just do so. when you get up in the morning,
run rsync again and it will be quick because it only needs to copy the
new & changed files.

actually, recordings may have been deleted during that time so you
should use the '--delete' option too. so the rsync command should be:

  rsync -a -v --delete --progress --stats /var/mythtv /mnt/newdrive

you can keep doing this for as long as you want until you have time to
continue on with step 3.

so, if you're planning to do this on the weekend, you can run the rsync
a few times throughout the week while you're at work. you can even set
up a cron job to run it every few hours (but remember to disable the
cron job when you're ready to go the next step).

i've migrated entire file-servers with terabytes of storage constantly
being updated by hundreds of users this way. and the only downtime is
the few minutes it takes after the final rsync to shutdown the old
fileserver and change the hostname/IP address/etc of the new.

> 3.  Unmount /mnt/newdrive
> 4.  Mount your new drive in /var/mythtv (which is now an empty folder)

instead of step 3 & 4:

3. wait until nothing is being recorded by myth and shut down
   mythfrontend and mythbackend.

4. run rsync again in case any recordings were made or deleted
   while the first rsync was running.

   The rsync(s) in step 2 above can and should be run while myth is
   still operating as normal. but it is important to run this final
   rsync while myth is not running. doing it like this will minimise
   downtime and ensure that nothing is missed.

5. mv /var/mythtv /var/mythtv.old
6. mkdir /var/mythtv
7. mount your new drive as /var/mythtv
8. chown mythtv.mythtv /var/mythtv
9. chmod 2775 /var/mythtv
10. restart mythbackend and mythfrontend.

test the new setup.  if everything is working well, you can delete the old
recordings from /var/mythtv.old with:

    nice -n 19 rm -rf /var/mythtv.old

and don't forget to edit /etc/fstab so that the new drive is mounted
automaticallt as /var/mythtv at boot.

/dev/????       /var/mythtv    xfs     defaults        0       2



one final note: the above is assuming that the original /var/mythtv was
a subdirectory of either the root or /var filesystem. if it was another
partition or drive mounted as /var/mythtv then replace step 5 and 6 with:

5.  umount /var/mythtv
5a. mkdir /var/mythtv.old    (optional)
5b. mount the old mythtv partition as /var/mythtv.old (optional)

then continue on with step 6 above.



craig

-- 
craig sanders <cas at taz.net.au>


More information about the mythtv-users mailing list