Где хранятся файлы ubuntu в windows 10

I've installed wsl2 on my windows machine and I was not able to figure out where the files are actually stored. Note, that I don't mean that I wanna browse them inside the file explorer - I know i...

I’ve installed wsl2 on my windows machine and I was not able to figure out where the files are actually stored.
Note, that I don’t mean that I wanna browse them inside the file explorer — I know it can be done by typing in the explorer \wsl$.
If I would have to guess I would say the files are stored in the same hard-drive that the os is stored.

So actually I have two related questions.

  1. Where the files are stored?
  2. If they are stored in the hard drive of my os, can I somehow relocate my wsl to another hard drive?

EDIT:
I was able to locate the installation path, in my machine the path is:
C:UsersEliranAppDataLocalPackagesCanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgscLocalState

Is there a way to mount this to another location?

Dweeberly's user avatar

Dweeberly

4,5782 gold badges21 silver badges39 bronze badges

asked Oct 3, 2020 at 14:56

Eliran Turgeman's user avatar

Eliran TurgemanEliran Turgeman

1,4442 gold badges11 silver badges28 bronze badges

6

All the files are stored in a ext4.vhd files in the installation directory, which you can’t mount directly onto windows as it is in ext4 (obv)

There’s two ways to change the location of the above mentioned vhd file the official, tedious way and an unofficial quick and dirty way

The official tedious way

  1. Export the distro to a location with wsl.exe --export <Distro> <FileName> from CMD/PowerShell
  2. Import the distro to a different location with wsl.exe --import <Distro> <InstallLocation> <FileName> [Options]

The problems with this is it’s quite time consuming and after you do this, pray that it exported and imported several gigabytes worth of thousands of files without any problems

The quick and dirty way

This involes an unofficial opensource WSL manager called lxrunoffline

To install it (takes like a min at max) read through the instructions by the dev here

If you installed it by manually downloading the binaries from the release page, make sure to install it to a directory in PATH, like C:Windows

Now the process is simple as lxrunoffline move -n <distroname> -d <destination-folder>

For example lxrunoffline move -n Ubuntu-20.04 -d G:wsl

Hope I helped

Edit: typo

answered Oct 6, 2020 at 5:31

zwxi's user avatar

1

I executed these commands in PowerShell to move my Ubuntu distro from C: to drive D:wsl-ubuntu :

PS C:Userssmarc> mkdir D:wsl-ubuntu  (create new location)
PS C:Userssmarc> wsl -l -v            (list wsl distros)
NAME                   STATE           VERSION
Ubuntu                 Running         2
PS C:Userssmarc> wsl --shutdown
PS C:Userssmarc> wsl -l -v            (verify if is stopped)
NAME                   STATE           VERSION
Ubuntu                 Stopped         2
PS C:Userssmarc> wsl --export Ubuntu ubuntu.tar  
PS C:Userssmarc> wsl --unregister Ubuntu
PS C:Userssmarc> wsl --import Ubuntu D:wsl-ubuntu .ubuntu.tar --version 2

and reboot the computer at the end.

The only problem I have is that the default user when I started the Ubuntu application is the root. I need to execute $ su sergio to enter in my personal user.

You can delete the ubuntu.tar at the end of process.

#edit 2021-04-13: As pointed out in the comments, I had forgotten the «—export» command.

answered Apr 12, 2021 at 20:51

Sergio Marcelo C Figueiredo's user avatar

6

This is an answer to your last question: use symbolic links

  • open command prompt as administrator
  • shut down wsl vm using wsl --shutdown
  • change folder to C:UsersEliranAppDataLocalPackagesCanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc
  • move the LocalState folder to another location like Z:wslUbuntu
  • create symbolic link with mklink /J LocalState Z:WSLUbuntuLocalState

I would also edit/create the .wslconfig file from your user folder to move the swap file to the folder where you store your WSL vm’s and maybe edit/add options for CPU cores and RAM assignment

