«Загрузка VirtualBox с внешнего usb диска» и «Recover Deleted Files on an NTFS Hard Drive from a Linux»: разница между страницами

Материал из support.qbpro.ru
(Различия между страницами)
imported>Vix
(Новая страница: «Загрузка VirtualBox с внешнего usb диска Начиная с версии 1.4, в качестве альтернативы использо…»)
 
imported>Vix
(Новая страница: «To undelete our files, we first need to identify the hard drive that we want to undelete from. In the terminal window, type in: sudo fdisk –l and press ente…»)
 
Строка 1: Строка 1:
Загрузка VirtualBox с внешнего usb диска
To undelete our files, we first need to identify the hard drive that we want to undelete from. In the terminal window, type in:


Начиная с версии 1.4, в качестве альтернативы использования образов виртуальных дисков (описывается подробно в Chapter 5,  Virtual storage  ), VirtualBox может также предоставить физический жесткий диск или любой выбранный раздел как виртуальный диск для виртуальной машины.
  sudo fdisk –l


В VirtualBox этот вид доступа называется "raw hard disk access"; он позволяет гостевой операционной системы получить доступ к своему виртуальному жесткому диску без использования файловой системы хоста. Реальная производительность при использовании файлов образов и raw дисков будет различаться, и во многом зависит от файловой системы хоста, использования метода динамического расширения дисков и стратегии кеширования ОС хоста. Кеширования также косвенно затрагивает другие аспекты - такие как отказоустойчивость файловой системе, т.е. будет ли виртуальный диск содержать ошибки после аварийного завершения ОС хоста. Ищите подробную информацию о вашей файловой системе в документации по вашей ОС.
and press enter.
Предупреждение


Использовать "raw hard disk access" рекомендуется только опытным пользователям. Неправильное использование режима может привести к полной потере данных  на физическом диске. Самое главное,  не  пытайтесь загрузить гостевую систему с раздела, с которого в настоящее время загружена ОС хоста. Это может привести к непредсказуемым повреждениям ваших данных.
  sshot-2


Доступ через "raw hard disk access" - как ко всему диску так и к отдельным его разделам, - осуществляется через механизм образов диска VMDK. Поэтому, вам придется создать специальный файл VMDK, который определяет, где данные будут хранится. После его создания, вы можете использовать его как обычный виртуальный образ диска. Например, вы можете использовать менеджер виртуалных носителей ( Section 3.5, “The Virtual Disk Manager” ) или  VBoxManage для подключения образа к виртуальной машине.
What you’re looking for is a line that ends with HPSF/NTFS (under the heading System). In our case, the device is “/dev/sda1”. This may be slightly different for you, but it will still begin with /dev/. Note this device name.
9.10.1.Доступ ко всему жесткому диску


Хотя этот вариант является самым простым для настройки, вы должны понимать, что это даст гостевой операционной системы прямой и полный доступ ко  всему физическому диску  . Если ваша  ОС хоста  operating также загружена с этого диска, будьте предельно осторожны, чтобы не дать доступ полный гостевой системе к системному разделу хоста. С другой стороны, на физическом диске можно изменить структуру или состав разделов, без повторного создания файлов виртуальных образов дисков.
If you have more than one hard drive partition formatted as NTFS, then you may be able to identify the correct partition by the size. If you look at the second line of text in the screenshot above, it reads “Disk /dev/sda: 136.4 GB, …” This means that the hard drive that Ubuntu has named /dev/sda is 136.4 GB large. If your hard drives are of different size, then this information can help you track down the right device name to use. Alternatively, you can just try them all, though this can be time consuming for large hard drives.


Чтобы создать образ, который представляет весь физический жесткий диск на Linux хосте, используйте команду
Now that you know the name Ubuntu has assigned to your hard drive, we’ll scan it to see what files we can uncover.
vboxmanage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda


Данная команда создаст файл образа  /path/to/file.vmdk (путь должен быть указан полный), для доступа к данным на физического устройства  /dev/sda .
In the terminal window, type:


На Windows хосте вместо /dev/sda, указывается MS спецификация устройств, т.е. \\.\PhysicalDrive0 .
  sudo ntfsundelete <HD name>


Создание образа (физического диска) требует полных прав (чтение и запись) к этому устройству. Полный доступ к нему также необходим при использовании образа в виртуальной машине.
and hit enter. In our case, the command is:


Так же как с простыми образами дисков, данная команда автоматически не зарегистрирует новый образ в реестре менеджера виртуальных дисков. Если вы хотите это сделать автоматически , добавте опцию -register :
  sudo ntfsundelete /dev/sda1
