Difference between pages "Package:DeaDBeeF" and "Partitioning in Action, Part 2"

(Difference between pages)
 
(Created page with "{{Article |Subtitle=Consolidating data |Summary=In this second tip on changing partition layout on a running system, Daniel Robbins shows you how to move /tmp and /var to thei...")
 
Line 1: Line 1:
{{Ebuild
+
{{Article
|Summary=A foobar2000-like music player
+
|Subtitle=Consolidating data
|CatPkg=media-sound/deadbeef
+
|Summary=In this second tip on changing partition layout on a running system, Daniel Robbins shows you how to move /tmp and /var to their own shared partition. He also covers several tricks of the trade to minimize downtime and avoid making costly mistakes.
|Maintainer=damex
+
|Author=Drobbins
 +
|Previous in Series=Partitioning in Action, Part 1
 
}}
 
}}
 +
== Consolidating data ==
  
DeaDBeeF (as in 0xDEADBEEF) is an audio player for GNU/Linux, *BSD, OpenSolaris and other UNIX-like systems. There's also the Android version, which is a very different product. There are no Windows, OSX or iOS versions though, sorry for that.
+
=== Introduction ===
  
Main features (the list is most likely far from complete):
+
In my last tip, we successfully moved /home to a new partition. Now, it's time to learn how to consolidate often-modified files onto a new partition. Why would we want to do this? Here's an example. Often-modified files contribute heavily to fragmentation. One of the best ways to contain fragmentation is to store often-modified files on their own partition. That way, the other partitions are unaffected by the fragmentation caused by the heavily modified files. In concept, this is easy to understand, but how do you actually go about doing it?
  
    mp3, ogg vorbis, flac, ape, wv/iso.wv, wav, m4a/mp3 (aac and alac), mpc, tta, cd audio, and many more
+
First, you must create a new partition for the specific purpose of storing frequently modified files. You might want to locate this partition on a separate disk to enhance performance. Then, I'll walk you through the steps required to move both /tmp and /var to this new partition.
    nsf, ay, vtx, vgm/vgz, spc and many other popular chiptune formats
+
 
    SID with HVSC song length database support for sid
+
{{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.}}
    tracker modules - mod, s3m, it, xm, etc
+
 
    ID3v1, ID3v2.2, ID3v2.3, ID3v2.4, APEv2, Xing/Info, VorbisComments tag reading and writing, as well as reading many other tag/metadata formats in most supported formats
+
=== Create a filesystem on the new partition ===
    automatic character set detection for non-unicode id3 tags - supports cp1251, iso8859-1, and now chinese cp936 (optional), as well as SHIFT-JIS and MS-DOS CP866 for selected formats
+
 
    unicode tags are fully supported as well (both utf8 and ucs2)
+
The first step of this process is to create a new partition that's big enough to hold /var and /tmp, with a little extra space left over. You'll need either an additional drive, or a spare (unused) partition that will house the often-modified files. If you do need to use fdisk or cfdisk to create the partition, you'll need to reboot once. Then, it's time to format the new partition as follows (it's OK to be in multiuser mode while you do this; I'll let you know when to switch to single-user):
    cuesheet (.cue files) support, including charset detection/conversion
+
    clean fast GUI using GTK2 and GTK3, you pick what you like more!
+
    no GNOME or KDE dependencies
+
    minimization to system tray, with scrollwheel volume control, etc
+
    drag and drop, both in playlist, and from other apps
+
    control playback from command line
+
    global hotkeys
+
    multiple playlists using tabbed interface
+
    album cover display
+
    OSD notifications about current playing songs
+
    18-band graphical equalizer and other DSP plugins
+
    built-in high quality tag editor, with custom fields support
+
    customizable groups in playlists
+
    customizable columns with flexible title formatting
+
    streaming radio support for ogg vorbis, mp3 and aac streams
+
    gapless playback for correctly encoded files
+
    lots of plugin, such as global hotkeys, last.fm scrobbler, converter, and many more, sdk is included
+
    comes with advanced Converter plugin, which allows to transcode files to other formats
+
    was tested on x86, x86_64, powerpc, arm, mips architectures, should work on most modern platforms
+
    new features are being added all the time -- check for updates frequently!
+
  
== Installing DeaDBeeF ==
 
To install deadbeef, emerge it:
 
 
<console>
 
<console>
###i## emerge deadbeefmpris
+
# ##i##mkfs.ext2 /dev/???
 
</console>
 
</console>
  
DeaDBeeF have many use flags and they're self explanatory. They're for built'in functional of the player or installing a 3rd party plugins.
+
==  Mount it to /mnt/rwstorage ==
 +
 
 +
As in my previous tip, ??? should be replaced with the device name for the new, empty partition that you are creating. Accidentally typing the wrong name will destroy data on an existing partition, so be careful! After typing this command, you'll have a brand-new ext2 filesystem on the new partition. We're almost ready to mount it, but first, let's make a new mount point.
 +
 
 +
<console>
 +
# ##i##mkdir /mnt/rwstorage
 +
</console>
 +
 
 +
I chose the name rwstorage to remind us that this particular partition is going to be specifically used to house files that are read from and written to frequently. To mount the partition, type:
 +
 
 +
<console>
 +
# ##i##mount /dev/??? /mnt/rwstorage
 +
</console>
 +
 
 +
== Creating a new /tmp ==
 +
 
 +
The partition is now mounted and we're ready to create our new /tmp directory:
 +
 
 +
<console>
 +
# ##i##cd /mnt/rwstorage
 +
# ##i##mkdir tmp
 +
# ##i##chmod 1777 tmp
 +
</console>
 +
 
 +
==  Drop to single-user mode ==
 +
 
 +
Our new directory at /mnt/rwstorage/tmp has the right permissions for a temporary directory. Now, drop to single-user mode, since we must copy over /var. As usual, we've delayed our drop to single-user mode to the last possible moment. Right now, we don't want any programs reading or writing files in /var, so we have to stop all daemons, disconnect all users, and do some quick maintenance by typing:
 +
 
 +
<console>
 +
# ##i##init 1
 +
</console>
 +
 
 +
If you're prompted to enter a password to perform system maintenance, do so. You should now have a root shell, and all unnecessary daemons will be stopped. Create a new location for our /var files by typing:
 +
 
 +
<console>
 +
# ##i##cd /mnt/rwstorage
 +
# ##i##mkdir var
 +
</console>
 +
 
 +
==  Copy /var ==
 +
 
 +
Default permissions on our new /mnt/newstorage/var directory should be correct, so now we're ready to copy all of our original /var data over to the new partition:
 +
 
 +
<console>
 +
# ##i##cd /var
 +
# ##i##cp -ax * /mnt/rwstorage/var
 +
</console>
 +
 
 +
==  Back up and create symlinks ==
 +
 
 +
After this command completes, you'll have an exact copy of /var at /mnt/rwstorage/var. Now, you may be asking how exactly we get Linux to use /mnt/rwstorage/var and /mnt/rwstorage/tmp instead of the defaults in the root directory. This is easily done by the use of symbolic links -- we'll create the new symbolic links, /tmp and /var, which point to the correct directories in /mnt/rwstorage. First, let's back up the original directories:
 +
 
 +
<console>
 +
# ##i##cd /
 +
# ##i##mv var var.old
 +
# ##i##mv tmp tmp.old
 +
</console>
 +
 
 +
The last line probably isn't necessary, since it's very likely that you don't have anything important in /tmp, but we're playing it safe. Now, let's create the symlinks:
 +
 
 +
<console>
 +
# ##i##cd /
 +
# ##i##ln -s /mnt/rwstorage/var /var
 +
# ##i##ln -s /mnt/rwstorage/tmp /tmp
 +
</console>
 +
 
 +
== Finishing touches to /etc/fstab ==
 +
 
 +
Now, when any user or program uses /var, they'll automatically be transported to /mnt/rwstorage/var! Likewise for /tmp. We have one step left; however, it can be safely performed in multiuser mode. It's time to get Apache running again, and to allow all your users to log back in. Exit from runlevel 1 by pressing CTRL-D. The system should start up normally. Log in as root.
  
3party plugins installed via use flags explained here:
+
The final thing we must do is configure /etc/fstab so that /dev/??? is mounted at /mnt/rwstorage. You must add a line like the following to your /etc/fstab:
  
{| class="wikitable sortable"
+
<pre>
|-
+
/dev/???  /mnt/rwstorage  ext2  defaults  1  2
! USE flag !! Plugin package !! Plugin description
+
</pre>
|-
+
| archive || media-plugins/deadbeef-archive-reader || Reading media files from archived files
+
|-
+
| bookmark-manager || media-plugins/deadbeef-bookmark-manager || Resume playinf files after closing player from the last timestamp
+
|-
+
| bs2b || media-plugins/deadbeef-bs2b || bs2b dsp support. Useful for headphones
+
|-
+
| filebrowser || media-plugins/deadbeef-fb || Browse files on your disks
+
|-
+
| gnome-mmkeys || media-plugins/deadbeef-gnome-mmkeys || Gnome multimedia keys support
+
|-
+
| infobar || media-plugins/deadbeef-infobar || Show online lyrics
+
|-
+
| jack || media-plugins/deadbeef-jack || Jack audio support
+
|-
+
| mpris || media-plugins/deadbeef-mpris || MPRIS support
+
|-
+
| musical-spectrum || media-plugins/deadbeef-musical-spectrum || Draws musical spectrum for current track
+
|-
+
| replaygain-control || media-plugins/deadbeef-replaygain-control || Advanced control of replaygain
+
|-
+
| spectrogram || media-plugins/deadbeef-spectrogram || Draws spectrogram for current track
+
|-
+
| stereo-widener || media-plugins/deadbeef-stereo-widener || Widens stereo
+
|-
+
| vk || media-plugins/deadbeef-vk || Play music fron vk.com social network
+
|-
+
| vu-meter || media-plugins/deadbeef-vu-meter || Draws vu meter for current track
+
|-
+
| waveform-seekbar || media-plugins/deadbeef-waveform-seekbar || Draws waveform seekbar for current track
+
|}
+
  
{{EbuildFooter}}
+
After saving the changes to /etc/fstab, your system has been successfully upgraded! After verifying that everything is working properly, you'll want to remove the /tmp.old and /var.old backup directories. Congratulations -- you've successfully reconfigured your system's partitions for optimum performance.
 +
{{ArticleFooter}}

Revision as of 20:32, January 1, 2015

Consolidating data

In this second tip on changing partition layout on a running system, Daniel Robbins shows you how to move /tmp and /var to their own shared partition. He also covers several tricks of the trade to minimize downtime and avoid making costly mistakes.


Previous in series: Partitioning in Action, Part 1

Support Funtoo and help us grow! Donate $15 per month and get a free SSD-based Funtoo Virtual Container.
Looking for people interested in testing and documenting Docker support! Contact Daniel Robbins for more info.

Consolidating data

Introduction

In my last tip, we successfully moved /home to a new partition. Now, it's time to learn how to consolidate often-modified files onto a new partition. Why would we want to do this? Here's an example. Often-modified files contribute heavily to fragmentation. One of the best ways to contain fragmentation is to store often-modified files on their own partition. That way, the other partitions are unaffected by the fragmentation caused by the heavily modified files. In concept, this is easy to understand, but how do you actually go about doing it?

First, you must create a new partition for the specific purpose of storing frequently modified files. You might want to locate this partition on a separate disk to enhance performance. Then, I'll walk you through the steps required to move both /tmp and /var to this new partition.

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.

Create a filesystem on the new partition

The first step of this process is to create a new partition that's big enough to hold /var and /tmp, with a little extra space left over. You'll need either an additional drive, or a spare (unused) partition that will house the often-modified files. If you do need to use fdisk or cfdisk to create the partition, you'll need to reboot once. Then, it's time to format the new partition as follows (it's OK to be in multiuser mode while you do this; I'll let you know when to switch to single-user):

# mkfs.ext2 /dev/???

Mount it to /mnt/rwstorage

As in my previous tip, ??? should be replaced with the device name for the new, empty partition that you are creating. Accidentally typing the wrong name will destroy data on an existing partition, so be careful! After typing this command, you'll have a brand-new ext2 filesystem on the new partition. We're almost ready to mount it, but first, let's make a new mount point.

# mkdir /mnt/rwstorage

I chose the name rwstorage to remind us that this particular partition is going to be specifically used to house files that are read from and written to frequently. To mount the partition, type:

# mount /dev/??? /mnt/rwstorage

Creating a new /tmp

The partition is now mounted and we're ready to create our new /tmp directory:

# cd /mnt/rwstorage
# mkdir tmp
# chmod 1777 tmp

Drop to single-user mode

Our new directory at /mnt/rwstorage/tmp has the right permissions for a temporary directory. Now, drop to single-user mode, since we must copy over /var. As usual, we've delayed our drop to single-user mode to the last possible moment. Right now, we don't want any programs reading or writing files in /var, so we have to stop all daemons, disconnect all users, and do some quick maintenance by typing:

# init 1

If you're prompted to enter a password to perform system maintenance, do so. You should now have a root shell, and all unnecessary daemons will be stopped. Create a new location for our /var files by typing:

# cd /mnt/rwstorage
# mkdir var

Copy /var

Default permissions on our new /mnt/newstorage/var directory should be correct, so now we're ready to copy all of our original /var data over to the new partition:

# cd /var 
# cp -ax * /mnt/rwstorage/var

Back up and create symlinks

After this command completes, you'll have an exact copy of /var at /mnt/rwstorage/var. Now, you may be asking how exactly we get Linux to use /mnt/rwstorage/var and /mnt/rwstorage/tmp instead of the defaults in the root directory. This is easily done by the use of symbolic links -- we'll create the new symbolic links, /tmp and /var, which point to the correct directories in /mnt/rwstorage. First, let's back up the original directories:

# cd /
# mv var var.old
# mv tmp tmp.old

The last line probably isn't necessary, since it's very likely that you don't have anything important in /tmp, but we're playing it safe. Now, let's create the symlinks:

# cd /
# ln -s /mnt/rwstorage/var /var
# ln -s /mnt/rwstorage/tmp /tmp

Finishing touches to /etc/fstab

Now, when any user or program uses /var, they'll automatically be transported to /mnt/rwstorage/var! Likewise for /tmp. We have one step left; however, it can be safely performed in multiuser mode. It's time to get Apache running again, and to allow all your users to log back in. Exit from runlevel 1 by pressing CTRL-D. The system should start up normally. Log in as root.

The final thing we must do is configure /etc/fstab so that /dev/??? is mounted at /mnt/rwstorage. You must add a line like the following to your /etc/fstab:

/dev/???   /mnt/rwstorage   ext2   defaults   1   2

After saving the changes to /etc/fstab, your system has been successfully upgraded! After verifying that everything is working properly, you'll want to remove the /tmp.old and /var.old backup directories. Congratulations -- you've successfully reconfigured your system's partitions for optimum performance.


Support Funtoo and help us grow! Donate $15 per month and get a free SSD-based Funtoo Virtual Container.
Looking for people interested in testing and documenting Docker support! Contact Daniel Robbins for more info.

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

Pre-built kernels!

Funtoo stage3's are now starting to offer pre-built kernels for ease of install. read more....
12 May 2015 by Drobbins
Drobbins

Better Experiences: Ego and Vim

Info on Funtoo's new personality tool called 'ego', and user-focused updates to vim's defaults.
27 April 2015 by Drobbins
Drobbins

How We're Keeping You At the Center of the Funtoo Universe

Read about recent developments that keep you, our users, at the forefront of our focus as Funtoo moves forward.
10 April 2015 by Drobbins
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