[wsl2]
memory=4GB
processors=2
swap=1GB
swapFile=Z:\WSL\swap.vhdx
  • memory is the maximum amount your ram that WSL will use;
  • processors is the alocated cores to your WSL vm;
  • swap is the size of the swap file;
  • swapFile is the location of your swap and to my knowledge is used by all WSL vm’s; notice the double slashes in the path, they are mandatory for the path.

Start your WSL VM as you normally would.

answered Apr 30, 2021 at 18:18

Gregory Butler's user avatar

1

I’ve installed wsl2 on my windows machine and I was not able to figure out where the files are actually stored.
Note, that I don’t mean that I wanna browse them inside the file explorer — I know it can be done by typing in the explorer \wsl$.
If I would have to guess I would say the files are stored in the same hard-drive that the os is stored.

So actually I have two related questions.

  1. Where the files are stored?
  2. If they are stored in the hard drive of my os, can I somehow relocate my wsl to another hard drive?

EDIT:
I was able to locate the installation path, in my machine the path is:
C:UsersEliranAppDataLocalPackagesCanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgscLocalState

Is there a way to mount this to another location?

Dweeberly's user avatar

Dweeberly

4,5782 gold badges21 silver badges39 bronze badges

asked Oct 3, 2020 at 14:56

Eliran Turgeman's user avatar

Eliran TurgemanEliran Turgeman

1,4442 gold badges11 silver badges28 bronze badges

6

All the files are stored in a ext4.vhd files in the installation directory, which you can’t mount directly onto windows as it is in ext4 (obv)

There’s two ways to change the location of the above mentioned vhd file the official, tedious way and an unofficial quick and dirty way

The official tedious way

  1. Export the distro to a location with wsl.exe --export <Distro> <FileName> from CMD/PowerShell
  2. Import the distro to a different location with wsl.exe --import <Distro> <InstallLocation> <FileName> [Options]

The problems with this is it’s quite time consuming and after you do this, pray that it exported and imported several gigabytes worth of thousands of files without any problems

The quick and dirty way

This involes an unofficial opensource WSL manager called lxrunoffline

To install it (takes like a min at max) read through the instructions by the dev here

If you installed it by manually downloading the binaries from the release page, make sure to install it to a directory in PATH, like C:Windows

Now the process is simple as lxrunoffline move -n <distroname> -d <destination-folder>

For example lxrunoffline move -n Ubuntu-20.04 -d G:wsl

Hope I helped

Edit: typo

answered Oct 6, 2020 at 5:31

zwxi's user avatar

1

I executed these commands in PowerShell to move my Ubuntu distro from C: to drive D:wsl-ubuntu :

PS C:Userssmarc> mkdir D:wsl-ubuntu  (create new location)
PS C:Userssmarc> wsl -l -v            (list wsl distros)
NAME                   STATE           VERSION
Ubuntu                 Running         2
PS C:Userssmarc> wsl --shutdown
PS C:Userssmarc> wsl -l -v            (verify if is stopped)
NAME                   STATE           VERSION
Ubuntu                 Stopped         2
PS C:Userssmarc> wsl --export Ubuntu ubuntu.tar  
PS C:Userssmarc> wsl --unregister Ubuntu
PS C:Userssmarc> wsl --import Ubuntu D:wsl-ubuntu .ubuntu.tar --version 2

and reboot the computer at the end.

The only problem I have is that the default user when I started the Ubuntu application is the root. I need to execute $ su sergio to enter in my personal user.

You can delete the ubuntu.tar at the end of process.

#edit 2021-04-13: As pointed out in the comments, I had forgotten the «—export» command.

answered Apr 12, 2021 at 20:51

Sergio Marcelo C Figueiredo's user avatar

6

This is an answer to your last question: use symbolic links

  • open command prompt as administrator
  • shut down wsl vm using wsl --shutdown
  • change folder to C:UsersEliranAppDataLocalPackagesCanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc
  • move the LocalState folder to another location like Z:wslUbuntu
  • create symbolic link with mklink /J LocalState Z:WSLUbuntuLocalState

I would also edit/create the .wslconfig file from your user folder to move the swap file to the folder where you store your WSL vm’s and maybe edit/add options for CPU cores and RAM assignment

[wsl2]
memory=4GB
processors=2
swap=1GB
swapFile=Z:\WSL\swap.vhdx
  • memory is the maximum amount your ram that WSL will use;
  • processors is the alocated cores to your WSL vm;
  • swap is the size of the swap file;
  • swapFile is the location of your swap and to my knowledge is used by all WSL vm’s; notice the double slashes in the path, they are mandatory for the path.

Start your WSL VM as you normally would.

answered Apr 30, 2021 at 18:18

Gregory Butler's user avatar

1

  • Remove From My Forums
  • Вопрос

  • Добрый день. Подскажите пожалуйста , в какой папке находится ubuntu. 

    В папке C:Usersимя_пользователяAppDataLocallxss отсутствует lxss папка (включено отображение скрытых файлов )

Ответы

  • Это так должно выглядеть :) ?

    Добрый день.

    Думаю да.

    Нет возможности проверить так как нет под рукой ос Windows 10.

    По технологию понятно, но Поясните зачем вам данные файлы?

    Если вопрос решен, пометьте сообщения которые вам помогли в качестве ответа


    Я не волшебник, я только учусь
    MCP, MCTS. Мнения, высказанные здесь, являются отражением моих личных взглядов, а не позиции работодателя. Вся информация предоставляется как есть без каких-либо гарантий.
    Блог IT Инженера и
    IT Reviews

    • Изменено

      13 сентября 2016 г. 21:43
      Дополнил

    • Помечено в качестве ответа
      artemgauch
      13 сентября 2016 г. 21:50

Просто найдите папку, названную в честь дистрибутива Linux. В папке дистрибутива Linux дважды щелкните папку «LocalState», а затем дважды щелкните папку «rootfs», чтобы просмотреть ее файлы. Примечание. В более старых версиях Windows 10 эти файлы хранились в C: ИмяПользователяAppDataLocallxss.

Как мне получить доступ к файлам Ubuntu из Windows?

Как получить доступ к файлам Ubuntu (подсистеме Windows) из Windows 10

  1. Шаг 1: Мой компьютер. Перейдите в MyComputer и откройте диск C: Drive, на котором хранятся все ваши файлы Windows и программы.
  2. Шаг 2: Показать скрытые файлы и папки. …
  3. Шаг 3. Получите доступ к файлам подсистемы ubuntu из Windows 10.

Где хранятся файлы Ubuntu?

Большинство приложений хранят свои настройки в скрытые папки внутри вашей домашней папки (информацию о скрытых файлах см. выше). Большинство настроек вашего приложения будут храниться в скрытых папках. config и. local в вашей домашней папке.

Как скопировать файлы из Ubuntu в Windows?

Метод 1: передача файлов между Ubuntu и Windows через SSH

  1. Установите пакет Open SSH в Ubuntu. …
  2. Проверьте статус службы SSH. …
  3. Установите пакет net-tools. …
  4. IP-адрес машины Ubuntu. …
  5. Скопируйте файл из Windows в Ubuntu через SSH. …
  6. Введите свой пароль Ubuntu. …
  7. Проверьте скопированный файл. …
  8. Скопируйте файл из Ubuntu в Windows через SSH.

Как подключить Ubuntu к Windows 10?

Ubuntu можно установить из Microsoft Store:

  1. Используйте меню «Пуск», чтобы запустить приложение Microsoft Store, или щелкните здесь.
  2. Найдите Ubuntu и выберите первый результат «Ubuntu», опубликованный Canonical Group Limited.
  3. Нажмите кнопку «Установить».

Не можете получить доступ к файлам Windows из Ubuntu?

2.1 Перейдите в Панель управления, затем в Параметры электропитания вашей ОС Windows. 2.2 Нажмите «Выбрать, что делают кнопки питания». 2.3 Затем нажмите «Изменить настройки, которые в настоящее время недоступны», чтобы сделать параметр «Быстрый запуск» доступным для настройки. 2.4 Найдите параметр «Включить быстрый запуск (рекомендуется)» и снимите этот флажок.

Могу ли я получить доступ к файлам Linux из Windows?

Ext2Fsd. Ext2Fsd — это драйвер файловой системы Windows для файловых систем Ext2, Ext3 и Ext4. Это позволяет Windows читать файловые системы Linux изначально, обеспечивая доступ к файловой системе через букву диска, к которой может получить доступ любая программа. Вы можете запускать Ext2Fsd при каждой загрузке или открывать его только тогда, когда вам это нужно.

Как скопировать файлы из подсистемы Windows в Ubuntu?

Метод 2 — системный диск Windows в качестве точки монтирования

Сейчас просто используйте команду копирования (cp) для копирования файлов в вашу подсистему Linux.

Где хранится подсистема Windows для Linux?

Он должен находиться в папке в файловой системе Windows, например: ПРОФИЛЬ ПОЛЬЗОВАТЕЛЯ% AppDataLocalPackagesCanonicalGroupLimited... В этом профиле дистрибутива Linux должна быть папка LocalState. Щелкните эту папку правой кнопкой мыши, чтобы отобразить меню параметров.

Как мне получить доступ к диску C в Ubuntu?

в Windows есть / mnt / c / в WSL Ubuntu. в терминале Ubuntu, чтобы перейти в эту папку. Обратите внимание, что первый / перед mnt и помните, что в Ubuntu имена файлов и папок чувствительны к регистру.

Как мне получить доступ к файлу в терминале Ubuntu?

Нажмите Ctrl + Alt + T . Это откроет Терминал. Перейти: означает, что вы должны получить доступ к папке, в которой находится извлеченный файл, через Терминал.

Другой простой способ:

  1. В Терминале введите cd и сделайте пробел infrot.
  2. Затем перетащите папку из файлового браузера в Терминал.
  3. Затем нажмите Enter.

Я установил подсистему Ubuntu в Windows 10 (после включения функции в настройках), но где находится корневой каталог файловой системы Ubuntu, расположенный на диске?

задан
26 October 2017 в 09:23

поделиться

4 ответа

Это, похоже, изменилось с тех пор, как Bash изначально был представлен и не распространяется на дистрибутивы из Windows Store, или, может быть, он несовместим для всех систем, так как мой домашний каталог находится в другом месте:

%localappdata%lxsshome{username}

или:

C:Users{user}AppDataLocallxss{username}

Где {user} — ваше имя пользователя Windows, а {username} — ваше имя пользователя UNIX, установленное во время установки.

Таким образом, корневой каталог будет:

%localappdata%lxss

Обратите внимание, что корневой каталог может не отображаться в проводнике Windows из каталога %localappdata%. Вы должны иметь доступ к нему в любом случае, введя его в «адресной строке» проводника.

ответ дан Louis
23 May 2018 в 12:00

поделиться

Если вы устанавливаете Linux из MS Market:

Бесплатный Ubuntu в магазине Windows Free Open Suse в хранилище Windows

разместил дистрибутивы под:

$ cat /proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Lxss/{861c29b4-ebe2-49a5-8a22-7e53a27934a0}/BasePath
C:UsersuserAppDataLocalPackagesCanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgscLocalState

[d7 ] Установленный по умолчанию дистрибутив:

bash# cat /proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Lxss/DefaultDistribution
{861c29b4-ebe2-49a5-8a22-7e53a27934a0}

Корень Linux глубже:

c:/Users/user/AppData/Local/Packages/46932SUSE.openSUSELeap42.2_022rs5jcyhyac/LocalState/rootfs

PS. Я использовал Cygwin для изучения разделов реестра.

PPS. https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/

ответ дан gavenkoa
23 May 2018 в 12:00

поделиться

Единственное, что сработало для меня, было %localappdata%lxsshome{username}, где {username} — ваше имя пользователя BASH, которое вы дали ему во время установки. По какой-то причине после отображения lxss скрытой папки в C:UsersWINDOWS-USERAppDataLocal отказывается, а также дает полный путь C: к окнам и имя пользователя BASH тоже не работает.

И создайте ярлык на рабочем столе для что работает.

ответ дан thinksinbinary
23 May 2018 в 12:00

поделиться

Вы можете быстро открыть Bash из окна File Explorer открытой папки, набрав bash в строке местоположения.

Достаточно.

Также вы можете добавить контекст пункт меню. Я лично не рекомендую его, если не нужно, потому что добавление ярлыков в контекстное меню использует больше оперативной памяти.

https://www.howtogeek.com/270810/how-to-quickly-launch-a -bash-оболочки из-окон-10s-файл-исследователь /

ответ дан mwfearnley
23 May 2018 в 12:00

поделиться

Другие вопросы по тегам:

Похожие вопросы:

Единственная корневая файловая система находилась здесь до обновления Windows 10 Fall Creators (выпущенного в октябре 2017 года):

%USERPROFILE%AppDataLocalLxssrootfs

Например, C:UsersVigoAppDataLocalLxssrootfs

Другие точки монтирования расположены на один уровень выше в каталоге lxss . Например, ваш собственный home каталог в Linux будет находиться в папке %USERPROFILE%AppDataLocalLxsshome .

Начиная с обновления Fall Creators, можно установить более одного экземпляра Linux и запустить их параллельно. Существующий экземпляр (он же устаревший) останется в своем каталоге, но новые созданные экземпляры находятся в:

%USERPROFILE%AppDataLocalPackages<distribution_specific_name>_<random_string>LocalStaterootfs

Например, моя установка Ubuntu 18.04 находится под

CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc

каталог.

Предупреждение: не создавайте, не изменяйте и не удаляйте файлы, расположенные под конкретным деревом lxss или дистрибутива, из Windows.

Изучение и чтение файлов — единственная безобидная операция. См. Эту страницу блога Microsoft для деталей.

Обратите внимание, что начиная с Build 1903, существует альтернативный способ доступа к файлам работающего дистрибутива, в котором не обнаружены ранее упомянутые проблемы.

Просто используйте путь \wsl$<distribution_specific_name> и вы сможете создавать и изменять файлы. AppData по-прежнему не поддерживается для доступа к файлам в сборке 1903.

For Ubuntu installed from the Windows store:

Each distribution you install through the store is installed to that
application’s appdata directory. For example:
C:Users<username>AppDataLocalPackagesCanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgscLocalState — benhillis

For WSL2 you can access to home directory from windows (Windows 10 build 18342) like this :

\wsl$

In earlier iterations of Windows Subsystem for Linux, the Ubuntu file system was at %localappdata%Lxss (e.g., C:UsersUsernameAppDataLocalLxss — replace the Username with your Username on Windows). See the WSL blog post on File System Support:

The primary file system used by WSL is VolFs. It is used to store the
Linux system files, as well as the content of your Linux home
directory. As such, VolFs supports most features the Linux VFS
provides, including Linux permissions, symbolic links, FIFOs, sockets,
and device files.

VolFs is used to mount the VFS root directory, using
%LocalAppData%lxssrootfs as the backing storage. In addition, a
few additional VolFs mount points exist, most notably /root and
/home which are mounted using %LocalAppData%lxssroot and
%LocalAppData%lxsshome respectively. The reason for these separate
mounts is that when you uninstall WSL, the home directories are not
removed by default, so any personal files stored there will be
preserved.

CAUTION

Creating/modifying any files within the Linux subsystem using Windows apps & tools can cause Data corruption and data loss in Ubuntu subsystem! (Thanks to Rich Turner for suggesting these words of caution!) This is absolutely not supported. From the same blog post:

Interoperability with Windows

While VolFs files are stored in regular files on Windows in the
directories mentioned above, interoperability with Windows is not
supported. If a new file is added to one of these directories from
Windows, it lacks the EAs needed by VolFs, so VolFs doesn’t know what
to do with the file and simply ignores it. Many editors will also
strip the EAs when saving an existing file, again making the file
unusable in WSL.


Your Windows file system is located at /mnt/c in the Bash shell environment.

enter image description here

Source: Dustin Kirkland’s blog, howtogeek

Понравилась статья? Поделить с друзьями:
  • Где хранятся файлы temp windows 10
  • Где хранятся теневые копии windows server 2008 r2
  • Где хранятся файлы skype в windows 10
  • Где хранятся темы для windows 10
  • Где хранятся файлы pst в windows 7