Sponsored Content
Top Forums UNIX for Advanced & Expert Users Copying a Linux distro from one partition to the other... Post 37365 by Mr_Proper on Tuesday 17th of June 2003 02:53:44 PM
Old 06-17-2003
Cool..

Cool, thanks for the info, guys. I was worried that certain software may have specific harddrive locations embedded in them, but maybe that is just one of the annoying quirks of Windows.

Quote:
As long as your bootloader is on the MBR, then cp -r should do the trick. Remember to redo your config files!
The bootloader is on the Debian partition (hde2). Windows doesn't want to put its bootloader anywhere else except the MBR, so I had to do it that way. I'm going to do what Tux said and chroot to do all the lilo stuff. Hopefully that works. Thanks again, guys. Smilie
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Linux distro

Hi I'm have old toshiba laptop(t1900) 486, 4mbRAM and ~120MB of hdd I'm looking for distro to suite my comp, no need for X windows but not enything that runs on FAT, just normal small Linux. Actually, *BSDs will do as well. If u know any distro that would do this I will be thankful for hint ... (4 Replies)
Discussion started by: wolk
4 Replies

2. Solaris

copying/moving partition

I have a slice on a 72GB hard drive like this (example): /dev/dsk/c0t1d0s0 51424287 51009 50859036 1% /usr/stuff that I need to copy or move to a slice on a MUCH larger slice like this: /dev/dsk/c0t2d0s6 70592505 570236 69316344 1% /usr/newstuff What is the... (4 Replies)
Discussion started by: antalexi
4 Replies

3. Shell Programming and Scripting

Linux distro from bash script

hello ALL, I wander, is there an easy way to get information which linux distro and its version a script runs on? I'm looking for a function like getDistroInfo(), which would return strings like "Ubuntu7.10" or "SLES10" or "RHEL5" etc. uname returns lots of stuff, but distro info.... (1 Reply)
Discussion started by: Samtim74
1 Replies

4. UNIX for Dummies Questions & Answers

New to linux. Which distro should i use?

want to know which Linux distro is 4 me. want 2 teach my self programing and problem solving. i want to learn code and write code. i have an acer aspire one 2GB memory 160 GB HDD intel Atom. look im as noobie as it gets im a MS xp, vista boy want to go beyond graphical click and do... any help... (1 Reply)
Discussion started by: BizilStank
1 Replies

5. What is on Your Mind?

Creating a Linux Distro

I have been using Linux OS since 4 years and I'm very interested to know how to create a Linux Distro. I have heard about LFS. I would just like to know, what do I need to create a Linux Distro? I'm not a programmer, if I have to create a Linux Distro, what programming languages do I need to... (3 Replies)
Discussion started by: Auzern
3 Replies

6. Linux

Best Linux desktop distro

I hate the fact that my first post is this. Anyhow, I've been using Linux distros such as Ubuntu, Fedora, Debian, openSUSE, and a few others for quite some time now. I've never had a problem with any distro, thus saying that they were all good in my opinion. I've been reading a lot on different... (2 Replies)
Discussion started by: Vex
2 Replies

7. Linux

Best Linux Distro

Hello, I have a Compaq Presario v3000 5 year old laptop, with 1 GB RAM and currently running the (slow and stupid) Windows 7 32 bit, thus I would like to dual boot it with an appropriate distro of Linux that 1) Doesnt consume too much resources (1 GB RAM is not a lot of space) and it ll be... (4 Replies)
Discussion started by: ajayram
4 Replies

8. Red Hat

Shrink LVM partition & create new Linux Primary partition

Hello All, I have a Red Hat Linux 5.9 Server installed with one hard disk & 2 Partitions created on it as follows, /boot - Linux Partition & another is LVM - One VG & under that 5-6 Logical volumes(var,opt,home etc). Here my requirement is to take out 1GB of space from LVM ( Any logical... (5 Replies)
Discussion started by: gr8_usk
5 Replies

9. Open Source

What is your favorite Linux distro?

What is your favorite Linux distro? and possibly why? Personally, I have Fedora 3 on my computer. I have used Ubuntu and Slackware, too. But I think I liked Ubuntu more, maybe because of its speed and easy installation of packages. (192 Replies)
Discussion started by: milhan
192 Replies
Bootloader::Library(3)					User Contributed Perl Documentation				    Bootloader::Library(3)

NAME
Bootloader::Library - library for accessing configuration of the bootloader PREFACE
This package is the public API to configure bootloader settings SYNOPSIS
"use Bootloader::Library;" "$obj_ref = Bootloader::Library->new ();" "$status = Bootloader::Library->SetLoaderType ($bootloader);" "$status = Bootloader::Library->DefineMountPoints (\%mountpoints);" "$status = Bootloader::Library->DefinePartitions (@partitions);" "$status = Bootloader::Library->DefineMDArrays (\%md_arrays);" "$status = Bootloader::Library->ReadSettings ();" "$status = Bootloader::Library->WriteSettings ();" "$status = Bootloader::Library->ReadSettingsTmp ($tmp_dir);" "$status = Bootloader::Library->WriteSettingsTmp ($tmp_dir);" "$files_contents_ref = Bootloader::Library->GetFilesContents ();" "$status = Bootloader::Library->SetFilesContents (\%files_contents);" "$status = Bootloader::Library->UpdateBootloader ($avoid_init);" "$status = Bootloader::Library->InitializeBootloader ();" "$file_list_ref = Bootloader::Library->ListConfigurationFiles ();" "$settings_ref = Bootloader::Library->GetSettings ();" "$status Bootloader::Library->SetSettings ($settings_ref);" "$global_ref = Bootloader::Library->GetGlobalSettings ();" "$status = Bootloader::Library->SetGlobalSettings ($global_settings_ref);" "$sections_ref = Bootloader::Library->GetSections ();" "$status = Bootloader::Library->SetSections ($sections_ref);" "$device_map_ref = Bootloader::Library->GetDeviceMapping ();" "$status = Bootloader::Library->SetDeviceMapping ($device_map_ref);" "$unix_dev = Bootloader::Library->GrubDev2UnixDev ($grub_dev);" "$result = Bootloader::Library::DetectThinkpadMBR ($disk);" "$result = Bootloader::Library::WriteThinkpadMBR ($disk);" DESCRIPTION
"$obj_ref = Bootloader::Library->new ();" Creates an instance of the Bootloader::Library class. "$status = Bootloader::Library->SetLoaderType($bootloader);" Initializes the library for the particular bootloader. Takes the name of the bootloader as parameter. Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $status = Bootloader::Library->SetLoaderType ("lilo"); if (! defined ($status)) { die "Error occurred while initalizing for LILO"; } "$status = Bootloader::Library->DefineMountPoints (\%mountpoints);" Defines mount points in the system so that the library does not need to probe them itself when needed. Parameter (mountpoints) is a hash reference (key is mountpoint, value device). Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $mp = { "/" => "/dev/hda3", "/boot" => "/dev/hda1", } Bootloader::Library->DefineMountPoints ($mp); "$status = Bootloader::Library->DefinePartitions (@partitions);" Defines the information about partitions - what disk a partition belongs to and the number of the partition Parameter (partitions) is a list, one entry per partition, each entry is a 3-item list, containing the device of the partition, the device of the disk the partition belongs to, and the number of the partition (first is 1). Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $part = [ [ "/dev/hda1", "/dev/hda", 1], [ "/dev/hda3", "/dev/hda", 3] ]; Bootloader::Library->DefinePartitions ($part); "$status = Bootloader::Library->DefineMDArrays (\%md_arrays);" This interface is broken by design and its use is deprecated!! We only need information about mirrored devices (RAID1) and only GRUB uses that hack. Defines the information about MD RAID arrays (what array is built by what disks). As parameter, it takes a reference to a map of all MD devices, where key is the MD device name, and value a reference to a list of its members. Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $md = { "/dev/md0" => ["/dev/hda1", "/dev/hdc1"], "/dev/md1" => ["/dev/hda2", "/dev/hdc2"], }; Bootloader::Library->DefineMDArrays ($md); "$status = Bootloader::Library->DefineMultipath (\%multipath);" Define hardware information about multipath device. We only need information to write to device map real device, because created multipath device doesn't have geometry and GRUB doesn't work. As parameter, it takes a reference to a map of all multipath devices, where key is the physical value (/dev/sda), and value a multipath device(/dev/mapper/...). Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $mp = { "/dev/sda" => "/dev/mapper/little_mapper", "/dev/sdb" => "/dev/mapper/little_mapper", }; Bootloader::Library->DefineMultipath ($mp); "$status = Bootloader::Library->DefineMultipath (\%multipath);" Define udev mapping of devices. We only need information for GRUB to translate udev device to kernel and then to grub device. As parameter, it takes a reference to a map of all udev names to correspond kernel names. Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $mp = { "/dev/disks/by-id/longhorribleid" => "/dev/sda", "/dev/disks/by-id/longhorribleid-part1" => "/dev/sda1", }; Bootloader::Library->DefineUdevMapping ($mp); "$status = Bootloader::Library->ReadSettings ();" Reads the settings from the system Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $status = Bootloader::Library->ReadSettings (); if (! defined ($status)) { die "Error occurred while reading the settings"; } "$status = Bootloader::Library->WriteSettings ();" Writes the settings to the system. Does not activate the bootloader or the written settings, InitializeBootloader or UpdateBootloader functions must be used for it. Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $status = Bootloader::Library->WriteSettings (); if (! defined ($status)) { die "Error occurred while writing the settings"; } "$status = Bootloader::Library->ReadSettingsTmp ($tmp_dir);" Reads the settings from the Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $status = Bootloader::Library->ReadSettingsTmp ("/tmp"); if (! defined ($status)) { die "Error occurred while reading the settings"; } "$status = Bootloader::Library->WriteSettingsTmp ($tmp_dir);" Writes the settings to temporary directory. Slashes in the filename are replaced with underscores. Returns undef on fail, defined nonzero value otherwise. EXAMPLE: my $status = Bootloader::Library->WriteSettingsTmp ("/tmp"); if (! defined ($status)) { die "Error occurred while writing the settings"; } "$files_contents_ref = Bootloader::Library->GetFilesContents ();" Gets the future contents of all bootloader configuration files. Returns undef on fail, hash where key is file name and value its contents as value on success. EXAMPLE: my $files_contents_ref = Bootloader::Library->GetFilesContents (); if (! defined ($files_contents_ref)) { die "Cannot get the contents of the configuration files" } my $lilo_conf = $files_contents_ref->{"/etc/lilo.conf"}; print "$lilo.conf contents: $lilo_conf "; "$status = Bootloader::Library->SetFilesContents (\%files_contents);" Sets the contents of all configuration files (eg. from editor) $status = Bootloader::Library->SetFilesContents (\%files_contents); "$status = Bootloader::Library->UpdateBootloader ($avoid_init);" Really updates the bootloader configuration after writing the settings. If initialization is needed to make the settings active, but not intended (because it will be done later), set $avoid_init to 1. It makes no efect eg. for GRUB, but prevents from calling /sbin/lilo in case of LILO Returns undef on fail, defined nonzero value otherwise EXAMPLE: my $status = Bootloader::Library->UpdateBootloader (0); if (! defined ($status)) { die "Connot update the bootloader configuration"; } "$status = Bootloader::Library->InitializeBootloader ();" Initializes the firmware to boot the bootloader Returns undef on fail, defined nonzero value otherwise EXAMPLE: my $status = Bootloader::Library->InitializeBootloader (); if (! defined ($status)) { die "Cannot initialize the bootloader"; } "$files_ref = Bootloader::Library->ListConfigurationFiles ();" Returns the list of the configuration files of the bootloader Returns undef on fail EXAMPLE: my $files_ref = Bootloader::Library->ListConfigurationFiles (); if (! defined ($files_ref)) { die "Cannot list configuration files"; } foreach my $fn (@{$files_ref}) { system ("cp $fn $fn.backup"); } "$sections_ref = Bootloader::Library->GetSettings ();" Returns the complete settings of the bootloader. Returns undef on fail. EXAMPLE: see eg. GetSections function definition "$status = Bootloader::Library->SetSettings ();" Returns the complete settings of the bootloader. Returns undef on fail. EXAMPLE: see eg. GetSections function definition "$sections_ref = Bootloader::Library->GetSections ();" Gets the sections of the bootloader. See section description above. TODO Returns undef on fail. EXAMPLE: my $sections_ref = Bootloader::Library->GetSections (); if (! defined ($sections_ref)) { die "Getting sections failed"; } my @sect_names = map { $_->{"name"}; } @{$sections_ref}; my $list = join ", " @sect_names; print "Sections: $list"; "$global_ref = Bootloader::Library->GetGlobalSettings ();" Gets the global settings of the bootloader. See the example map above TODO Returns undef on fail. EXAMPLE: my $global_ref = Bootloader::Library->GetGlobalSettings (); if (! defined ($global_ref)) { die "Getting global data failed"; } my $default = $global_ref->{"default"}; print "Default section: $default"; "$device_map_ref = Bootloader::Library->GetDeviceMapping ();" Gets the device mapping between Linux and firmware. Returns undef on fail. EXAMPLE: $device_map_ref = Bootloader::Library->GetDeviceMapping (); if (! defined ($device_map_ref)) { die "Getting device mapping failed"; } my $hda = $device_map_ref->{"/dev/hda"}; print "/dev/hda is $hda"; "$status = Bootloader::Library->SetSections ();" Sets the sections of the bootloader. Sections have the same format as return value of GetSections (). Returns undef on fail, defined nonzero value on success. EXAMPLE: my $sections_ref = Bootloader::Library->GetSections (); if (! defined ($sections_ref)) { die "Getting sections failed"; } my @sections = @{$sections_ref}; pop @sections; my $ret = Bootloader::Library->SetSections (@sections); if (! defined ($ret)) { print ("Setting sections failed"); } "$status = Bootloader::Library->SetGlobalSettings ();" Sets the global settings of the bootloader. The argument has the same format as the return value of GetGlobalSettings (). Returns undef on fail, defined nonzero value on success. EXAMPLE: my $global_ref = Bootloader::Library->GetGlobalSettings (); if (! defined ($global_ref)) { die "Getting global data failed"; } $global_ref->{"default"} = "linux"; my $ret = Bootloader::Library->SetGlobalSettings ($global_ref); if (! defined ($ret)) { print ("Setting global options failed."); } "$status = Bootloader::Library->SetDeviceMapping ();" Sets the device mapping between Linux device and firmware identification. Returns undef on fail, defined nonzero value on success. EXAMPLE: $device_map_ref = Bootloader::Library->GetDeviceMapping (); if (! defined ($device_map_ref)) { die "Getting device mapping failed"; } $device_map_ref->{"/dev/hda"} = "(hd0)"; my $ret = Bootloader::Library->SetDeviceMapping ($device_map_ref); if (! defined ($ret)) { print ("Setting global options failed."); } "$unix_dev = Bootloader::Core::GRUB->GrubDev2UnixDev ($grub_dev);" Translates the GRUB device (eg. '(hd0,0)') to UNIX device (eg. '/dev/hda1'). As argument takes the GRUB device, returns the UNIX device (both strings). Wrapper function to be able to use this grub function in Tools.pm. "($dev,$path) = Bootloader::Library->SplitPath ($path);" Split unix path to device and relative path on this device. "$result = Bootloader::Library::DetectThinkpadMBR ($disk);" Try detect on disk if contains ThinkpadMBR. Return true if detected. "$result = Bootloader::Library::WriteThinkpadMBR ($disk);" Write generic mbr to disk on thinkpad. Return undef if fail. "$result = Bootloader::Library::ExamineMBR ($disk);" Detects what code is in MBR of device. Return string or undef if fail. Possible string is: generic -> generic MBR grub -> Grub MBR lilo -> lilo stage1 windows -> windows vista -> windows vista (has another mbr) thinkpad -> thinkpad custom mbr unknown -> unknown code invalid -> code which cannot boot perl v5.12.1 2010-05-25 Bootloader::Library(3)
All times are GMT -4. The time now is 06:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy