Где найти 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

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

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

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

Примечание. В бета-версиях WSL вашими «файлами Linux» являются любые файлы и папки. в% localappdata% lxss — где на вашем диске хранится файловая система Linux — дистрибутив и ваши собственные файлы.

Где находится каталог Linux в Windows?

Во-первых, легкий. Изнутри подсистемы Windows для среды Linux, которую вы хотите просмотреть, запустите следующее команда: explorer.exe . Это запустит проводник, показывающий текущий каталог Linux — вы можете просматривать файловую систему среды Linux оттуда.

Где находится корневой каталог Ubuntu?

Чтобы перейти в корневой каталог, используйте «CD /» Для перехода в домашний каталог используйте «cd» или «cd ~». Для перехода на один уровень вверх по каталогу используйте «cd ..». Для перехода к предыдущему каталогу (или назад) используйте «cd -»

Совместное использование файлов в Ubuntu 16.04 LTS с системами Windows 10

  1. Шаг 1. Найдите имя рабочей группы Windows. …
  2. Шаг 2: Добавьте IP-адрес машины Ubuntu в файл локального хоста Windows. …
  3. ШАГ 3: ВКЛЮЧИТЕ ОБМЕН ФАЙЛОВ WINDOWS. …
  4. Шаг 4: Установите Samba в Ubuntu 16.10. …
  5. Шаг 5: Настройте общий ресурс Samba Public. …
  6. Шаг 6: Создайте общую папку для совместного использования.

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

Доступ к файлам Linux при запуске WSL Distro в проводнике

  1. Откройте проводник (Win + E).
  2. Щелкните / коснитесь Linux в панели навигации проводника, а затем щелкните / коснитесь ярлыка Distros. (…
  3. Щелкните / коснитесь запущенного дистрибутива WSL (например, «Ubuntu»), файлы для которого вы хотите просмотреть. (…
  4. Щелкните / коснитесь домашней папки. (

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

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

Как подсистема Linux работает в Windows?

WSL предоставляет слой для сопоставления системных вызовов ядра Windows с системными вызовами ядра Linux. Это позволяет исполняемым файлам Linux работать в Windows без изменений. WSL также отображает службы Windows, такие как файловая система и сеть, как устройства, к которым Linux может получить доступ. … Это означает, что для запуска WSL требуется минимальный объем оперативной памяти.

Как мне удаленно войти в Ubuntu из Windows?

Следуй этим шагам :

  1. Шаг 1 — Установите xRDP.
  2. Шаг 2 — Установите XFCE4 (Unity, похоже, не поддерживает xRDP в Ubuntu 14.04; хотя в Ubuntu 12.04 он поддерживался). Вот почему мы устанавливаем Xfce4.
  3. Шаг 3 — Настройте xRDP.
  4. Шаг 4 — Перезапустите xRDP.
  5. Тестирование вашего xRDP-соединения.
  6. (примечание: это заглавная буква «i»)
  7. Готово, наслаждайтесь.

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

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

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

Как просмотреть файлы в Linux Windows 10?

Будет доступен новый значок Linux. в левой навигационной панели в проводнике, предоставляя доступ к корневой файловой системе для любых дистрибутивов, установленных в Windows 10. Значок, который появится в проводнике, — это знаменитый Тукс, талисман-пингвин для ядра Linux.

Как мне получить root права в Linux?

Переключение на пользователя root на моем сервере Linux

  1. Разрешите доступ root / admin для вашего сервера.
  2. Подключитесь через SSH к вашему серверу и выполните эту команду: sudo su —
  3. Введите пароль вашего сервера. Теперь у вас должен быть root-доступ.

Как мне показать все каталоги в Ubuntu?

Команда «ls» отображает список всех каталогов, папок и файлов, имеющихся в текущем каталоге.

Как мне перемещать файлы в Ubuntu?

Щелкните правой кнопкой мыши и выберите «Вырезать» или нажмите Ctrl + X . Перейдите в другую папку, в которую вы хотите переместить файл. Нажмите кнопку меню на панели инструментов и выберите «Вставить», чтобы завершить перемещение файла, или нажмите Ctrl + V. Файл будет извлечен из исходной папки и перемещен в другую папку.

Windows 10 версии 1903 содержит ряд интересных изменений и улучшений, внесенных в функцию WSL. К ним относятся дополнительные дистрибутивы в Магазине, возможность просматривать файлы WSL в Проводнике и многое другое.

Возможность запуска Linux в Windows 10 обеспечивается функцией WSL. WSL это — Windows Subsystem for Linux, которая изначально была ограничена только Ubuntu. Современные версии WSL позволяют устанавливать и запускать несколько дистрибутивов Linux из Microsoft Store.

После включения WSL вы можете устанавливать различные версии Linux из Магазина, используя следующие ссылки:

Ссылки на дистрибутивы в магазине microsoft:

  Ubuntu  | openSUSE Leap  | SUSE Linux Enterprise Server | Debain GNU / Linux | Kali Linux

В Windows 10 версии 1903 вы можете легко получить доступ ко всем файлам в ваших дистрибутивах Linux с помощью проводника Windows. На момент написания статьи эта функция реализована в сборке Windows 10 18836. Она находится на пути к ветви 19h1, поэтому мы увидим ее в следующей сборке. Вот как это можно сделать.

Чтобы получить доступ к файлам WSL Linux из проводника Windows 10 , выполните следующие действия.

Шаг 1: Включить функцию WSL (Подситема Windows для Linux)

Шаг 2: Установите какой-нибудь дистрибутив, например Ubuntu, и запустите его.

Подробнее в нашей статье: Руководство по установке и запуску — Ubuntu Bash в Windows 10.

Шаг 3: Находясь в каталоге Linux FS, введите^

explorer.exe .

Откроется окно проводника, расположенное внутри вашего дистрибутива Linux.

Доступ к файлам Linux в Windows 10

Теперь вы можете получить доступ к любым файлам Linux, так же, как и к любому другому файлу через проводник. Это включает в себя такие операции, как: перетаскивание файлов в другие места, копирование и вставка и даже использование пользовательских записей контекстного меню, добавленных Notepad ++, VSCode или другим программным обеспечением.

Проводник показывает файлы дистрибутива как виртуальный сетевой ресурс по пути \ wsl $ <running_distro_name> .

Команда WSL активно исследует способы улучшения обнаруживаемости файлов Linux внутри Проводника. Ход их работы уже можно увидеть в Windows 10 Build 18836, которая показывает файловую систему WSL / Linux в File Explorer.

Доступ к файлам Linux в командной строке

В дополнение к Проводнику вы можете использовать классическую командную строку и инструменты PowerShell для доступа к файлам Linux. Точно так же вам нужно перейти к \wsl${имя дистрибутива}, где {имя дистрибутива} — это имя работающего дистрибутива.

WSL в PowerShell

Известные вопросы

Это новая функция, и некоторые ее части могут не работать идеально. Вот некоторые известные проблемы, о которых мы хотим сообщить вам при использовании этой функции:

На данный момент файлы дистрибутивов будут доступны только из Windows, когда дистрибутив работает. Разработчик собирается добавить поддержку не работающих дистрибутивов в будущем обновлении.

Поскольку файловый сервер 9P работает внутри каждого дистрибутива, он доступен только тогда, когда этот дистрибутив работает. Команда ищет способы решить эту проблему.

Доступ к файлам Linux рассматривается так же, как и доступ к сетевому ресурсу, и все правила доступа к сетевым ресурсам будут по-прежнему применяться,

  • Например: при использовании CMD cd \wsl$Ubuntuhome не будет работать (поскольку CMD не поддерживает пути UNC, так как текущие каталоги), однако будет работать copy \wsl$Ubuntuhomesomefile.txt C:dev
  • Старые правила по-прежнему применяются, вы не должны получать доступ к файлам Linux внутри папки AppData!
  • Если вы пытаетесь получить доступ к своим файлам Linux через папку AppData, вы используете обход сервера 9P, что означает, что у вас не будет доступа к файлам Linux, и вы можете повредить ваш дистрибутив Linux.

Примечание: Сервер 9P — это сервер, который содержит протоколы, поддерживающие метаданные Linux, включая разрешения. Демон инициализации WSL теперь включает сервер 9P. Существует служба Windows и драйвер, который действует как клиент и взаимодействует с сервером 9P (который работает внутри экземпляра WSL). Клиент и сервер обмениваются данными через сокеты AF_UNIX, поскольку WSL позволяет взаимодействовать между приложением Windows и приложением Linux, используя AF_UNIX.

Понравилась статья? Поделить с друзьями:
  • Где найти active directory в windows 10
  • Где найти access на компьютере на windows 10
  • Где на установочном диске windows находятся драйвера
  • Где на ноутбуке посмотреть характеристики ноутбука на windows 10
  • Где на ноутбуке посмотреть характеристики видеокарты на windows 10