Difference between pages "Litecoin Mining for Funtoo" and "Partitioning in Action, Part 1"

(Difference between pages)
(Set up go.sh)
 
(Created page with "{{Article |Subtitle=Moving /home |Summary=In this new series of tips, Daniel Robbins shows you how to change partition layout on a running system. He'll also cover several tri...")
 
Line 1: Line 1:
Litecoin mining is a fun and easy way that you can help support the Funtoo Linux project. Litecoin is a virtual cryptographic currency that is generated using CPUs and video card GPU computational power, and can be converted into a traditional currency like US dollars.  
+
{{Article
 +
|Subtitle=Moving /home
 +
|Summary=In this new series of tips, Daniel Robbins shows you how to change partition layout on a running system. He'll also cover several tricks of the trade to minimize downtime and avoid making costly mistakes. In this particular tip, he'll show you how to move /home to another partition.
 +
|Author=Drobbins
 +
}}
 +
== Introduction ==
  
== How does Litecoin Relate to Funtoo? ==
+
The partition /home is one of the most-often-moved partitions. Sometimes, all the space in /home becomes exhausted, and an additional hard drive is required. Other times, /home is set up as part of the root partition, and it may need to be moved to improve performance or facilitate backup. Whatever the case, I'll show you how to move /home safely and efficiently.
  
Part of Funtoo is having fun, and part of having fun is being creative, and exploring new ideas and concepts, and not being limited by the expectations of others. These concepts include technology, but also include new community concepts and approaches for supporting a community. Distributed support via CPU and GPU power is certainly a novel way of supporting an open source project, and because of this it is a perfect fit for Funtoo. In many ways, the resource challenges faced by open source projects are more complex than the technical challenges, and deserve to be taken seriously. By exploring the use of Litecoin, we are exploring an innovative way to fund the project.
+
{{Warning|The following technique describes how to move a partition(s). Although this technique is designed so that you can "back out" of a failed partition move, it doesn't protect against user error. In other words, any time that you format partitions or copy large numbers of files, there's a possibility that you will type the wrong thing, causing lots of data to be destroyed. For this reason, it's highly recommended that you take appropriate steps to back up all critical files before proceeding.}}
  
=== What are Funtoo Litecoin Funds Used For? ===
+
Now that you're prepared, we're ready to start moving /home. The exact steps you will take depend on whether /home currently resides on its own separate partition, or whether it is located on the root partition. Keep this in mind as we go through the steps (I'll make notes where necessary). Right now, if you are moving /home to a new hard drive, it should be physically installed in your system.
  
These funds will be used to support Funtoo's operating budget, covering hosting and server equipment expenses and other expenses such as hardware purchases for supporting ongoing development for various developers.
+
If you are moving /home to an existing partition (it doesn't need to be ext2, as long as the target primary or extended partition exists), you can proceed to step 2.
  
== Litecoin Pools ==
+
== Create a new partition, if necessary ==
  
 +
If the new partition doesn't exist yet, you'll need to create it using cfdisk (preferred) or fdisk. If the partition doesn't reside on your first drive, remember to specify the name of the device as the first argument to cfdisk or fdisk. After creating the appropriate primary or extended partition, you should reboot so that the partition table can be reread correctly. This is the only time you will need to reboot the system.
  
Typically, Litecoins are mined by pools of computers, and funtoo is part of the following pooled litecoin mining efforts:
+
==  Create a filesystem on the new partition ==
  
{| style="background-color:#ffffcc;" cellpadding="10" cellspacing="0" border="1"
+
To create a filesystem on the new partition, first make sure you know the exact device name for the new partition (for example, /dev/sda5). If you're not sure of the exact device name, stop now and double-check! Then type the following, as root:
! pool
+
! host
+
! port
+
! user
+
! password
+
! stats
+
! review
+
|-
+
| Coinotron
+
| <tt>stratum+tcp://coinotron.com:3334</tt>
+
| <tt>3334</tt>
+
| <tt>funtoo.public</tt>
+
| <tt>p</tt>
+
|
+
| We've found this pool to be very efficient.
+
|-
+
| Burnside's Litecoin Mining Pool
+
| <tt>ltc.kattare.com</tt>
+
| <tt>9332</tt>
+
| <tt>funtoo.public</tt>
+
| <tt>p</tt>
+
| [http://ltc.kattare.com/stats.php stats]
+
| very good PPNLS pool
+
|-
+
| OzCoin
+
| <tt>newlc.ozco.in</tt>
+
| <tt>9332</tt>
+
| <tt>funtoo.public</tt>
+
| <tt>p</tt>
+
| [https://lc.ozcoin.net/content/overview ozcoin overview]
+
| very good PPS pool
+
|}
+
  
There are lots of different ways to mine Litecoins. You can use any of our pools above. You can also use your CPU or your graphics card. To see what different types of hardware can do, see the [https://github.com/litecoin-project/litecoin/wiki/Mining-hardware-comparison Litecoin Mining Hardware Comparison] page. Note that many of these systems are overclocked so make note of the CPU and memory frequencies listed here.
+
<console>
 +
# ##i##mkfs.ext2 /dev/???
 +
</console>
  
== "Got Litecoins Already" Method ==
+
In the above and following code samples, ??? should be replaced with the target partition name. After executing this command, the target partition will contain an empty ext2 filesystem.
  
If you already have Litecoins that you want to donate to Funtoo Linux, you can send them to <tt>LgtcMbY5JYTQAGzdfJ9U83CPhspNkbJzym</tt>. Thanks!
+
== Mount the new filesystem in /mnt ==
  
Here's how to do it with litecoind:
+
Create a directory called /mnt/newpart, and then mount the new partition there:
  
 
<console>
 
<console>
# ##i##litecoind sendtoaddress LgtcMbY5JYTQAGzdfJ9U83CPhspNkbJzym 50
+
# ##i##mount /dev/??? /mnt/newpart
 
</console>
 
</console>
  
Be sure to let Daniel know that you sent some coin so that you can receive proper respect :)
+
==  Drop to single-user mode ==
  
== CPU Mining ==
+
I delayed this step as long as possible to maximize system availability, but we now must drop into single-user mode, and copy files from /home to /mnt/newpart. You shouldn't have any files open in /home, and entering single-user mode eliminates this possibility:
  
Here's how to get started and convert your idle CPU power into a contribution to the Funtoo Linux project.
+
<console>
 +
# ##i##init 1
 +
</console>
  
The "miner" is the program that performs the computation to generate litecoins. It receives blocks from a server, which it performs computations on. Miners are designed to run continually in the background, where they use up idle CPU only, and will not impact the speed of your system. A significant contribution to Funtoo Linux is only realized when miners are run continually for days and weeks -- so running a miner for an hour or so is typically not effective.
+
==  Change directories to /home and copy files ==
  
=== Installation using Portage ===
+
Type the following:
 
+
This method will use CFLAGS from /etc/portage/make.conf. Note that <tt>-O2</tt> seems to work much better than <tt>-O3</tt>.
+
  
 
<console>
 
<console>
# ##i##emerge pooler-cpuminer
+
# ##i##cd /home
 +
# ##i##cp -ax * /mnt/newpart
 
</console>
 
</console>
  
=== Set up go.sh ===
+
The cp -ax command recursively copies the contents of /home to /mnt/newpart, preserving all file attributes, and not crossing any mount points. After this command finishes, /mnt/newpart will contain an exact copy of all the files and directories currently in /home. If the old /home was on its own separate partition (listed on a separate line in /etc/fstab), go to step 6a. Otherwise, proceed to step 6b.
  
Create the following <tt>go.sh</tt> script to start the miner:
+
==  Use the new partition ==
  
{{File
+
=== /home on its own partition ===
|go.sh|<pre>
+
#!/bin/bash
+
threads=$(grep -c "^processor" /proc/cpuinfo)
+
while true;
+
do
+
  minerd --algo scrypt -s 45 --retry-pause 5 --threads $threads --url http://ltc.kattare.com:9332 --userpass funtoo.public:p
+
done
+
</pre>}}
+
  
Make it executable:
+
{{Note|These instructions are for systems where the old /home is already on its own dedicated partition. If this isn't the case, see the next section.}}
 +
 
 +
Unmount the old partition by typing:
  
 
<console>
 
<console>
# ##i##chmod +x go.sh
+
# ##i##cd /
 +
# ##i##umount /home
 
</console>
 
</console>
  
=== Run go.sh ===
+
Then, unmount and remount the new partition:
 
+
Run <tt>go.sh</tt> to start the miner.
+
  
 
<console>
 
<console>
# ##i##./go.sh
+
# ##i##umount /mnt/newpart
 +
# ##i##mount /dev/??? /home
 
</console>
 
</console>
  
The cpuminer will only use idle CPU and will not slow down your system. Modern systems will generate somewhere from 15 to 60 KHash/sec total, which will result in $10 to Funtoo Linux per month for a Core i7 system at current exchange rates, when run continually.
+
Now, the new partition is available at /home and is ready to be used. We can perform the last few steps in multiuser mode. Exit single-user mode, so that the system is back up and running, by pressing CTRL-D.
  
Keep those miners running and thanks for supporting Funtoo Linux!
+
Important: After the system starts up normally, log in as root and edit /etc/fstab so that /dev/??? is now mounted automatically at /home instead of your old partition. For example, change this line:
  
== GPU Mining ==
+
<pre>
 +
/dev/hda3  /home  ext2  defaults  1  2
 +
</pre>
  
 +
to this line:
  
'''cgminer stopped supporting GPU/Scrypt mining in 3.8 series'''. 3.7.2 version is stable and recommended for GPU mining.
+
<pre>
 +
/dev/???  /home  ext2  defaults  1  2
 +
</pre>
  
 +
=== /home on a shared partition ===
  
Some of the more hardcore individuals in the Funtoo community may want to use their graphics processor to mine litecoins. Modern graphics cards, particularly AMD (ATI) cards, can offer hashrates well above 100Khash/sec, even above 400Khash/sec for some cards. Daniel Robbins has a few Radeon HD 6950's that can generate in excess of 400Khash/sec ''each''.
+
{{Note|These instructions are for systems where the old /home is on a shared partition.}}
 
+
AMD (ATI) cards tend to work much better than NVIDIA for litecoin mining. Here's how to do GPU mining:
+
 
+
=== Prerequisites ===
+
 
+
First, X will need to be installed, and you will need to ensure all your video cards are defined in <tt>/etc/X11/xorg.conf</tt>. For AMD cards, ati-drivers 13.1 appears to work well. Ensure that full hardware acceleration is working and that <tt>ati</tt> OpenGL and <tt>amd</tt> OpenCL are selected via <tt>eselect</tt>. (This is probably how things are set up if you simply emerged ati-drivers.)
+
 
+
=== Install cgminer ===
+
 
+
First, enable the <tt>scrypt</tt> USE variable (important!). Now, emerge cgminer:
+
  
 
<console>
 
<console>
# ##i##USE="scrypt" emerge =net-misc/cgminer-3.7.2
+
# ##i##cd /
 +
# ##i##mv /home /home.old
 +
# ##i##mkdir /home
 +
# ##i##mount /dev/??? /home
 
</console>
 
</console>
  
=== Create cgminer script ===
+
Now, leave single user mode by pressing CTRL-D. When the system is back up and running, edit /etc/fstab and add a line like the following:
 
+
Create a <tt>go.sh</tt> script that looks like this:
+
  
 
<pre>
 
<pre>
#!/bin/bash
+
/dev/???  /home  ext2  defaults  1   2
export GPU_MAX_ALLOC_PERCENT=100
+
export GPU_USE_SYNC_OBJECTS=1
+
export DISPLAY=:0
+
cgminer \
+
-o http://newlc.ozco.in:9332/ -u funtoo.public -p p \
+
-o http://ltc.kattare.com:9332/ -u funtoo.public -p p \
+
--intensity 17 \
+
--scrypt \
+
--shaders 1536 --thread-concurrency 8000 -g 1 --worksize 256 \
+
--auto-fan --temp-target 80
+
 
</pre>
 
</pre>
  
This script will start cgminer to connect to newlc.ozco.in, but will automatically fall back to the kattare pool if ozco.in is down. Intensity ranges from 1-20, with higher settings generally offering better hashrates. But if you get too close to 20, you will notice a slow down in interactive performance when using the X server. ssh performance will be unaffected.  
+
That way, your new partition will get mounted correctly the next time the system is rebooted.
  
Be sure to properly set the number of shaders on your card -- 1536 is for an unlocked Radeon HD 6950. Consult [https://github.com/ckolivas/cgminer/blob/master/SCRYPT-README SCRYPT-README] (look for the <tt>--shaders</tt> description) to view the correct shaders to use for your card.
+
==  Finishing up ==
  
=== Start Mining ===
+
We deliberately left the old /home directory/partition behind, just in case there were problems copying files. After verifying that the system is running smoothly, you can either use your old /home partition for something else, or remove the /home.old directory.
 
+
Now make it executable, '''make sure X is running''', and start mining:
+
 
+
<console>
+
# ##i##chmod +x go.sh
+
# ##i##./go.sh
+
</console>
+
  
There are other cool things you can do with cgminer, such as overclocking your video card and ramping up the intensity to at or near 20 to dramatically increase hashrates. Happy mining, and if you are mining for Funtoo, thanks :)
+
Congratulations, you've just moved /home! In my next tip, we'll reconfigure a system so that /tmp and /var are on their own shared partition. See you then.
  
[[Category:HOWTO]]
+
{{ArticleFooter}}

Revision as of 20:24, January 1, 2015

Moving /home

In this new series of tips, Daniel Robbins shows you how to change partition layout on a running system. He'll also cover several tricks of the trade to minimize downtime and avoid making costly mistakes. In this particular tip, he'll show you how to move /home to another partition.

Support Funtoo and help us grow! Donate $15 per month and get a free SSD-based Funtoo Virtual Container. 24 spots left.

Introduction

The partition /home is one of the most-often-moved partitions. Sometimes, all the space in /home becomes exhausted, and an additional hard drive is required. Other times, /home is set up as part of the root partition, and it may need to be moved to improve performance or facilitate backup. Whatever the case, I'll show you how to move /home safely and efficiently.

Warning

The following technique describes how to move a partition(s). Although this technique is designed so that you can "back out" of a failed partition move, it doesn't protect against user error. In other words, any time that you format partitions or copy large numbers of files, there's a possibility that you will type the wrong thing, causing lots of data to be destroyed. For this reason, it's highly recommended that you take appropriate steps to back up all critical files before proceeding.

Now that you're prepared, we're ready to start moving /home. The exact steps you will take depend on whether /home currently resides on its own separate partition, or whether it is located on the root partition. Keep this in mind as we go through the steps (I'll make notes where necessary). Right now, if you are moving /home to a new hard drive, it should be physically installed in your system.

If you are moving /home to an existing partition (it doesn't need to be ext2, as long as the target primary or extended partition exists), you can proceed to step 2.

Create a new partition, if necessary

If the new partition doesn't exist yet, you'll need to create it using cfdisk (preferred) or fdisk. If the partition doesn't reside on your first drive, remember to specify the name of the device as the first argument to cfdisk or fdisk. After creating the appropriate primary or extended partition, you should reboot so that the partition table can be reread correctly. This is the only time you will need to reboot the system.

Create a filesystem on the new partition

To create a filesystem on the new partition, first make sure you know the exact device name for the new partition (for example, /dev/sda5). If you're not sure of the exact device name, stop now and double-check! Then type the following, as root:

# mkfs.ext2 /dev/???

In the above and following code samples, ??? should be replaced with the target partition name. After executing this command, the target partition will contain an empty ext2 filesystem.

Mount the new filesystem in /mnt

Create a directory called /mnt/newpart, and then mount the new partition there:

# mount /dev/??? /mnt/newpart

Drop to single-user mode

I delayed this step as long as possible to maximize system availability, but we now must drop into single-user mode, and copy files from /home to /mnt/newpart. You shouldn't have any files open in /home, and entering single-user mode eliminates this possibility:

# init 1

Change directories to /home and copy files

Type the following:

# cd /home
# cp -ax * /mnt/newpart

The cp -ax command recursively copies the contents of /home to /mnt/newpart, preserving all file attributes, and not crossing any mount points. After this command finishes, /mnt/newpart will contain an exact copy of all the files and directories currently in /home. If the old /home was on its own separate partition (listed on a separate line in /etc/fstab), go to step 6a. Otherwise, proceed to step 6b.

Use the new partition

/home on its own partition

Note

These instructions are for systems where the old /home is already on its own dedicated partition. If this isn't the case, see the next section.

Unmount the old partition by typing:

# cd /
# umount /home

Then, unmount and remount the new partition:

# umount /mnt/newpart
# mount /dev/??? /home

Now, the new partition is available at /home and is ready to be used. We can perform the last few steps in multiuser mode. Exit single-user mode, so that the system is back up and running, by pressing CTRL-D.

Important: After the system starts up normally, log in as root and edit /etc/fstab so that /dev/??? is now mounted automatically at /home instead of your old partition. For example, change this line:

/dev/hda3   /home   ext2   defaults   1   2

to this line:

/dev/???   /home   ext2   defaults   1   2

/home on a shared partition

Note

These instructions are for systems where the old /home is on a shared partition.

# cd /
# mv /home /home.old
# mkdir /home
# mount /dev/??? /home

Now, leave single user mode by pressing CTRL-D. When the system is back up and running, edit /etc/fstab and add a line like the following:

/dev/???   /home   ext2   defaults   1   2

That way, your new partition will get mounted correctly the next time the system is rebooted.

Finishing up

We deliberately left the old /home directory/partition behind, just in case there were problems copying files. After verifying that the system is running smoothly, you can either use your old /home partition for something else, or remove the /home.old directory.

Congratulations, you've just moved /home! In my next tip, we'll reconfigure a system so that /tmp and /var are on their own shared partition. See you then.


Next >>>

Read the next article in this series: Partitioning in Action, Part 2

Support Funtoo and help us grow! Donate $15 per month and get a free SSD-based Funtoo Virtual Container. 24 spots left.

About the Author

Daniel Robbins is best known as the creator of Gentoo Linux and author of many IBM developerWorks articles about Linux. Daniel currently serves as Benevolent Dictator for Life (BDFL) of Funtoo Linux. Funtoo Linux is a Gentoo-based distribution and continuation of Daniel's original Gentoo vision.

Got Funtoo?

Have you installed Funtoo Linux yet? Discover the power of a from-source meta-distribution optimized for your hardware! See our installation instructions and browse our CPU-optimized builds.

Funtoo News

Drobbins

New Media Mix-ins

Funtoo Linux now has new media mix-ins. Learn about them and how to use them.
11 January 2015 by Drobbins
Drobbins

The Many Builds of Funtoo Linux

We now have lots of different builds of Funtoo Linux for various CPUs, as well as Hardened, Stable and ARM, and a new UI to browse them. Learn more here.
25 December 2014 by Drobbins
Oleg

Python Updater Deprecation

Python-updater is no longer part of Funtoo Linux.
6 December 2014 by Oleg
View More News...

More Articles

Browse all our Linux-related articles, below:

A

B

F

G

K

L

M

O

P

S

T

W

X

Z