LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-01-2012, 01:15 PM   #1
jbruyet
Member
 
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178

Rep: Reputation: 7
Take working Linux install and create a bootable USB?


Hey all, I would like to take my workstation (with all installed programs) and use it to create a bootable USB drive. I can find tons of ways to make bootable USB drives but only with existing ISO images. Is there a way to do what I want to do or am I going to have to do temp installs every time I boot to my USB drive?

Thanks,

Joe B
 
Old 08-01-2012, 02:28 PM   #2
zwitterion-241920
Member
 
Registered: Nov 2011
Location: AccountKiller
Distribution: AccountKiller
Posts: 89

Rep: Reputation: 39
kinda like installing Archlinux

If your disk is as large or smaller than your usb, you could try unmounting the usb and then use
Code:
$ sudo dd if=/dev/sda of=/dev/sdb count=1
and then mounting the / partition on the usb to /mnt with
Code:
$ sudo mount /dev/sdbX /mnt
where X is the number of the partition on sda.
You should then edit /mnt/etc/fstab and change every occurence of /dev/sda into /dev/sdb.

If your usb is smaller, dismount it and partition it with
Code:
$ sudo cfdisk /dev/sdb
or
Code:
$ sudo parted /dev/sdb
and create the partitions.
Then use 'mkfs.ext2', 'mkfs.ext4' to create the filesystems on the partitions and copy the contents of the partitions on /dev/sda to /dev/sdb.
Make sure you have grub installed and then run
Code:
$ sudo modprobe dm-mod
$ sudo grub-install --target=i386-pc --recheck --debug /dev/sdb
$ sudo mount /dev/sdbX /mnt # X is the number of the boot partition
$ sudo mkdir -p /mnt/grub/locale
$ sudo cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /mnt/grub/locale/en.mo
$ sudo umount /mnt
$ sudo mount /dev/sdY /mnt # the partition containing /etc
$ sudo your-favorite-editor /mnt/etc/fstab # and replace every occurrence of /dev/sda with /dev/sdb
But it might be easier to boot the install image and use that to install to the usb.
 
Old 08-01-2012, 03:44 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Almost impossible to guess the answer.

It might work to dd the install. Problems may have to be fixed that might take a while. It is worth a try.

Knowing the actual size of the install might be a start. The live cd's have a compressed file that packs in data. That is different than using a debian installer app to install to a usb as if were your hard drive. To most linux a usb is a scsi drive.

Might be possible to use a clone tool like clonezilla/redobackup. Still might need to edit some files.

As stated it might be worth it to do a clean install to the usb. The live cd deals tend to take an iso image and cheat it and not a true install.
 
Old 08-01-2012, 05:43 PM   #4
jbruyet
Member
 
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178

Original Poster
Rep: Reputation: 7
Maybe I need to clarify -- I want to copy my full workstation configuration to the USB drive, diagnostic programs and everything, and have that be what boots when I boot to the USB drive. I know it's possible to start installing programs once the USB drive boots but that's a lot of hassle and very time consuming.

Thanks,

Joe B
 
Old 08-02-2012, 12:09 AM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Is your USB drive smaller than your SATA (or IDE) drive? If so, then a full "dd" copy is not an option. You'll have to format new filesystem(s) on the USB drive at its smaller size, and copy the files (rsync is a good choice for this).

Be sure your filesystems are specified (in /etc/fstab) to be mounted by LABEL or UUID, not by device not (an example of a device node is /dev/sda1). Since the USB drive is likely NOT going to be the same device node when using it, you need to be sure the kernel will mount the correct partition. Its initrd or initramfs should take care of this. How well this happens depends on your distribution.

I built my own USB memory stick based system from Slackware. But I used by own code to find the drive by UUID and make sure it got mounted. I did this because stock initrds did not do one extra step I wanted: to give me the choice of 32 bit or 64 bit system to boot, and do it from the same partition.

Your case should be simpler.
 
Old 08-02-2012, 07:01 AM   #6
zwitterion-241920
Member
 
Registered: Nov 2011
Location: AccountKiller
Distribution: AccountKiller
Posts: 89

Rep: Reputation: 39
Quote:
Originally Posted by jbruyet View Post
Maybe I need to clarify -- I want to copy my full workstation configuration to the USB drive, diagnostic programs and everything, and have that be what boots when I boot to the USB drive.
In that case I think it would be easiest to boot an install cd or usb for the distro you want, then plug in the usb, figure out its /dev id and have the live{cd,usb} isntall. At the disk partitioning stage, select the target usb, and after it's installed onto the usb, copy the /bin, /sbin, /usr, /home, /var and everything in /etc except for fstab and mtab from your workstation to the usb.

The system on the usb should now be pretty much indistinguishable from the system on the workstation.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Create Bootable Live USB Drives Using UNetBootin in Windows, Linux LXer Syndicated Linux News 0 01-10-2011 02:10 PM
How to create bootable usb to repair or install grub loader roger.white Linux - Newbie 2 10-02-2010 10:36 PM
Trying to create a bootable USB flash drive to install RHEL (4 or 5) on servers scholldr Linux - General 2 05-05-2008 07:39 AM
how to create usb drive a linux bootable deepak rawat Linux - Networking 1 06-17-2006 02:23 AM
create bootable linux for usb memory stick mikequinlan Linux - Software 1 05-20-2006 07:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration