Tag-Arhiv za » linux «

Nedelja, 4. avgust, 2013 | Avtor:

I had a power outage affect my server’s large md RAID array. Rather than let the server as a whole be down while waiting for it to complete an fsck, I had it boot without the large array so I could run the fsck manually.

Vendar, when running it manually I realised I had no way of knowing how far it was and how long it would take to complete. This is especially problematic with such a large array. With a little searching I found the tip of adding the -C parameter when calling fsck. I couldn’t find this in the documentation however: fsckhelp showed no such option.

The option turns out to be ext4-specific, and thus shows a perfectly functional progress bar with a percentage indicator. To find the information, instead offsckhelp” ali “man fsck”, you have to inputfsck.ext4help” ali “man fsck.ext4”. 🙂

delež
Nedelja, 4. avgust, 2013 | Avtor:

Zgodovina

Veliko se je spremenilo, odkar sem nazadnje omenil moj osebni pomočnik – je zrasla z Skoke in meje (zdaj ima 7TB md RAID6) in ga je pred kratkim obnovili s Ubuntu Strežnik.

Arch nikoli ni bila napaka. Arch Linux me je že naučila toliko o Linuxu (in bo še naprej, da to storijo na mojem drugem namizju). Ampak Arch vsekakor zahteva več časa in pozornosti, kot Rad bi, da preživijo na strežniku. V idealnem primeru bi raje, da lahko pozabite na strežniku za nekaj časa, dokler opomnik email pravi “hm … tam je nekaj posodobitve morate pogledati, kolega.”

Vesolje ni zastonj – in noben od njiju ni prostora

Priložnost, da migrirajo na Ubuntu je dejstvo, da je zmanjkalo SATA pristanišča, pristanišča, potrebni za priključitev trdih diskov za preostali del računalnika – da 7TB RAID polje uporablja veliko pristanišč! Imel sem celo dal proč moja zelo stara 200GB trdega diska, kot je vzel eno od teh pristanišč. Prav tako sem opozoril prejemnika, da je disk SMART Nadzor je navedeno, da je nezanesljiv. Kot začasno rešitev za pomanjkanje SATA pristanišč, Imel sem celo preseliti OS strežnika za niz štirih USB ključi v MD RAID1. Crazy. Vem. Nisem bil preveč zadovoljen s hitrostjo. Odločil sem se, da gredo ven in kupiti novega zanesljiv trdi disk in SATA razširitveno kartico, da gredo z njim.

Primarno particijo Arch strežnika je z okoli 7 GB disk. Velik kos, ki je bil swap datoteka, cached podatki in sicer mešanih ali nepotrebnih datotek. Skupna dejanska velikost OS, vključno /domov Mapa, je bilo le okoli 2 GB. To me je spodbudilo, da si v super-hitro SSD voziti, misleč morda manjši, morda ne bo tako drago. Izkazalo se je, da je najcenejši brez SSD disk lahko najdem dejansko stalo več kot enega od teh relativno majhnih SSD. Yay zame. 🙂

Izbira? Woah?!

Pri izbiri OS, Jaz bi že odločil, da ne bo Arch. Od vseh drugih priljubljenih distribucij, Jaz sem najbolj seznanjeni z Ubuntu in CentOS. Fedora pa tudi možnost – ampak nisem še resno ga šteje za strežnik. Ubuntu je osvojil krog.

Naslednja odločitev, ki sem imel, da bi ne prišlo do mene, dokler Vsesplošna (Namestitev Ubuntu je čarovnik) je vprašal mene: Kako ustanoviti predelne stene.

Bil sem na novo uporabo SSDs v Linux – Jaz sem dobro zavedajo pasti jih ne uporabljate pravilno, predvsem zaradi njihove nevarnosti slabe življenjske dobe, če je zlorabljena.

Nisem želel uporabiti posebno particijo swap. I načrt za nadgradnjo strežnika matično ploščo / CPU / spomin ne predaleč v prihodnosti. Na podlagi tega sem se odločil, bom dal swap swap datoteko na obstoječi RAID MD. Swap ne bo posebej hitro, vendar njen edini namen bo za to redka priložnost, ko je nekaj narobe in spomina ni na voljo.

To pa me je pustila, da bi koren pot polna 60GB iz Intel 330 SSD. Razmišljal sem ločevanje / domov, ampak je samo zdelo malo nesmiselno, saj, kako je bila uporabljena malo v preteklosti. Najprej sem ustanovil particijo z LVM – nekaj, kar sem pred kratkim delal, ko sem ustanovil Linux računalnik (Res, da ni nobenega izgovora, da ne uporabljate LVM). Ko je prišel do dela, kjer bi nastaviti datotečnega sistema, Sem kliknil na spustnem in nagonsko izbrali ext4. Potem sem opazil, btrfs v istem seznamu. Počakaj!!

Ampak kaj?

Btrfs (“masla eff-zave”, “bolje eff-zave”, “bee-drevo-eff-zave”, ali karkoli radi na dan) je relativno nov datotečni sistem razvit z namenom, da bi Linux’ datotečni zmogljivosti nazaj na pravo pot s trenutno tehnologijo datotečnega sistema. Obstoječi King-of-the-Hill datotečni sistem, “ext” (Trenutna različica se imenuje ext4) je zelo dobra – vendar je to omejeno, zaljubljen v staro paradigmo (pomislite na novo blagovno znamko F22 Raptor vs. an F4 Phantom s pol Ještěd poskusu nadgradnje ekvivalentnosti) in je malo verjetno, da bi lahko konkurirali za zelo dolgo z novejšimi Enterprise datotečnimi sistemi, kot so Oracle ZFS. Btrfs še dolga pot, še vedno velja za eksperimentalno (odvisno od tega, kdo ste in kaj vprašati funkcije, ki jih potrebujete). Mnogi menijo, da je stabilna za osnovno uporabo – ampak nihče se dogaja, da nobenih jamstev. In, seveda, vsi pravijo, da ga preizkusite varnostne kopije!

Mooooooo

Najbolj bistvena razlika med ext in btrfs je, da je btrfs “CoW” ali “Kopiranje na Pisanje” datotečni sistem. To pomeni, da so podatki dejansko nikoli ni namenoma nadomestijo je notranjost datotečnega sistema je. Če napišete spremembe v datoteko, btrfs napisali vaše spremembe na novo lokacijo na fizičnih medijih pa bo posodobil notranje kazalci se nanašajo na novo lokacijo. Btrfs gre še korak dlje, saj so ti kazalci notranje (besedilu metapodatkov) so Prav tako CoW. Starejše različice ext Preprosto bi prečrtanih podatkov. Ext4 bi uporabil list, da se zagotovi, da ne bo prišlo do korupcije, bi bilo treba vtič AC potegnil ven v najbolj neprimernem trenutku. Je revija za posledico podobno število korakov morali posodobiti podatke. S SSD, Osnovna strojna oprema deluje podoben proces krava ne glede na to, kaj datotečni sistem, ki ga uporabljate. To je zato, ker SSD diski ne more dejansko prepiše podatke – imajo za kopiranje podatkov (s spremembami) na novo lokacijo, in nato izbriše staro blok v celoti. Optimizacija na tem področju je, da SSD morda niti ne izbriše starega bloka, ampak preprosto zapišite za brisanje blok na kasnejši čas, ko stvari niso tako zaseden. Končni rezultat je, da SSD diski dobro prilegajo s kravo datotečnega sistema in ne opravljajo, pa tudi z nevladnimi krava datotečnih.

Da bi zadeve zanimivo, CoW v datotečnem sistemu lahko gre z roko v roki s funkcijo, imenovano deduplication. To omogoča 2 (ali več) identični blokov podatkov, ki se hranijo samo z eno kopijo, prihranek prostora. Z krava, če se spremeni datoteka deduplicated, ločena twin ne bo vplivala, saj bo bilo spremenjeno datoteko v zapisu podatkov na drug fizični blok.

CoW pa naredi izdelavo posnetkov razmeroma enostavno izvajati. Ko se je posnetek sistema zgolj beleži nov posnetek kot podvajanje vseh podatkov in metapodatkov v obsegu. Z krava, Ob spremembah, posnetek narejen Podatki ostane nespremenjena, in jih je treba ohraniti dosleden pogled statusa datotečnega sistema, je ob času, ki je bil posnetek.

Novi prijatelj

Z zgoraj v mislih, še posebej, ker je Ubuntu na voljo kot btrfs namestite času izbire, Mislil sem, da bi bil pravi čas, da se potopite v btrfs in raziskati malo. 🙂

Del 2 kmalu …

delež
Friday, September 11th, 2009 | Avtor:

Peace in the land of USB

Under a *nix operating system, having multiple partitions on a USB drive isn’t rocket science, it just works. V mojem primeru, my USB drive has two partitions because the first partition is a bootable Arch Linux installer.

I have Windows on a desktop at homemostly for gamingand many of my colleagues use it too. Since Windows doesn’t do very well with non-Windows partitions I figured I could create a FAT32 partition on the memory stick after the bootable Arch Linux partition. FAT32 is almost ubiquitous and is usable on every common desktop operating system in the world.

Bleh

Unfortunately it doesn’t work straight off the bat. Apparently, Microsoft in their infinite wisdom decided that memory sticks are supposed to have one (and only one) partition. In reality Windows finds the first partition and then ignores any others that happen to be set up:

Please Format

Err, no, I do not want you to format my Arch Linux installation partition

The trick to getting it working is to fool Windows into thinking the device is ne a regular USB memory stick but perhaps a solid-state hard disk which happens to be connected via USB. Yes I know, this is seriously stupid that Windows behaves this way. A solid-state hard disk is just a whopping big (and fast) memory stick after all!

I found a few sources on how to do this however I still had to figure out some things on my own. Specifically, the guides I found either skipped some steps or didn’t provide enough information on where to download the driver package.

This procedure involves manually changing hardware drivers and installingnon-signeddriversnot intended for your hardware”. I know someone is going to break their system and blame me so I say now that I take no responsibility for any damage you may do to your Windows system as a result of this. Read that again. 😛

Instructions

remove the highlighted text

click for larger version

Download and unzip the driver, originally created by Hitachi, tukaj. Open the cfadisk.inf file in notepad (or your favourite plaintext editor), and find the section labeled [cfadisk_device]. Remove the section highlighted on the right:

Minimize (don’t close) the editor and go to your desktop iconsright-click on My Computer and select Properties. Select the hardware tab and then select [Device Manager]:

System Properties

Find the device underDisk drives”, right-click your memory stick and select Properties:

Device Manager

Click the Details tab and in the dropdown box on that page, selectHardware Ids”. Click the first line in the list of Hardware IDs and press Ctrl+C to copy the name:

USB Hardware Ids

Don’t close this dialog, go back to notepad (which was minimised) and paste the hardware ID into where the previous content was removed.

Changes pasted into notepad

Save the file in notepad and go back to the device’s property dialog window. Click theDrivertab and click the [Update Driver…] button. In the windows that pop up, selectNo, not this time”; [Next] -> “Install from a list or a specific location (Advanced)”; [Next] -> “Don’t search. I will choose the driver to install.”; [Next] -> [Have Disk…].

Unsigned Drivers - Click Continue Anyway

Browse to the folder where you have saved the modified cfadisk.inf file. kliknite [v redu]. You will find

there is a Hitachi Microdrive driver listed. Select this and click [Next]. When the warning

appears, click [Yes]. Another warning will pop up regarding a similar issue (these are theunsigned” in “not intended for your hardwarewarnings I mentioned earlier). kliknite [Continue Anyway]:

At this point I recommend closing all the dialog boxes related to the setup. Finally, remove and re-insert the memory stick into your USB port and you should find that the extra partitions on the stick are accessible. In the worst-case scenario, you might still need to partition the disk however the hard part is over. 🙂

delež
Wednesday, April 22nd, 2009 | Avtor:

Arch Linux’s installation process is documented on the Arch wiki. I recommend that persons new to Arch try the excellent Beginner’s Guide instead of the Official Arch Linux Install Guide. Though both wiki entries cover similar ground, the Beginner’s Guide gives a lot more relevant information for those new to the system. The Beginner’s Guide is aimed at desktop installation and, as I’m installing a server, I won’t be going through the installation of the graphical environment at all. Assuming that you’re following my installation, assume that I’ve followed the Beginner’s Guide right up to and including the installation of sudo. I installed the ssh daemon afterwards rather than during the initial setup however.

A few small recommendations and notes regarding installation:

  • If you can, consider using a USB memory stick for the installer and keep it handy for future installations.
  • I keep a copy of my localrepositoryof installed applications on my installer memory stick. Once installation is finished I save a bit of download and update time by copying this to the new server’s /var/cache/pacman/pkg/ folder. The repository on my desktop is typically 1.7GB
  • For the rc.conf, South African-appropriate regional settings are:
    LOCALE=en_ZA.utf8
    TIMEZONE=Africa/Johannesburg
  • I’ve set up the network very simply, according to the guide, and will be expanding on the network setup in a later post.
  • As it is for a server, my non-privileged user on the server is only part of 3 groups: wheel (for sudo), storage, and users. A desktop user will likely be in many more groups.

I prefer using an application called jogurt instead of Arch’s default package manager. Yaourt has the exact same usage syntax as pacman except that it supports a few extra options. It is actually a wrapper application in that it, in turn, uses pacman. Importantly, yaourt supports installation of applications from Arch’s AUR. The AUR is a repository of installation scripts built by Arch users for Arch users to easily install applications that are not officially supported by the main Arch repositories. Yaourt can download and install applications from AUR or the main repositories with the same command, treating the AUR asjust another repository”. Pacman unfortunately does not support this.

Again, the installation is covered in the wiki. I recommend the easy route mentioned in the wiki if you’re new at Arch. Its too much too soon to do it the hard way (also mentioned in the wiki entry).

When done, update your system by issuing the single command:

yaourt -Syu

OR

pacman -Syu

and follow the given recommendations.

delež
sobota, March 28th, 2009 | Avtor:

Its amazing how much you can do by combining the small yet powerful commands Unix has available.

This little-used command, time, finally became useful today as a way to report the length of time that certain automated operations are running. In my example, I’m timing how long it takes to build the Linux kernel:

$ time rebuild-kernel26
...
couple-thousand-lines-of-scrolling-text
...
==> Finished making: kernel26 2.6.28.8-1 x86_64 (Sat Mar 28 17:19:52 SAST 2009)
real    62m21.994s
user    43m31.846s
sys     6m1.096s

Yup, that took a little over an hour to build. The values are:

  • realthe actual time elapsed while the command was running – 62 minutes
  • userthe amount of userland time the command used – 43 minutes
  • systhe amount of system time the command used – 6 minutes

(I was busy doing other things while this was happening which is why it took 62 minutes for the desktop to do (43+6=) 49 minutes-worth of work)

If you’re using the GNU version (most likely), it also gives you the option of displaying the results in a custom fashion. Mostly, this command could be useful in scripts where you need to report how long a task tookor maybe? just a geeky way to time something random. 😛

delež
Kategorija: linux  | Oznake: , , , , , , ,  | Pustite komentar