пятница, 4 ноября 2016 г.

Linux Mint 18

Linux Mint 18 Cinnamon 64-bit

Установилась без проблем.

1. Загрузка 


Устанавливал на диск с Win10 с загрузкой UEFI. Пол диска оставил свободным, разбил на разделы установщик. Во время установки linux, установщик что то сказал про загрузку Windows. Не подумав ткнул продолжить, результат Win10 не грузится. Помогло

grub-install /dev/sda

После этой команды стало отображаться окно выбора загрузки операционной системы.
# efibootmgr -v
efibootmgr: EFI variables are not supported on this system.


2. Mediatomb 


Установка mediatomb, без проблем, но проблемы с запуском: systemd запускает загрузку до запуска сети. После загрузки посмотрел на процесс NetworkManager-wait-online.service
# systemctl status NetworkManager-wait-online.service
● NetworkManager-wait-online.service - Network Manager Wait Online
   Loaded: loaded (/lib/systemd/system/NetworkManager-wait-online.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Пт 2016-11-04 23:38:03 +05; 2s ago
     Docs: man:nm-online(1)
  Process: 996 ExecStart=/usr/bin/nm-online -s -q --timeout=30 (code=exited, status=0/SUCCESS)
 Main PID: 996 (code=exited, status=0/SUCCESS)


Нашел рекомендацию: выполнить ещё раз разрешения на запуск и собственно запуск
systemctl enable NetworkManager-wait-online.service
systemctl start NetworkManager-wait-online.service

А так же поправил файл запуска /lib/systemd/system/mediatomb.service Добавил Wants. Теперь, после включения ОС, Mediatomb запускается автоматически.
# cat mediatomb.service 
[Unit]
Description=UPnP MediaServer
Wants=NetworkManager-wait-online.service
After=NetworkManager-wait-online.service network.target

Файл конфигурации /etc/mediatomb/config.xml. Настройка интерфейса в файле /etc/default/mediatomb, иначе привязка к интерфейсу lo.
<?xml version="1.0" encoding="UTF-8"? >
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd" ><!--
     Read /usr/share/doc/mediatomb-common/README.gz section 6 for more
     information on creating and using config.xml configration files.
    -- >
  <server >
    <ui enabled="yes" show-tooltips="yes" >
      <accounts enabled="no" session-timeout="30" >
        <account user="mediatomb" password="mediatomb"/ >
      </accounts >
    </ui >
<!--    <interface >enp3s0</interface >  -- >
    <name >myPC MediaTomb</name >
    <udn >uuid:2edf96b3-0a40-467d-90d7-6f3de136de62</udn >
    <home >/var/lib/mediatomb</home >
    <webroot >/usr/share/mediatomb/web</webroot >
    <storage caching="yes" >
      <sqlite3 enabled="yes" >
        <database-file >mediatomb.db</database-file >
      </sqlite3 >
      <mysql enabled="no" >
        <host >localhost</host >
        <username >mediatomb</username >
        <database >mediatomb</database >
      </mysql >
    </storage >
    <pc-directory upnp-hide="yes"/ >
    <protocolInfo extend="yes"/ ><!-- For PS3 support change to "yes" -- ><!--
       Uncomment the lines below to get rid of jerky avi playback on the
       DSM320 or to enable subtitles support on the DSM units
    -- ><!--
    <custom-http-headers >
      <add header="X-User-Agent: redsonic"/ >
    </custom-http-headers >

    <manufacturerURL >redsonic.com</manufacturerURL >
    <modelNumber >105</modelNumber >
    -- ><!-- Uncomment the line below if you have a Telegent TG100 -- ><!--
       <upnp-string-limit >101</upnp-string-limit >
    -- >
    <custom-http-headers >
    <add header="transferMode.dlna.org: Streaming"/ >
    <add header="contentFeatures.dlna.org:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000"/ > 
    </custom-http-headers >
    <extended-runtime-options >
      <ffmpegthumbnailer enabled="yes" >
        <thumbnail-size >128</thumbnail-size >
        <seek-percentage >5</seek-percentage >
        <filmstrip-overlay >yes</filmstrip-overlay >
        <workaround-bugs >no</workaround-bugs >
      </ffmpegthumbnailer >
      <mark-played-items enabled="no" suppress-cds-updates="yes" >
        <string mode="prepend" >*</string >
      </mark-played-items >
    </extended-runtime-options >
  </server >
  <import hidden-files="no" >
    <filesystem-charset >UTF-8</filesystem-charset >
    <metadata-charset >UTF-8</metadata-charset >
    <playlist-charset >UTF-8</playlist-charset >
    <scripting script-charset="UTF-8" >
      <common-script >/usr/share/mediatomb/js/common.js</common-script >
      <playlist-script >/usr/share/mediatomb/js/playlists.js</playlist-script >
      <virtual-layout type="builtin" >
        <import-script >/usr/share/mediatomb/js/import.js</import-script >
        <dvd-script >/usr/share/mediatomb/js/import-dvd.js</dvd-script >
      </virtual-layout >
    </scripting >
    <mappings >
      <extension-mimetype ignore-unknown="no" >
        <map from="mp3" to="audio/mpeg"/ >
        <map from="ogg" to="application/ogg"/ >
        <map from="asf" to="video/x-ms-asf"/ >
        <map from="asx" to="video/x-ms-asf"/ >
        <map from="wma" to="audio/x-ms-wma"/ >
        <map from="wax" to="audio/x-ms-wax"/ >
        <map from="wmv" to="video/x-ms-wmv"/ >
        <map from="wvx" to="video/x-ms-wvx"/ >
        <map from="wm" to="video/x-ms-wm"/ >
        <map from="wmx" to="video/x-ms-wmx"/ >
        <map from="m3u" to="audio/x-mpegurl"/ >
        <map from="pls" to="audio/x-scpls"/ >
        <map from="flv" to="video/x-flv"/ >
<!--    <map from="mkv" to="video/x-matroska"/ >
        <map from="mka" to="audio/x-matroska"/ > -- >
        <map from="mka" to="audio/x-msaudio"/ >
        <map from="mkv" to="video/x-msvideo"/ >
        <map from="avi" to="video/divx"/ >
        <map from="m2ts" to="video/mpeg"/ >
        <map from="srt" to="video/subtitle"/ >
        <map from="sub" to="video/subtitle"/ >
        <map from="vob" to="video/mpeg"/ >
        <map from="ts" to="video/mpeg"/ >
        <map from="mp4" to="video/avc"/ >
      </extension-mimetype >
      <mimetype-upnpclass >
        <map from="audio/*" to="object.item.audioItem.musicTrack"/ >
        <map from="video/*" to="object.item.videoItem"/ >
        <map from="image/*" to="object.item.imageItem"/ >
        <map from="application/ogg" to="object.item.audioItem.musicTrack"/ >
      </mimetype-upnpclass >
      <mimetype-contenttype >
        <treat mimetype="audio/mpeg" as="mp3"/ >
        <treat mimetype="application/ogg" as="ogg"/ >
        <treat mimetype="audio/x-flac" as="flac"/ >
        <treat mimetype="image/jpeg" as="jpg"/ >
        <treat mimetype="audio/x-mpegurl" as="playlist"/ >
        <treat mimetype="audio/x-scpls" as="playlist"/ >
        <treat mimetype="audio/x-wav" as="pcm"/ >
        <treat mimetype="audio/L16" as="pcm"/ >
        <treat mimetype="video/x-msvideo" as="avi"/ >
        <treat mimetype="video/mp4" as="mp4"/ >
        <treat mimetype="audio/mp4" as="mp4"/ >
        <treat mimetype="application/x-iso9660" as="dvd"/ >
        <treat mimetype="application/x-iso9660-image" as="dvd"/ >
        <treat mimetype="video/x-matroska" as="mkv"/ >
        <treat mimetype="audio/x-matroska" as="mka"/ >
      </mimetype-contenttype >
    </mappings >
    <online-content ><!-- Make sure to setup a transcoding profile for flv -- >
      <YouTube enabled="no" refresh="28800" update-at-start="no" purge-after="604800" racy-content="exclude" format="flv" hd="no" >
        <favorites user="mediatomb"/ >
        <standardfeed feed="most_viewed" time-range="today"/ >
        <playlists user="mediatomb"/ >
        <uploads user="mediatomb"/ >
        <standardfeed feed="recently_featured" time-range="today"/ >
      </YouTube >
      <Weborama enabled="no" refresh="28800" update-at-start="no" >
        <playlist name="Active" type="playlist" mood="active"/ >
        <playlist name="Metal" type="playlist" >
          <filter >
            <genres >metal</genres >
          </filter >
        </playlist >
      </Weborama >
      <AppleTrailers enabled="no" refresh="43200" update-at-start="no" resolution="640"/ >
    </online-content >
  </import >
  <transcoding enabled="no" >
    <mimetype-profile-mappings >
      <transcode mimetype="video/x-flv" using="vlcmpeg"/ >
      <transcode mimetype="application/ogg" using="vlcmpeg"/ >
      <transcode mimetype="application/ogg" using="oggflac2raw"/ >
      <transcode mimetype="audio/x-flac" using="oggflac2raw"/ >
    </mimetype-profile-mappings >
    <profiles >
      <profile name="oggflac2raw" enabled="no" type="external" >
        <mimetype >audio/L16</mimetype >
        <accept-url >no</accept-url >
        <first-resource >yes</first-resource >
        <accept-ogg-theora >no</accept-ogg-theora >
        <agent command="ogg123" arguments="-d raw -o byteorder:big -f %out %in"/ >
        <buffer size="1048576" chunk-size="131072" fill-size="262144"/ >
      </profile >
      <profile name="vlcmpeg" enabled="no" type="external" >
        <mimetype >video/mpeg</mimetype >
        <accept-url >yes</accept-url >
        <first-resource >yes</first-resource >
        <accept-ogg-theora >yes</accept-ogg-theora >
        <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit"/ >
        <buffer size="14400000" chunk-size="512000" fill-size="120000"/ >
      </profile >
    </profiles >
  </transcoding >
</config >


3. Монтирование NTFS тома 


Так как система с двойной загрузкой, данные храним на диске NTFS. Для монтирования автоматически добавляем в /etc/fstab. Узнать UUID командой blkid.
UUID=68B8DC89B8DC5762 /media/storage1 ntfs nosuid,nodev,noexec,uid=1000,gid=131,umask=000,user,auto,locale=ru_RU.UTF-8 0 2


4. Перекодировка тегов MP3-файлов в UTF8 


В командной строке, где лежат файлы выполнить.
find -iname '*.mp3' -print0 | xargs -0 mid3iconv -eCP1251 --remove-v1

Удобная утилита для обработки тегов EasyTAG. Как пользоваться смотри здесь.

5. Установка драйвера Archer T4UH (Wi-Fi USB Adapter, rtl8812AU) 


Драйвера в ядре нет. Установка проста. Должны быть установлены пакеты для компиляции.
sudo apt-get install build-essential

cd ~
git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git
cd rtl8812AU_8821AU_linux
make
sudo make install

Перегружаемся, все работает автоматом (взято отсюда)

вторник, 1 ноября 2016 г.

Открытые файлы

Просмотр открытых файлов на  WINDOWS Server.

Смотрим открытые файлы на сервере, команду запускаем на локальной станции (нужны права)


openfiles /query /s имя_сервера /fo table /v
openfiles /query /s имя_сервера /fo table /v | find /i "dbf"

по умолчанию отображаются файлы открытые по сети. Чтобы увидеть какие файлы открыты локальными пользователями

openfiles /local on
требуется перезагрузка, ведет к снижению производительности

Отключение пользователей
Примеры:
    OPENFILES /Disconnect /?
    OPENFILES /Disconnect /ID 1
    OPENFILES /Disconnect /A  <пользователь>
    OPENFILES /Disconnect /O Read/Write
    OPENFILES /Disconnect /OP "c:\Мои Документы \пример.doc" /ID 234
    OPENFILES /Disconnect /S <система>  /U <пользователь> /ID 5
    OPENFILES /Disconnect /S <система>  /U <пользователь> /P <пароль> /ID *

вторник, 18 октября 2016 г.

MSSQL резервная копия системных баз (базы мастер)

Преподаватель Кирилл Панов

master – требуется резервное копирование , дополнительно рекомендую холодную копию
msdb – требуется резервное копирования ,как и пользовательская база
model - рекомендую холодную копию
tempdb – не требуется резервное копирование

Для быстрого восстановления MSSQL сервера необходимо делать резервные копии системных баз master и model.

Если системная база данных разрушена (отсутствует) запустить MSSQL сервер невозможно.
Поэтому рекомендуется сделать "холодную" копию баз master и model. (master.mdf, mastlog.ldf, model.mdf, modellog.ldf). Делать часто их не нужно, а только после установки сервера, сервиспаков, патчей. Другими словами база должна быть от той версии сервера, на которой восстанавливается.
Регулярный backup баз master и model делается обычным образом.

Восстановление. Копируем на место поврежденных базу master. Убеждаемся что никто не подключится к MSSQL среверу раньше нас, например уже запущенная Management Studio. Запускаем сервер с ключем -m
> cd "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn"
> sqlserv -m 

Как вариант из графики, без командной строки

 

Запускаем cmd с правами администратора
Запускаем sqlcmd с правами администратора
Подключаемся к серверу
C:\Windows\system32>sqlcmd -E
1> RESTORE DATABASE MASTER FROM DISK='D:\db\backup\master.bak' WITH REPLACE;
2> go

После выполнения этой команды MSSQL остановится, надо запустить вручную без параметра -m
Аналогично восстанавливается база model.


Если нет холодной копии master.
(Смотреть документацию) Нужен дистрибутив.
Запустите перестройку системных баз данных
setup.exe /INSTANCENAME=MSSQLSERVER /ACTION=REBUILDDATABASE /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS"

  • Недостаток относительно предыдущего метода - Очень долго
  • Можно попробовать взять master с другого сервера (not supported)








четверг, 22 сентября 2016 г.

Unmounting a LUN using the vSphere Client


Unmounting a LUN using the vSphere Client

To detach a storage device using the vSphere Client, see the Detach Storage Devices section in the vSphere 5.0 Storage Guide.

Caution: You must successfully unmount the datastore using the documented method prior to completing the steps described below. For more information, see the Unmount VMFS or NFS Datastores section in the vSphere 5.0 Storage Guide.

To unmount a LUN from an ESXi 5.0 host using the vSphere Client:
  1. If the LUN is an RDM, skip to step 2. Otherwise, in the Configuration tab of the ESXi host, click Storage. Right-click the datastore being removed and click Unmount.

    A Confirm Datastore Unmount window appears. When the prerequisite criteria have been passed, click OK.

    Note: To unmount a datastore from multiple hosts in the vSphere Client, click Hosts and Clusters > Datastores and Datastore Clusters view (Ctrl+Shift+D). Perform the unmount task and select the appropriate hosts that should no longer access the datastore to be unmounted.

  2. Click the Devices view (under Configuration > Storage):



  3. Right-click the NAA ID of the LUN (as noted above) and click Detach. A Confirm Device Unmount window is displayed. When the prerequisite criteria are passed, click OK. Under the Operational State of the Device, the LUN is listed as Unmounted.

    Note: The Detach function must be performed on a per-host basis and does not propagate to other hosts in vCenter Server. If a LUN is presented to an initiator group or storage group on the SAN, the Detach function must be performed on every host in that initiator group before unmapping the LUN from the group on the SAN. Failing to follow this step results in an all-paths-down (APD) state for those hosts in the storage group on which Detach was not performed for the LUN being unmapped.

  4. Confirm if the LUN is successfully detached. The LUN can then be safely unpresented from the SAN. For more information, contact your storage array vendor.
  5. Perform a rescan on all ESXi hosts which had visibility to the LUN. The device is automatically removed from the Storage Adapters.
When the device is detached, it stays in an unmounted state even if the device is re-presented (that is, the detached state is persistent). To bring the device back online, the device must be attached.

If you want the device to permanently decommission from an ESXi host, manually remove the NAA entries from the host configuration:
  1. To list the permanently detached devices, run this command:

    # esxcli storage core device detached list

    You see output similar to:

    Device UID State
    ------------------------------------ -----
    naa.50060160c46036df50060160c46036df off
    naa.6006016094602800c8e3e1c5d3c8e011 off


  2. To permanently remove the device configuration information from the system, run this command:

    # esxcli storage core device detached remove -d NAA_ID

    For example:

    # esxcli storage core device detached remove -d naa.50060160c46036df50060160c46036df

среда, 21 сентября 2016 г.

Soft RAID, замена HDD

После выключения не грузилась OS, не собирался RAID1 раздел boot.
Попробовал

mdadm --assemble --force /dev/md126

ни чего не изменилось, тогда 

mdadm --run /dev/md126 

раид поднялся, одного диска не хватает . Не понял почему при наличии исправного sda (sdc вышел из строя)  /boot не поднялся, а при этом / (root на sda2) поднялся нормально.


И собственно по замене диска
 

sfdisk -d /dev/sda | sfdisk /dev/sdc
mdadm --manage /dev/md126 --add /dev/sdc1
mdadm --manage /dev/md127 --add /dev/sdc2
grub2-install /dev/sdc