LinuxQuestions.org
Visit Jeremy's Blog.
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, 02: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, 03: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, 04:44 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,354

Rep: Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979Reputation: 2979
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, 06: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, 01:09 AM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Slackware, Amazon Linux
Posts: 1,905
Blog Entries: 20

Rep: Reputation: 126Reputation: 126
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, 08: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:10 PM
How to create bootable usb to repair or install grub loader roger.white Linux - Newbie 2 10-02-2010 11: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 08:39 AM
how to create usb drive a linux bootable deepak rawat Linux - Networking 1 06-17-2006 03:23 AM
create bootable linux for usb memory stick mikequinlan Linux - Software 1 05-20-2006 08:38 AM

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

All times are GMT -5. The time now is 10:41 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration