Running linux from disk

Install Ubuntu from ISO image directly from hard disk of a system running Linux? [duplicate]

I don’t want to burn a CD, DVD or USB memory stick. And I don’t care about saving the existing operating system (Linux Mint). I want to install Ubuntu (actually Kubuntu 12.04 LTS) to the computer directly from the ISO image. The image is for the Kubuntu Live DVD (3.5 GB). The computer is now booted into Linux Mint. A set of command line steps would be satisfactory. In my mind, I simply need to trick the existing system into thinking I inserted a CD/DVD, right? I know there is a similar question already but it does not have a good answer. The answer basically says, «see this link.» I reviewed the link and I decided that StackExchange needs a good answer to this question. Furthermore, most answers at other places on the Internet assume the user is coming to Ubuntu from Windows. So I think this question is one that needs a good answer here. Thanks

@fossfreedom — did you read the answer to that question? It isn’t really an answer — at least it does not strike me as an answer worthy of StackExchange. Surely there is a better answer out there.

2 Answers 2

I found this looking around on the net.

Grub2 is capable of directly booting ISO images for many Linux distros if the entries have been properly defined in the Grub2 configuration files.

The ISO image must be placed on a separate partition that does not have an operating system installed on it. For the sake of simplicity, we would place it inside a new directory under /boot (assuming it is on a separate partition).

    Create the new directory and copy your ISO image:

sudo mkdir /boot/iso sudo cp ~/Desktop/name.iso /boot/iso 
gksudo gedit /etc/grub.d/40_custom 
#!/bin/sh echo "Adding 40_custom." >&2 exec tail -n +4 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "Kubuntu ISO" < set isofile="/boot/iso/kubuntu-12.04.iso" loopback loop (hd0,8)$isofile linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject initrd (loop)/casper/initrd.lz >
  • Kubuntu ISO = The name you want to display in the Grub menu.
  • boot/iso/kubuntu-12.04.iso = The location and name of your ISO image.
  • (hd0,8) = The partition which contains the ISO image.
  • note: the tail -n +4 means simply «which line grub starts to read the configuration from as is». the 4th line in this example is the first comment line, which is fine.

Grub reads the partitions in a different way than Ubuntu does. ‘hd0’ means first HDD which is read as sda by Ubuntu, and 8 is the partition which is the same as for Ubuntu. So in other words, (hd0,8) means ‘sda8’.

To find out your partition, run this command in a Terminal:

Читайте также:  Удалить страницу pdf linux

Suppose your image is contained in the sda1 partition, you’d change (hd0,8) in the above line to (hd0,1) and if the image is in the sdb1 partition, you’d change (hd0,8) to (hd1,1) .

That’s all. Now you can double-click the ‘Install’ icon at the desktop and proceed with the installation.

Источник

How to Run Any Linux Distribution Directly from Hard Disk in Ubuntu Using Grub Menu

Most of Linux distributions provide ISO files that are designed and built to run in Live Mode directly from a bootable media such as CD /DVD, Flash/USB cards or even directly from a Hard Drive using Linux Grub menu without the need to burn it to a CD/DVD or create a bootable USB.

Run Linux From Hard Disk

This tutorial will concentrate on presenting a way you can run some Linux ISO distributions directly from your hard disk by editing Ubuntu 20.04 GRUB2 (works on Ubuntu 18.04 or earlier) menu which is the default boot loader in most modern Linux distributions, which provides a faster way of using a Linux Operating System, and also has a great impact on privacy because all your settings and live sessions are not preserved by default.

The distributions presented in this topic are CentOS, Fedora, Kali Linux and Gentoo Live DVD.

Requirements

Ubuntu 20.04 ( or any other Linux distributions with GRUB2 boot loader) installed on your system hard drive.

Step 1: Download Linux Live ISO Files

1. To able boot and run any Linux distribution without installing them to your hard drive, make sure to download the “Live CD/DVD” release of each Linux ISO image.

Step 2: Add ISO Images to GRUB2 Menu

2. After you have downloaded your favorite Linux ISO Live DVD Images, open Ubuntu Nautilus with root privileges using ‘sudo nautilus‘ command from Terminal and create a directory called live in your system root path and move ISO file to this folder.

Create Directory in Ubuntu Root Location Copy Linux ISO Files to Live Directory

3. To continue further will need to provide Grub2 with our disk partition UUIDUniversally Unique Identifier (the partition where ISO files are located). To get partition UUID run the following blkid command.

For automatically mounted partition or hard disks on system boot run following cat command.

Get Partition UUID

4. Another method to get your partition UUID is, to open visualize grub.cfg file content located in /boot/grub/ path and search for —fs-uuid a string (in case you don’t have a separated partition for /boot).

Find Partition UUID

5. After you obtained your root partition UUID code move to /etc/grub.d/ directory, open 40_custom file for editing and add the following lines at the bottom of this file.

menuentry 'CentOS 8 Live' --class os --class gnu-linux --class gnu --class os --group group_main < set isofile insmod ext2 insmod loopback insmod iso9660 loopback loop (hd0,msdos1)$isofile search --no-floppy --fs-uuid --set=root 3b87d941-8ee7-4312-98fc-1f26828d62ab linux (loop)/isolinux/vmlinuz boot=live fromiso=/dev/sda1/$isofile noconfig=sudo username=root hostname=centos initrd (loop)/isolinux/initrd.img >

Add CentOS Boot Kernel Parameters

Here the following directives represents:

  1. set isofile = A variable the holds ISO system path location.
  2. (hd0,msdos1) = First partition from first hard disk (In Linux disks are numbered starting with 0) – the same as /dev/sda1.
  3. –fs-uuid –set=root 59036d99-a9bd-4cfb-80ab-93a8d3a92e77 = First partition from first hard disk UUID code.
  4. linux and initrd = Custom kernel booting parameters – they are different depending on every Linux distribution.

6. After you finish editing the file, update-grub to add the new ISO (in this case CentOS) to your Grub2 menu. To verify it open /boot/grub/grub.cfg and search at the bottom for your ISO entry.

Читайте также:  Mac панель linux mint

Update Grub to Add ISO Images Verify Grub Entry

7. To run CentOS Live ISO, reboot your computer, select CentOS entry from GRUB menu then press Enter key.

Select CentOS from Boot Menu CentOS 8 Booting

In the same way, you can add the other Linux Live ISO distribution images to the GRUB2 menu as shown. Again open and edit /etc/grub.d/40_custom grub file and add the following entries.

For Fedora Live DVD

menuentry 'Fedora Live' --class os --class gnu-linux --class gnu --class os --group group_main < set isofile insmod ext2 insmod loopback insmod iso9660 loopback loop (hd0,msdos1)$isofile search --no-floppy --fs-uuid --set=root 3b87d941-8ee7-4312-98fc-1f26828d62ab linux (loop)/isolinux/vmlinuz boot=live fromiso=/dev/sda1/$isofile noconfig=sudo username=root hostname=fedora initrd (loop)/isolinux/initrd.img >

For Kali Linux Live DVD

menuentry 'Kali Linux Live' --class os --class gnu-linux --class gnu --class os --group group_main < set isofile insmod ext2 insmod loopback insmod iso9660 loopback loop (hd0,msdos1)$isofile search --no-floppy --fs-uuid --set=root 3b87d941-8ee7-4312-98fc-1f26828d62ab linux (loop)/live/vmlinuz boot=live fromiso=/dev/sda1/$isofile noconfig=sudo username=root hostname=kalilinux initrd (loop)/live/initrd.img >

For Gentoo Live DVD

menuentry 'Gentoo Linux Live' --class os --class gnu-linux --class gnu --class os --group group_main < set isofile insmod ext2 insmod loopback insmod iso9660 loopback loop (hd0,msdos1)$isofile search --no-floppy --fs-uuid --set=root 3b87d941-8ee7-4312-98fc-1f26828d62ab linux (loop)/live/vmlinuz boot=live fromiso=/dev/sda1/$isofile noconfig=sudo username=root hostname=gentoo initrd (loop)/live/initrd.img >

8. Then update your GRUB menu again, reboot your computer and choose your preferred Linux distribution ISO from the GRUB menu.

9. If you don’t have enough free space on your root partition, to host other Linux ISO files you can add another hard disk and move all your Linux distribution ISO files there. After you create a partition and add a file system mount it on /mnt path to make it available.

10. Then move all ISO on the new hard disk and grab its UUID using blkid command.

Move ISO Images and Verify UUID Verify All ISO Images

11. Again open and edit /etc/grub.d/40_custom grub file and add other Linux Live ISO distribution images to GRUB2 menu using the same procedure but pay attention to every distribution Live Kernel booting parameters which can be inspected by mounting the ISO image using mount -o loop option or consult distribution Wiki pages.

Источник

How do I boot from ISO file stored on hard disk?

I know that I can create/burn bootable CD/DVD or live USB and can boot/install from it. But suppose I am currently running GNU/Linux and I’ve ISO file of another GNU/Linux that I want to install on my hard disk, then Can I directly boot from ISO from hard disk and try/install that GNU/Linux operating system?

1 Answer 1

Yes, you can accomplish this by adding a menu entry to the GRUB boot loader menu.

You can add a custom GRUB menu entry by editing /etc/grub.d/40_custom ,

Example of custom menuentry:

 exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "Trisquel ISO" < set isofile="/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso" loopback loop (hd0,5)$isofile linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash initrd (loop)/casper/initrd >

Instruction & Explanation:

  1. The command set is used for storing the path of the ISO file into a variable, here isofile .
  2. loopback is used to make a device from a file system image. In order to do that, it is necessary to specify the device and image file. Here we used (hd0,5)$isofile in which (hd0,5) represents the fifth partition of the disk.
  3. Points to note: In (hd0,5) ,
    1 st digit represents the device number which starts from 0 (here : 0 = 1 st device) and
    2 nd digit represents the partition number which starts from 1 (here 5 = 5 th partition).
    That means /dev/sda5
  4. And variable $isofile has the path of the ISO file. So, finally it becomes (hd0,5)/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso .
  5. For more information, visit : How to specify devices and files.
 $ 7z l trisquel_7.0_i686.iso | grep vmlinu 2014-10-29 21:41:43 . 5841680 5841680 casper/vmlinuz 2014-11-03 00:45:09 . 5844176 5844176 casper/vmlinuz.netinst 
$ 7z l trisquel_7.0_i686.iso | grep initrd 2014-11-03 00:45:19 . 16851900 16851900 casper/initrd 2014-11-03 00:45:09 . 9398592 9398592 casper/initrd.netinst 

After editing /etc/grub.d/40_custom , GRUB needs to be updated by update-grub2 command. Upon rebooting, you will find the custom menuentry you’ve added on the GRUB screen. And you may use the Live environment of a GNU/Linux distribution.

In order to perform installation from ISO, installer may need to unmount any mounted partitions; i.e. say another system is mounted at /isodevice , then you can umount -l /isodevice .

Источник

Can you install Ubuntu from the hard disk?

Yes. Ubuntu can be installed from hard disk without using any secondary media like CD or USB.

You can read the full tutorial here.

Grub4Dos bootloader is used to boot from the Ubuntu iso on the hard disk.After booting, the isodevice is unmounted by running some commands in the terminal.Then you can install Ubuntu the normal way.

There is a way for Windows Vista / 7 users. Download the Ubuntu iso file you want to install, and use EasyBCD. Open EasyBCD and click «Add New Entry» from the left side. Then on the bottom, select «ISO Boot» and then find the ISO file you want to boot from. Then give it a name, click «Add Entry,» and then Restart. There should be an option (when you boot) to boot from the entry you just made.

I tried this and got the infamous «unable to find a medium containing a live file system» message. The only solutions I found online were talking about changing to USB2.0 plug. Did this happen to you too?

Here is an Ubuntu help page on installing Ubuntu from another Linux partition. Essentially you just get the installer’s .iso image, extract it onto a new partition, then boot from it to start the installer. EDIT: This method gave me installer errors about partitioning because I had a USB drive plugged in that I wasn’t using. I didn’t want to use the USB drive for the installer because I didn’t want to delete its existing contents. After removing the USB drive this method worked fine.

If you don’t have another Linux partition, here is an Ubuntu help page on other ways to install

Actually, I installed Ubuntu on 2 computers via Wubi and almost no problems. The only problem is that it doesn’t detect the other partitions from Ubuntu because of the way it is installed(in a file allocated on the hard drive) which is pretty bad.

Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.

Источник

Оцените статью
Adblock
detector