vboxmanage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -register


После регистрации вы можете подключить новый образ диска к виртуальной машине
sshot-3
vboxmanage modifyvm WindowsXP -hda /path/to/file.vmdk


После выполнения данной команды указанная виртуальная машина будет грузиться с данного физического диска.
The names of files that can recovered show up in the far right column. The percentage in the third column tells us how much of that file can be recovered. Three of the four files that we originally deleted are showing up in this list, even though we shut down the computer right after deleting the four files – so even in ideal cases, your files may not be recoverable.
9.10.2. Доступ к отдельным разделам жесткого диска


Данный режим "raw partition support" сильно похож на режим "full hard disk", который описан выше. Однако, в этом случае, в VMDK образе будет содержаться информация о разделах диска. В данном режиме вы можете, например, указать другой образ загрузчика для виртуального жесткого диска без внесения изменений в физический диск. Гостю будет  видеть  все существующие разделы на физическом диске, однако доступ будет ограничен указанными разделами диска.
Nevertheless, we have three files that we can recover – two JPGs and an MPG.


Для создания образа "raw partition support" (который будет небольшим по размеру, как было упомянуто ранее), в Linux используйте команду:
Note: ntfsundelete is immediately available in the Ubuntu 9.10 Live CD. If you are in a different version of Ubuntu, or for some other reason get an error when trying to use ntfsundelete, you can install it by entering “sudo apt-get install ntfsprogs” in a terminal window.
vboxmanage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5


Как вы видете , эта команда идентична команде создающей образ "full hard disk" , за исключения добавленого параметра  -partitions . В данном примере создается образ  /path/to/file.vmdk и разделы 1 и 5 устройства  /dev/sda будут доступны для гостевой системы.
To quickly recover the two JPGs, we will use the * wildcard to recover all of the files that end with .jpg.


VirtualBox использует ту же самую нумерацию разделов, что и ваш хост Linux. Поэтому , номера указанные в вышеприведенном примере будут указывать на первый диск первичного раздела и первый диск дополнительного раздела (first primary partition and first logical drive in the extended partition).
In the terminal window, enter


На Windows хосте вместо /dev/sda, указывается MS спецификация устройств, т.е. \\.\PhysicalDrive0 . Номера разделов указываются те же, что и в Linux и Windows.
  sudo ntfsundelete <HD name> –u –m *.jpg


Список номеров разделов вы можете получить командой
which is, in our case,
VBoxManage internalcommands listpartitions -rawdisk /dev/sda


Вывод этой команды содержит список разделов, их тип и размер, что позволяет пользователю определить нужный раздел.
sudo ntfsundelete /dev/sda1 –u –m *.jpg


Образы которые предоставляют доступ к отдельным разделам привязаны к дискам хост системы. Вы не можете передать эти образы на другой хост; также , всякий раз при изменении разделов, образы  должны быть пересозданы  .
sshot-10


Создание образа (физического диска) требует полных прав (чтение и запись) к этому устройству. Полный доступ к нему также необходим при использовании образа в виртуальной машине. Если это не возможно, имеется особый вариант "raw partition access" (в настоящее время доступен только для Linux хостов) который позволяет избежать предоставления полного доступа ко всему диску текущему пользователю. Для настройки этих образов используйте команду
The two files are recovered from the NTFS hard drive and saved in the current working directory of the terminal. By default, this is the home directory of the current user, though we are working in the Desktop folder.
vboxmanage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5 -relative


При использовании в его в виртуальной машине, образ будет представлять не весь диск, а только определенные разделы (в примере  /dev/sda1 и  /dev/sda5 ). Поэтому, полный доступ требуется только к этим разделам, а не ко всему диску. Однако для создания этого образа полный доступ ко всему диску необходим для получения информации о структуре диска.
Note that the ntfsundelete program does not make any changes to the original NTFS hard drive. If you want to take those files and put them back in the NTFS hard drive, you will have to move them there after they are undeleted with ntfsundelete. Of course, you can also put them on your flash drive or open Firefox and email them to yourself – the sky’s the limit!


В некоторых конфигурация возможно потребуется изменение кода MBR создаваемого образа, например чтобы заменить загрузчик Linux, вместо того который используется хостом. Это позволит, например, сразу загрузить гостевую систему Windows, если Linux хост система загружается с "того же самого" диска. С этой целью применяется параметр  -mbr. Он определяет имя файла в котором хранится код MBR. При этом таблица разделов не изменяется, что позволяет использовать один файл с кодом MBR для загрузки с различных разделов. Пример использования:
We have one more file to undelete – our MPG.
vboxmanage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5 -mbr winxp.mbr


Код из файла MBR будет сохранен внутри образа, а не на диске хоста.
sshot-4


Для всех приведенных выше примерах, вы можете сразу зарегистрировать создаваемый образ в реестре VirtualBox добавлением параметра  -register в приведенные команды. Тогда образ сразу появится в списке зарегистрированных образов дисков в менеджере виртуальных носителей. Пример:
Note the first column on the far left. It contains a number, its Inode. Think of this as the file’s unique identifier. Note this number.
vboxmanage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5 -relative -register


сдесь создается образ ссылающийся на разделы диска и в случае успешного его создания регистрирует его в реестре образов дисков.
To undelete a file by its Inode, enter the following in the terminal:


* [http://mirspo.narod.ru/vbox/ch09s10.html статья тут]
sudo ntfsundelete <HD name> –u –i <Inode>


[http://kubuntu.ru/node/7624 примеры]
In our case, this is:
 
sudo ntfsundelete /dev/sda1 –u –i 14159
 
sshot-11
 
This recovers the file, along with an identifier that we don’t really care about. All three of our recoverable files are now recovered.
<hr>
'''Resurses:'''
<hr>
* [https://www.howtogeek.com/howto/13706/recover-deleted-files-on-an-ntfs-hard-drive-from-a-ubuntu-live-cd/ Recover Deleted Files on an NTFS Hard Drive from a Ubuntu Live CD]

Версия от 23:39, 25 сентября 2017

To undelete our files, we first need to identify the hard drive that we want to undelete from. In the terminal window, type in:

sudo fdisk –l
and press enter.
sshot-2

What you’re looking for is a line that ends with HPSF/NTFS (under the heading System). In our case, the device is “/dev/sda1”. This may be slightly different for you, but it will still begin with /dev/. Note this device name.

If you have more than one hard drive partition formatted as NTFS, then you may be able to identify the correct partition by the size. If you look at the second line of text in the screenshot above, it reads “Disk /dev/sda: 136.4 GB, …” This means that the hard drive that Ubuntu has named /dev/sda is 136.4 GB large. If your hard drives are of different size, then this information can help you track down the right device name to use. Alternatively, you can just try them all, though this can be time consuming for large hard drives.

Now that you know the name Ubuntu has assigned to your hard drive, we’ll scan it to see what files we can uncover.

In the terminal window, type:

sudo ntfsundelete <HD name>

and hit enter. In our case, the command is:

sudo ntfsundelete /dev/sda1

sshot-3

The names of files that can recovered show up in the far right column. The percentage in the third column tells us how much of that file can be recovered. Three of the four files that we originally deleted are showing up in this list, even though we shut down the computer right after deleting the four files – so even in ideal cases, your files may not be recoverable.

Nevertheless, we have three files that we can recover – two JPGs and an MPG.

Note: ntfsundelete is immediately available in the Ubuntu 9.10 Live CD. If you are in a different version of Ubuntu, or for some other reason get an error when trying to use ntfsundelete, you can install it by entering “sudo apt-get install ntfsprogs” in a terminal window.

To quickly recover the two JPGs, we will use the * wildcard to recover all of the files that end with .jpg.

In the terminal window, enter

sudo ntfsundelete <HD name> –u –m *.jpg

which is, in our case,

sudo ntfsundelete /dev/sda1 –u –m *.jpg

sshot-10

The two files are recovered from the NTFS hard drive and saved in the current working directory of the terminal. By default, this is the home directory of the current user, though we are working in the Desktop folder.

Note that the ntfsundelete program does not make any changes to the original NTFS hard drive. If you want to take those files and put them back in the NTFS hard drive, you will have to move them there after they are undeleted with ntfsundelete. Of course, you can also put them on your flash drive or open Firefox and email them to yourself – the sky’s the limit!

We have one more file to undelete – our MPG.

sshot-4

Note the first column on the far left. It contains a number, its Inode. Think of this as the file’s unique identifier. Note this number.

To undelete a file by its Inode, enter the following in the terminal:

sudo ntfsundelete <HD name> –u –i <Inode>

In our case, this is:

sudo ntfsundelete /dev/sda1 –u –i 14159

sshot-11

This recovers the file, along with an identifier that we don’t really care about. All three of our recoverable files are now recovered.


Resurses: