ubuntu usb驱动_如何创建具有永久存储功能的实时Ubuntu USB驱动器

ubuntu usb驱动

ubuntu usb驱动

Ubuntu 18.04's GNOME desktop showing a file browser window.

A Linux live USB drive is normally a blank slate each time you boot it. You can boot it up, install programs, save files, and change settings. But, as soon as you reboot, all your changes are wiped away and you’re back to a fresh system. This can be useful, but if you want a system that picks up where you left off, you can create a live USB with persistent storage.

每次启动时, Linux活动USB驱动器通常都是空白。 您可以启动它,安装程序,保存文件并更改设置。 但是,重新启动后,所有更改都会消失,而您又回到了全新的系统。 这可能很有用,但是如果您想要一个从上次中断的地方接机的系统,则可以创建具有持久性存储的实时USB。

永久存储如何工作 (How Persistent Storage Works)

When you create a USB drive with persistence, you’ll allocate up to 4 GB of the USB drive for a persistent overlay file. Any changes you make to the system—for example, saving a file to your desktop, changing the settings in an application, or installing a program—will be stored in the overlay file. Whenever you boot the USB drive on any computer, your files, settings, and installed programs will be there.

创建具有持久性的USB驱动器时,您将为持久性覆盖文件分配最多4 GB的USB驱动器。 您对系统所做的任何更改(例如,将文件保存到桌面,更改应用程序中的设置或安装程序)都将存储在覆盖文件中。 每当您在任何计算机上启动USB驱动器时,文件,设置和已安装的程序都将存在。

This is an ideal feature if you want to keep a live Linux system on a USB drive and use on different PCs. You won’t have to set up your system up from scratch each time you boot. You don’t need persistence if you’re just using a USB drive to install Ubuntu and then running it from your hard drive afterward.

如果要将活动的Linux系统保留在USB驱动器上并在其他PC上使用,则此功能非常理想。 您无需在每次引导时从头开始设置系统。 如果你只是使用USB驱动器安装Ubuntu,然后从硬盘驱动器运行它之后你不需要持久性。

There are a few limitations. You can’t modify system files, like the kernel. You can’t perform major system upgrades. You also can’t install hardware drivers. However, you can install most applications. You can even update most installed applications, so you can be sure your persistent USB drive has the latest version of the web browser you prefer.

有一些限制。 您不能修改系统文件,例如内核。 您无法执行主要的系统升级。 您也无法安装硬件驱动程序。 但是,您可以安装大多数应用程序。 您甚至可以更新大多数已安装的应用程序,因此可以确保永久性USB驱动器具有您喜欢的最新版本的Web浏览器。

Persistence doesn’t work with every Linux distribution. We’ve tested it with the latest versions of Ubuntu—Ubuntu 18.04 LTS and Ubuntu 19.04—and it works. It should also work with Ubuntu-based Linux distributions. In the past, we had luck with Fedora as well. Just download the appropriate ISO file and follow the instructions below.

持久性不适用于每个Linux发行版。 我们已经使用最新版本的Ubuntu(Ubuntu 18.04 LTS和Ubuntu 19.04)对其进行了测试,并且可以正常工作。 它也应该与基于Ubuntu的Linux发行版一起使用。 过去,我们也对Fedora感到幸运。 只需下载适当的ISO文件,然后按照以下说明进行操作即可。

Update: Rufus, which we recommend for easily creating live USB drives on Windows, now supports persistent storage in its latest versions. Previous versions did not, necessitating the below process. Give Rufus a try if you’re using Windows and want to avoid the Linux command line process below.

更新建议使用 Rufus,以便在Windows上轻松创建活动USB驱动器现在支持最新版本的持久存储 。 以前的版本没有,因此需要以下过程。 如果您使用Windows,并且想避免下面的Linux命令行过程,请尝试Rufus。

如何在Ubuntu上制作持久的Ubuntu USB驱动器 (How to Make a Persistent Ubuntu USB Drive on Ubuntu)

You’ll need a computer already running Ubuntu to perform this process. You’ll also need a USB drive with enough storage capacity to set up persistence. We used a 16 GB drive, but an 8 GB drive would have worked as well. The bigger the drive, the more persistent storage you can have.

您需要一台已经在运行Ubuntu的计算机来执行此过程。 您还需要具有足够存储容量的USB驱动器来设置持久性。 我们使用了16 GB的驱动器,但也可以使用8 GB的驱动器。 驱动器越大,您可以拥有的持久性存储越多。

The grub, boot and Ubuntu partitions take up less than 2 GB. The remainder of the space on the USB drive will be used for the casper-rw and the usbdata partitions.

grub,boot和Ubuntu分区占用的空间不到2 GB。 USB驱动器上的剩余空间将用于casper-rwusbdata分区。

The casper-rw partition is used for persistent storage. For example, software you install and settings files will be stored here.

casper-rw分区用于持久存储。 例如,您安装的软件和设置文件将存储在这里。

The usbdata partition will be formatted with the NTFS file system. It will be accessible to Linux, Windows, and macOS. This partition is also available from within the live Ubuntu on the USB drive. This means any files copied to the usbdata partition from another computer will be accessible to your live Ubuntu.

usbdata分区将使用NTFS文件系统格式化。 Linux,Windows和macOS均可访问它。 该分区也可以从USB驱动器上的实时Ubuntu中获得。 这意味着您的实时Ubuntu可以访问从另一台计算机复制到usbdata分区的所有文件。

In other words, the usbdata partition acts as a “shared folder” between your live Ubuntu and any other computer you plug your USB drive into. That’s pretty cool.

换句话说, usbdata分区充当活动Ubuntu和您插入USB驱动器的任何其他计算机之间的“共享文件夹”。 太酷了。

The below screenshot shows how the resulting partitions looked on our 16 GB drive.

下面的屏幕截图显示了结果分区在我们16 GB驱动器上的外观。

partition table on USB drive

Although a 16 GB USB drive was used for researching this article, an 8 GB drive would work just as well. It would simply have less storage.

尽管本文使用了16 GB的USB驱动器,但8 GB的驱动器也可以正常工作。 它只会拥有更少的存储空间。

First, you’ll have to download the Ubuntu ISO file you want to place on the USB drive.

首先,您必须下载要放在USB驱动器上的Ubuntu ISO文件

Note: If you’re creating a live USB drive from a live disk, ensure Ubuntu’s Universe repository is enabled before you continue. You can do that by running the following command:

注意 :如果要从活动磁盘创建活动USB驱动器,请在继续之前确保已启用Ubuntu的Universe存储库。 您可以通过运行以下命令来做到这一点:

sudo add-apt-repository universe

Second, the tool you’re going to use is called mkusb. It is not part of the standard Ubuntu installation. You will need to install it. To do so, enter the following three commands. The first command adds the mkusb repository so that Ubuntu knows where to install mkusb from.

其次,您将要使用的工具称为mkusb 。 它不是标准Ubuntu安装的一部分。 您将需要安装它。 为此,请输入以下三个命令。 第一个命令添加了mkusb存储库,以便Ubuntu知道从哪里安装mkusb

sudo add-apt-repository ppa:mkusb/ppa
adding repository in a terminal window

The next command forces Ubuntu to refresh its package lists for the registered repositories.

下一条命令将强制Ubuntu刷新其已注册存储库的软件包列表。

sudo apt-get update
sudo apt-get update in a terminal window

We can now proceed to install the mkusb package, with this command:

现在,我们可以使用以下命令继续安装mkusb软件包:

sudo apt install --install-recommends mkusb mkusb-nox usb-pack-efi
installing mkusb in a terminal window

The mkusb program does a terrific job of identifying USB drives. That’s great, but there’s nothing like knowing for yourself. When mkusb tells you it is going to completely wipe a particular drive, you can be sure it’s the USB drive you are planning on using and not another device on your system.

mkusb程序在识别USB驱动器方面做得非常出色。 太好了,但是没有什么比对自己了解要了解的了。 当mkusb告诉您将要完全擦除特定驱动器时,可以确定它是您计划使用的USB驱动器,而不是系统上的其他设备。

In a terminal window, type the following command. The lsblk command lists the block devices on your computer. Each drive has a block device associated with it.

在终端窗口中,键入以下命令。 lsblk命令列出了计算机上的块设备 。 每个驱动器都有一个与之关联的块设备。

lsblk
lsblk in a terminal window

The output from lsblk will show the drives currently connected to your computer. There is one internal hard drive on this machine called sda and there is one partition on it called sda1.

lsblk的输出将显示当前连接到计算机的驱动器。 这台计算机上有一个内部硬盘驱动器,称为sda ,在其上有一个分区,名为sda1

lsblk in a terminal window

Plug in your USB drive and use the lsblk command once more. The output from lsblk will have changed. The USB drive will now be listed in the output.

插入USB驱动器,然后再次使用lsblk命令。 lsblk的输出将更改。 现在将在输出中列出USB驱动器。

lsblk output with USB drive in a terminal window

There is a new entry called sdb in the list. It has one partition called sdb1. That’s the USB drive.

列表中有一个名为sdb的新条目。 它具有一个名为sdb1分区。 那就是USB驱动器。

If you have more than one drive in your computer already, the name of your USB drive will be different. Regardless of how it is named, the device that was not in the previous lsblk listing must be the USB drive.

如果您的计算机中已经有多个驱动器,则USB驱动器的名称将不同。 无论如何命名, 不在前面的lsblk清单中的设备都必须是USB驱动器。

Once you know which device your USB drive is, you can launch mkusb. Press the Super (Windows) key and type “mkusb”. The mkusb icon will appear. Click the icon or press Enter.

知道USB驱动器是哪台设备后,即可启动mkusb 。 按超级(Windows)键并键入“ mkusb”。 此时将显示mkusb图标。 单击图标或按Enter。

the mkusb icon

A dialog will ask you whether you wish to run the dus (Do USB Stuff) version of mkusb. Click the “Yes” button.

对话框将询问您是否要运行mkusb的dus(执行USB Stuff)版本。 点击“是”按钮。

run mkusb as dus

A terminal window with a black background will appear and a dialog box will prompt you for your password. Enter your password and click the “OK” button.

将显示一个黑色背景的终端窗口,并出现一个对话框提示您输入密码。 输入密码,然后单击“确定”按钮。

dialog prompting for password

Warning: This process will wipe the contents of the USB drive!

警告 :此过程将擦除USB驱动器的内容!

Click “OK” in the warning dialog to acknowledge you understand this.

在警告对话框中单击“确定”以确认您理解这一点。

dialog warning of wiping of device

Click the “Install (make a boot device)” entry in the list and click the “OK” button.

单击列表中的“安装(制造启动设备)”条目,然后单击“确定”按钮。

Install (make a boot device) option

Select the “‘Persistent live’ – only Debian and Ubuntu” entry in the list and click the “OK” button.

在列表中选择“'Persistent live'–仅Debian和Ubuntu”条目,然后单击“确定”按钮。

Ubuntu and Debian only option

A file browser dialog will appear. Browse to the Ubuntu ISO file you downloaded, select it, and click the green “OK” button.

出现文件浏览器对话框。 浏览到您下载的Ubuntu ISO文件,选择它,然后单击绿色的“确定”按钮。

In the screenshot below, we’re selecting the Ubuntu 19.04 ISO image from the Downloads folder.

在下面的屏幕快照中,我们从“下载”文件夹中选择Ubuntu 19.04 ISO映像。

file section window

You’ll see a list of the USB drives connected to your computer. This allows you to select the appropriate USB drive.

您会看到连接到计算机的USB驱动器的列表。 这使您可以选择适当的USB驱动器。

There was only one USB drive connected to the test machine used for this article. As we confirmed above, it is called sdb. We’ve confirmed that’s the USB drive we want to use so we can proceed with confidence. Click the “OK” button.

本文使用的测试机上只有一个USB驱动器。 正如我们在上面确认的那样,它称为sdb 。 我们已经确认这是我们要使用的USB驱动器,因此我们可以放心进行。 点击“确定”按钮。

USB drive confirmation dialog

When the dialog shown below appears, select the “usb-pack-efi (default grub from ISO file)” entry in the list and click the “OK” button.

当出现如下所示的对话框时,在列表中选择“ usb-pack-efi(ISO文件中的默认grub)”条目,然后单击“确定”按钮。

usb-pack-efi option

You have one more option to choose. You can select what percentage of the storage space is for persistent storage in the casper-rw partition. The remainder will be used for the usbdata partition, which has the NTFS file system and can also be accessed from Windows PCs and Macs.

您还有一个选择。 您可以选择casper-rw分区中用于永久存储的存储空间百分比。 其余部分将用于usbdata分区,该分区具有NTFS文件系统,也可以从Windows PC和Mac访问。

If you’re happy to have the available space on the USB drive shared equally between these two partitions, leave the slider at its default value and click the “OK” button.

如果您很高兴在这两个分区之间平均共享USB驱动器上的可用空间,请将滑块保持其默认值,然后单击“确定”按钮。

persistent storage slider

Now, we just have to tell mkusb that we’re happy with all of our choices and that it should proceed.

现在,我们只需要告诉mkusb我们对所有选择感到满意,并且应该继续进行下去。

To be clear, this is the last point at which you can back out. If you’re certain you wish to proceed, select the “Go” radio button and click the “Go” button.

需要明确的是,这是您可以退出的最后一点。 如果确定要继续,请选择“转到”单选按钮,然后单击“转到”按钮。

mkusb final safety check

A progress bar shows you how close the creation process is to completion.

进度条显示创建过程离完成有多近。

progress bar

The final stage of the creation is to flush the file system buffers to the USB drive. You are also advised to wait until you see the phrase “Work done”. That will indicate the process has completed.

创建的最后阶段是将文件系统缓冲区刷新到USB驱动器。 还建议您等到看到“工作已完成”。 这将表明该过程已完成。

progress bar final stages

When the process has completed you will see a dialog with the phrase “Work done” highlighted in green. Click the “OK” button. If any other dialogs appear, close them by clicking on the “Quit” button.

该过程完成后,您将看到一个对话框,其中的短语“工作已完成”以绿色突出显示。 点击“确定”按钮。 如果出现其他对话框,请单击“退出”按钮将其关闭。

work done dialog

A few more lines of output will scroll through the terminal window. You will be prompted to press “Enter” when you are ready.

几行输出将在终端窗口中滚动。 准备就绪时,系统将提示您按“ Enter”。

press enter to continue

When you press “Enter,” the terminal window will close. You can now either reboot your computer and boot from the USB drive or unplug the USB drive, take it to another computer, and boot it there.

当您按“ Enter”时,终端窗口将关闭。 现在,您可以重新启动计算机并从USB驱动器启动,也可以拔下USB驱动器,将其带到另一台计算机上,然后从那里启动。

如何在Windows上制作持久的Ubuntu USB驱动器 (How to Make a Persistent Ubuntu USB Drive on Windows)

Update: We’ve been told the below method (using Linux Live USB Creator) no longer works with the latest versions of Ubuntu. You’ll need to use the above method instead.

更新 :我们被告知以下方法(使用Linux Live USB Creator)不再适用于最新版本的Ubuntu。 您需要改用上述方法。

You’ll need a large enough USB drive to set up persistence. Ubuntu itself claims it needs 2 GB of storage on the USB drive, and you’ll also need extra space for the persistent storage. So, if you have a 4 GB USB drive, you can only have 2 GB of persistent storage. To have the maximum amount of persistent storage, you’ll need a USB drive of at least 6 GB in size.

您将需要足够大的USB驱动器来设置持久性。 Ubuntu本身声称它在USB驱动器上需要2 GB的存储,并且您还需要额外的空间来存储持久性存储。 因此,如果您有4 GB的USB驱动器,则只能有2 GB的永久存储。 为了获得最大的永久存储量,您将需要至少6 GB的USB驱动器。

Unfortunately, the Rufus tool that Ubuntu officially recommends for creating live Ubuntu USB drives on Windows doesn’t offer support for creating systems with persistent storage. While we recommend using Rufus to create most Ubuntu live USB drives, we’ll have to use a different tool for this particular job. (Update: The latest versions of Rufus now support persistent storage!)

不幸的是,Ubuntu官方推荐的在Windows上创建实时Ubuntu USB驱动器的Rufus工具不支持创建具有持久性存储的系统。 虽然我们建议使用Rufus来创建大多数Ubuntu live USB驱动器,但对于该特定工作,我们将不得不使用其他工具。 ( 更新 :Rufus的最新版本现在支持持久存储!)

Download the Ubuntu ISO file you want to place on the USB drive and the Linux Live USB Creator application.

下载要放置在USB驱动器和Linux Live USB Creator应用程序上的Ubuntu ISO文件

Insert the USB drive you want to use into your computer’s USB port and launch the “LiLi USB Creator” application you just installed.

将要使用的USB驱动器插入计算机的USB端口,然后启动刚刚安装的“ LiLi USB Creator”应用程序。

Select the USB drive you want to use in the “Step 1: Choose Your Key” box.

在“步骤1:选择密钥”框中选择要使用的USB驱动器。

Option to choose USB drive in Linux Live USB Creator

Provide your downloaded Ubuntu ISO file. Click the “ISO / IMG / ZIP” button under “Step 2: Choose a Source”, browse to the .ISO file on your computer, and double-click it.

提供下载的Ubuntu ISO文件。 单击“步骤2:选择源”下的“ ISO / IMG / ZIP”按钮,浏览到计算机上的.ISO文件,然后双击它。

Choosing an ISO file in Linux Live USB Creator

Use the options in the “Step 3: Persistence” section to select how much space you want to use for persistent storage on the USB drive. Drag the slider all the way to the right to select the maximum amount of storage.

使用“第3步:持久性”部分中的选项来选择要用于USB驱动器上的持久性存储空间的空间。 一直向右拖动滑块以选择最大存储量。

Assigning persistent storage in Linux Live USB Creator

You’ve now configured all the settings you need to configure. To create your live USB drive with persistent storage, click the lightning icon under “Step 5: Create”.

现在,您已经配置了所有需要配置的设置。 要创建具有持久性存储的实时USB驱动器,请单击“第5步:创建”下的闪电图标。

Creating a file for persistence progress in LiLi USB Creator

Give the tool some time to create the drive. When the process is done, you’ll see a “Your LinuxLive key is now up and ready!” message. You can now either reboot your computer and boot from the USB drive or unplug the USB drive, take it to another computer, and boot it there.

给该工具一些时间来创建驱动器。 该过程完成后,您将看到“您的LinuxLive密钥现在已准备就绪!” 信息。 现在,您可以重新启动计算机并从USB驱动器启动,也可以拔下USB驱动器,将其带到另一台计算机上,然后从那里启动。

Linux live USB creation complete in LiLi

To confirm that persistent storage is working properly, boot the USB drive and create a folder on the desktop, or save a file to the desktop. Then, shut down your system and boot the live USB drive again. You should see the folder or file you placed on the desktop.

要确认持久性存储正常工作,请启动USB驱动器并在桌面上创建一个文件夹,或将文件保存到桌面。 然后,关闭系​​统,然后重新启动活动的USB驱动器。 您应该看到放置在桌面上的文件夹或文件。

翻译自: https://www.howtogeek.com/howto/14912/create-a-persistent-bootable-ubuntu-usb-flash-drive/

ubuntu usb驱动

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值