View Full Version : Help me ! My Linux OS is crashed.
netpro
24-02-2004, 12:36 PM
Máy mình không thể boot được do dịch vụ Send mail không khởi động được. Lý do là em mình có dùng vi editor để soạn thảo file etc\passwd. Có lẽ là đã vô tình xóa mất dòng có liên quan đến dịch vụ này.
Khi boot máy đến dịch vụ send mail thì máy treo không khởi động tiếp.
Vậy có cách này để khởi động và recover file etc\passwd ?
Chào netpro,
Trong Linux để recover bạn có thể dùng chế độ rescure của nó. Để dùng được bạn cần có đĩa CD #1 (phải boot được nhé). Sau đó theo các bước như sau:
+ Boot bằng đĩa của # của linux từ "boot prompt" bạn gõ
linux rescue
Bạn sẽ phả trả lời một số mục về ngôn ngữ ... Sau đó có một thông báo đại loại là:
The rescue environment will now attempt to find your Red Hat
Linux installation and mount it under the directory
/mnt/sysimage. You can then make any changes required to your
system. If you want to proceed with this step choose
'Continue'. You can also choose to mount your file systems
read-only instead of read-write by choosing 'Read-only'.
If for some reason this process fails you can choose 'Skip'
and this step will be skipped and you will go directly to a
command shell.
Hãy chọn continue để vào virtual console (lúc này bạn có 2 VC là 1 and VC 2) bạn có thể dùng các tổ hợp phím [Ctrl]-[Alt]-[F1] và [Ctrl]-[Alt]-[F2] để chuyển đổi qua lại
+ Hãy gõ lệnh
chroot /mnt/sysimage
để đổi root partition của rescue mode environment đến root partition file system của bạn.
+ Dùng lệng
fdisk -l
Để liệt kê các partition có trên máy của bạn ví dụ :
fdisk -l
Disk /dev/hda: 20.5 GB, 20547841536 bytes
255 heads, 63 sectors/track, 2498 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 1020 8193118+ 83 Linux
/dev/hda2 1021 1096 610470 82 Linux swap
/dev/hda3 * 1097 1606 4096575 7 HPFS/NTFS
/dev/hda4 1607 2497 7156957+ f Win95 Ext'd (LBA)
/dev/hda5 1607 2116 4096543+ 7 HPFS/NTFS
/dev/hda6 2117 2497 3060351 83 Linux
Như bạn thấy root partition ở đây là /dev/hda1
+ Dùng lệnh mount để mount root partition (Nhớ phải tạo thư mục bạn muốn mount tới bằng lệnh mkdir /recover)
mount -t ext3 /dev/hda1 /recover
+ Bây giờ bạn có thể dùng vi để sửa lạii file /etc/passwd hoặc làm bất cứ cái gì bạn muốn. Các này cũng có thể dùng để recovery password của root
Chúc thành công
Powered by vBulletin® Version 4.1.9 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.