LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 03-13-2017, 02:26 PM   #1
TheStr3ak5
Member
 
Registered: Feb 2016
Location: Zaragoza, Spain
Distribution: Xubuntu, Tails, etc.
Posts: 55

Rep: Reputation: 9
Unhappy Tryng to put my lfs VM in a usb


Well, I have a VM with a lfs system finished and half blfs accomplished, and now i want to migrate all my work to a brand new 32GB usb (well,brand new... I used it for many partitionig purposes and that kind of things) but i have here the problem.
The problem is not change fstab,grub.cfg, etc., that things is just change /dev/sda1 for /dev/sdd1, the problem is, how i migrate the system to the usb?
I planned migrate the system, plug the usb in my xubuntu, modify fstab-grub.cfg-mtab-etc and boot, but if i cant migrate the system, all the chain goes down, i thinked about clonezilla but idk how to manage that utility, thx in advance!
----------------------------------------
Caracteristics of the lfs build if needed:
- Platform=64bits-BIOS (my pc is 64 bits and EFI but i usually boot live usb in legacy mode)
- Partitioning of VM:
1 partition ext4 of arround 70GB containing /
1 partition ext2 containing /boot (around 500M)
1 swap partition (this one is quite prescindible)
- Partitioning of USB:
1 partition ext4 of 29GB containing /
1 partition of 1GB containing /boot
1 partition of the rest designed as swap
- Size of VM=75GB
-Size of USB=32GB
 
Old 03-13-2017, 05:44 PM   #2
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
There are various ways to clone partitions to new locations. In addition to software that you mentioned, there are other methods using simple utilities such as tar, cp, rsync, cpio, and so on. Some examples...
http://linuxmafia.com/faq/VALinux-kb...ory-trees.html
I prefer tar and use it for that purpose all the time. And although some people do it, I choose not to copy a system's partition while it's running. Nothing special has to be done about the folders with the kernel's stuff that way. I prefer to boot into another system, mount the partition to be copied, cd to it, archive it to a tarball, and untar it in the new partition. The tar example in the link above pipes the output of the tar command to another tar command, but I prefer breaking that up into two steps and create a tarball that I often keep as a backup after using it to clone something somewhere.

Anyway, I recommend that you also compile a new kernel and build in support for USB drives. I usually build in these...
Code:
...[*] USB support ---> (CONFIG_USB_SUPPORT=y)
        |
        |...<*> Support for Host-side USB (CONFIG_USB=y)
        |...<*> EHCI HCD (USB 2.0) support (CONFIG_USB_EHCI_HCD=y)
	|...<*> Generic EHCI driver for a platform device (CONFIG_USB_EHCI_HCD_PLATFORM=y)
        |...<*> OHCI HCD (USB 1.1) support (CONFIG_USB_OHCI_HCD=y)
        |...<*>   OHCI support for PCI-bus USB controllers (CONFIG_USB_OHCI_HCD_PCI=y)
        |...<*>   Generic OHCI driver for a platform device (CONFIG_USB_OHCI_HCD_PLATFORM=y)
        |...<*> UHCI HCD (most Intel and VIA) support (CONFIG_USB_UHCI_HCD=y)
        |...<*> USB Mass Storage support (CONFIG_USB_STORAGE=y)
        |
The HCD port drivers usually are EHCI for high-speed USB plus either OHCI or UHCI for a fallback to legacy USB. Use whatever your host system uses.

SCSI device support (CONFIG_SCSI) also should be built in (required by USB support)...
Code:
...    SCSI device support --->
        |
        |...-*- SCSI device support (CONFIG_SCSI=y)
        |...<*> SCSI disk support (CONFIG_BLK_DEV_SD=y)
        |...<*> SCSI CDROM support (CONFIG_BLK_DEV_SR=y)
        |...<*> SCSI generic support (CONFIG_CHR_DEV_SG=y)
Because USB drives can be discovered and enumerated differently when other devices are plugged in, I also recommend that you use LABEL or UUID instead of the drive's device name in fstab and grub.cfg. Partition labels and UUIDs reside in the filesystem, so you need to create an initial ram filesystem to use them (see the BLFS book). If you are using GPT, then you can skip the initial ram filesystem and use PARTUUID to specify partitions in fstab and grub.cfg. Examples with UUID...
Code:
# Begin /boot/grub/grub.cfg

set default=0
set timeout=5

menuentry “Linux From Scratch (USB Version)” {
insmod search_fs_uuid
search --no-floppy --fs-uuid --set=root 98790171-5ab5-45c6-9764-096c056918cf
linux /boot/vmlinuz root=UUID=98790171-5ab5-45c6-9764-096c056918cf ro rootfstype=ext4 rootdelay=5
initrd /boot/initrd.img
}

# End /boot/grub/grub.cfg
That example is for no separate boot partition. The rootdelay=5 kernel parameter is to compensate for the slower response of the USB drive. The number is the delay in seconds, and you may get by with less or need more.
Code:
# Begin /etc/fstab

UUID=98790171-5ab5-45c6-9764-096c056918cf /    ext4 defaults  0 1
UUID=8e67110b-9799-4665-85b6-4f7795b2ce88 swap swap pri=1     0 0

proc            /proc          proc      nosuid,noexec,nodev  0 0
sysfs           /sys           sysfs     nosuid,noexec,nodev  0 0
devpts          /dev/pts       devpts    gid=5,mode=620       0 0
tmpfs           /run           tmpfs     defaults             0 0
devtmpfs        /dev           devtmpfs  mode=0755,nosuid     0 0

/dev/sr0        /media/cdrom   auto      noauto,user          0 0

# End /etc/fstab
If you decide to create an initial ram filesystem, the kernel has to be configured to support that. I enable these...
Code:
....General setup --->
     |
     |...[*]Initial RAM filesystem and RAM disk (initramfs/initrd) support (CONFIG_BLK_DEV_INITRD=y)

...Device Drivers --->
     |
     |...[*] Block devices ---> (CONFIG_BLK_DEV=y)
              |
              |...<*> RAM block device support (CONFIG_BLK_DEV_RAM=y)
              |...(16)   Default number of RAM disks (CONFIG_BLK_DEV_RAM_COUNT=<integer>) 
              |...(4096) Default RAM disk size (kbytes) (CONFIG_BLK_DEV_RAM_SIZE=<integer>)
I think that's really all I know about booting LFS from a USB drive. It's what I do anyway.

Last edited by stoat; 03-14-2017 at 08:08 AM.
 
  


Reply

Tags
boot loader, iso, lfs, virtual machine



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
Cross Compile LFS /lib32 /lib64 /lib Where do you put your lib files? Wayne Sallee Linux From Scratch 18 02-15-2017 06:54 AM
I have my data on my dvd of RHEL4 but it's not booting while I tryng to install.in m seethayyadora Red Hat 2 07-01-2011 11:27 AM
USB 2.0 drive hangs when put on the same controller with USB 1.1 devices lpwevers Linux - Hardware 0 01-25-2009 01:41 PM
Best way to put USB 2.0 in laptop? General Linux - Hardware 1 04-01-2007 03:29 AM
Put /home on USB? trashbird1240 Linux - General 1 11-23-2006 07:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 05:07 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